generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: convert build_go_test into an integration test
- Loading branch information
Showing
4 changed files
with
57 additions
and
259 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,56 @@ | ||
//go:build integration | ||
|
||
package buildengine | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"github.com/alecthomas/assert/v2" | ||
|
||
in "github.com/TBD54566975/ftl/internal/integration" | ||
) | ||
|
||
func TestGoBuildClearsBuildDir(t *testing.T) { | ||
file := "another/.ftl/test-clear-build.tmp" | ||
in.Run(t, | ||
in.WithTestDataDir("testdata"), | ||
in.CopyModule("another"), | ||
in.WriteFile(file, []byte{1}), | ||
in.FileExists(file), | ||
in.Build("another"), | ||
in.ExpectError(in.FileExists(file), "no such file"), | ||
) | ||
} | ||
|
||
func TestExternalType(t *testing.T) { | ||
in.Run(t, | ||
in.WithTestDataDir("testdata"), | ||
in.CopyModule("external"), | ||
in.ExpectError(in.Build("external"), | ||
`unsupported type "time.Month" for field "Month"`, | ||
`unsupported external type "time.Month"; see FTL docs on using external types: tbd54566975.github.io/ftl/docs/reference/externaltypes/`, | ||
`unsupported response type "ftl/external.ExternalResponse"`, | ||
), | ||
) | ||
} | ||
|
||
func TestGeneratedTypeRegistry(t *testing.T) { | ||
expected, err := os.ReadFile("testdata/type_registry_main.go") | ||
assert.NoError(t, err) | ||
|
||
file := "other/.ftl/go/main/main.go" | ||
|
||
in.Run(t, | ||
in.WithTestDataDir("testdata"), | ||
// Deploy dependency | ||
in.CopyModule("another"), | ||
in.Deploy("another"), | ||
// Build the module under test | ||
in.CopyModule("other"), | ||
in.ExpectError(in.FileExists(file), "no such file"), | ||
in.Build("other"), | ||
// Validate the generated main.go | ||
in.FileContent(file, string(expected)), | ||
) | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.