Skip to content

Commit

Permalink
fix: flaky test
Browse files Browse the repository at this point in the history
duplicates need to be declared in separate files (parent and child) for error report test. otherwise the ordering of which is discovered first may change and the test is flaky
  • Loading branch information
worstell committed Jul 12, 2024
1 parent a4e6674 commit 70d6bdb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions go-runtime/compile/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,8 @@ func TestErrorReporting(t *testing.T) {
// failing/failing.go
expectedParent := []string{
`13:13-34: expected string literal for argument at index 0`,
`16:18-18: duplicate config declaration for "failing.FTL_ENDPOINT"; already declared at "37:18"`,
`19:18-18: duplicate secret declaration for "failing.FTL_ENDPOINT"; already declared at "38:18"`,
`16:18-18: duplicate config declaration for "failing.FTL_CONFIG_ENDPOINT"; already declared at "37:18"`,
`19:18-18: duplicate secret declaration for "failing.FTL_SECRET_ENDPOINT"; already declared at "38:18"`,
`22:14-44: duplicate database declaration at 21:14-44`,
`25:2-10: unsupported type "error" for field "BadParam"`,
`28:2-17: unsupported type "uint64" for field "AnotherBadParam"`,
Expand Down Expand Up @@ -582,7 +582,7 @@ func TestErrorReporting(t *testing.T) {
`19:6-41: declared type github.com/blah.lib.NonFTLType in typemap does not match native type github.com/TBD54566975/ftl/go-runtime/compile/testdata.lib.NonFTLType`,
`24:6-6: multiple Go type mappings found for "ftl/failing/child.MultipleMappings"`,
`34:2-13: enum variant "SameVariant" conflicts with existing enum variant of "EnumVariantConflictParent" at "196:2"`,
`37:18-18: schema declaration with name "FTL_ENDPOINT" already exists for module "failing"; previously declared at "38:18"`,
`40:25-25: schema declaration with name "Redeclared" already exists for module "failing"; previously declared at "27:6"`,
}
assert.Equal(t, expectedParent, actualParent)
assert.Equal(t, expectedChild, actualChild)
Expand Down
6 changes: 4 additions & 2 deletions go-runtime/compile/testdata/failing/child/child.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,7 @@ const (
SameVariant EnumVariantConflictChild = iota
)

var duplConfig = ftl.Config[string]("FTL_ENDPOINT")
var duplSecret = ftl.Secret[string]("FTL_ENDPOINT")
var duplConfig = ftl.Config[string]("FTL_CONFIG_ENDPOINT")
var duplSecret = ftl.Secret[string]("FTL_SECRET_ENDPOINT")

var duplicateDeclName = ftl.Config[string]("Redeclared")
4 changes: 2 additions & 2 deletions go-runtime/compile/testdata/failing/failing.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (
var empty = ftl.Config[string](1)

// var duplConfig = ftl.Config[string]("FTL_ENDPOINT")
var goodConfig = ftl.Config[string]("FTL_ENDPOINT")
var goodConfig = ftl.Config[string]("FTL_CONFIG_ENDPOINT")

// var duplSecret = ftl.Secret[string]("FTL_ENDPOINT")
var goodSecret = ftl.Secret[string]("FTL_ENDPOINT")
var goodSecret = ftl.Secret[string]("FTL_SECRET_ENDPOINT")

var goodDB = ftl.PostgresDatabase("testDb")
var duplDB = ftl.PostgresDatabase("testDb")
Expand Down

0 comments on commit 70d6bdb

Please sign in to comment.