You've already forked goreleaser
mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-07-15 01:34:21 +02:00
test: cover context with timeout
This commit is contained in:
@ -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`)
|
||||
}
|
||||
|
Reference in New Issue
Block a user