Do not FailNow() in generators (#8469)

This commit is contained in:
Anton Tayanovskyy 2021-11-19 20:39:11 -05:00 committed by GitHub
parent 87d8c7f074
commit 574a6a104d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,7 +2,7 @@
package testing package testing
import ( import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/assert"
"pgregory.net/rapid" "pgregory.net/rapid"
"github.com/pulumi/pulumi/sdk/v3/go/common/resource" "github.com/pulumi/pulumi/sdk/v3/go/common/resource"
@ -191,7 +191,7 @@ func StringPropertyGenerator() *rapid.Generator {
func TextAssetGenerator() *rapid.Generator { func TextAssetGenerator() *rapid.Generator {
return rapid.Custom(func(t *rapid.T) *resource.Asset { return rapid.Custom(func(t *rapid.T) *resource.Asset {
asset, err := resource.NewTextAsset(rapid.String().Draw(t, "text asset contents").(string)) asset, err := resource.NewTextAsset(rapid.String().Draw(t, "text asset contents").(string))
require.NoError(t, err) assert.NoError(t, err)
return asset return asset
}) })
} }
@ -218,7 +218,7 @@ func LiteralArchiveGenerator(maxDepth int) *rapid.Generator {
contentsGenerator = rapid.Just(map[string]interface{}{}) contentsGenerator = rapid.Just(map[string]interface{}{})
} }
archive, err := resource.NewAssetArchive(contentsGenerator.Draw(t, "literal archive contents").(map[string]interface{})) archive, err := resource.NewAssetArchive(contentsGenerator.Draw(t, "literal archive contents").(map[string]interface{}))
require.NoError(t, err) assert.NoError(t, err)
return archive return archive
}) })
} }