mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-06 03:13:48 +02:00
test: cover context with timeout
This commit is contained in:
parent
bfa79275bc
commit
f422e7734d
@ -2,6 +2,7 @@ package context
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/goreleaser/goreleaser/config"
|
||||
"github.com/stretchr/testify/assert"
|
||||
@ -12,3 +13,12 @@ func TestNew(t *testing.T) {
|
||||
assert.NotEmpty(t, ctx.Env)
|
||||
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…
Reference in New Issue
Block a user