mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-04-15 11:56:56 +02:00
test: cover context with timeout
This commit is contained in:
parent
bfa79275bc
commit
f422e7734d
@ -2,6 +2,7 @@ package context
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/goreleaser/goreleaser/config"
|
"github.com/goreleaser/goreleaser/config"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
@ -12,3 +13,12 @@ func TestNew(t *testing.T) {
|
|||||||
assert.NotEmpty(t, ctx.Env)
|
assert.NotEmpty(t, ctx.Env)
|
||||||
assert.Equal(t, 4, ctx.Parallelism)
|
assert.Equal(t, 4, ctx.Parallelism)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestNewWithTimeout(t *testing.T) {
|
||||||
|
ctx, cancel := NewWithTimeout(config.Project{}, time.Second)
|
||||||
|
assert.NotEmpty(t, ctx.Env)
|
||||||
|
assert.Equal(t, 4, ctx.Parallelism)
|
||||||
|
cancel()
|
||||||
|
<-ctx.Done()
|
||||||
|
assert.EqualError(t, ctx.Err(), `context canceled`)
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user