Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration test to check type error display (#360)
* Add integration test to check type error display This test is unfortunately and necessarily fragile, since it tests what the user is displayed instead of a structured result. * Fix copyright lint * Depend on pulumi 3.41.1 * Change name to avoid confliting with FAIL * Assert contain instead of equal * Get test data and add new test
- Loading branch information
Showing
3 changed files
with
66 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright 2022, Pulumi Corporation. All rights reserved. | ||
|
||
package tests | ||
|
||
import ( | ||
"path/filepath" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func integrationDir(dir string) string { | ||
return filepath.Join("./testdata", dir) | ||
} | ||
|
||
//nolint:paralleltest // uses parallel programtest | ||
func TestTypeCheckError(t *testing.T) { | ||
testWrapper(t, integrationDir("type-fail"), ExpectFailure, StderrValidator{ | ||
f: func(t *testing.T, stderr string) { | ||
assert.Contains(t, stderr, | ||
`Cannot assign '{length: string, lower: number}' to 'random:index/randomString:RandomString': | ||
length: Cannot assign type 'string' to type 'integer' | ||
lower: Cannot assign type 'number' to type 'boolean' | ||
`) | ||
}, | ||
}) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name: test-type-fail | ||
runtime: yaml | ||
resources: | ||
randomString: | ||
type: random:RandomString | ||
properties: | ||
length: "three" | ||
lower: 7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters