Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: parameterize integration tests #840

Merged
merged 1 commit into from
Jan 31, 2024

Conversation

worstell
Copy link
Contributor

@worstell worstell commented Jan 27, 2024

refactors integration tests to execute identically across runtimes

with this change, we can also specify tests to run with the integration-test script (e.g. integration-tests TestLifecycle — all tests are fully encapsulated and can execute alone). providing no option will run all tests.

tests have been split into the following:

  • TestLifecycle (init, deploy, call)
  • TestHttpIngress (tests aliased fields and all http methods )
  • TestDatabase
  • TestExternalCalls (kotlin -> go call, kotlin -> kotlin call, etc. for all runtime permutations)

a couple small changes captured by the integration tests are also included in this PR:

  • Database.kt converts module name and DB name to uppercase to align with the Go DB SDK
  • Kotlin schema extractor includes module names for all DataRef schema objects, even those declared in the referencing module (this fixes builtin.HttpRequest/Response types for HTTP ingress in Kotlin)

Copy link
Collaborator

@alecthomas alecthomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome Lizzy, thanks so much for doing this!

Now that you've separated the tests, we should run every integration test as parallel jobs in CI. We'll need a way to list the tests. What I have done in the past is to just grep out the test functions like grep '^func Test' | awk '{print $2}' | cut -d'(' -f1. I think you'll need to push this into a GHA variable, and reference it in a matrix of (language, test), if that's possible.

integration/integration_test.go Outdated Show resolved Hide resolved
integration/integration_test.go Outdated Show resolved Hide resolved
integration/integration_test.go Outdated Show resolved Hide resolved
t.moduleRoot = filepath.Join(modulesDir, t.moduleName)
t.modulePath = t.moduleRoot
case "kotlin":
t.moduleRoot = filepath.Join(modulesDir, fmt.Sprintf("ftl-module-%s", t.moduleName))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated but I think we should get rid of ftl-module-<name> and just have <name>.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed!

import (
"context"

ftl "github.com/TBD54566975/ftl/go-runtime/sdk" // Import the FTL SDK.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also unrelated but I think we should change this package from sdk to ftl

integration/testdata/go/externalcalls/echogo.go Outdated Show resolved Hide resolved
integration/testdata/go/httpingress/echogo.go Outdated Show resolved Hide resolved
integration/testdata/kotlin/httpingress/Echokotlin.kt Outdated Show resolved Hide resolved
@worstell worstell force-pushed the worstell/20240126-refactor-integration-tests branch 19 times, most recently from 9217ae1 to a34169c Compare January 31, 2024 20:04
refactors integration tests to execute identically across runtimes

with this change, we can also specify tests to run with the integration-test script (e.g. `integration-tests TestLifecycle` — all tests are fully encapsulated and can execute alone). providing no option will run all tests.

tests have been split into the following:

- TestLifecycle (init, deploy, call)
- TestHttpIngress (tests all http methods and tests aliased fields)
- TestDatabase
- TestExternalCalls (kotlin -> go call, kotlin -> kotlin call, etc. for all runtime permutations)

a couple small changes captured by the integration tests are also included in this PR:
- Database.kt converts module name and DB name to uppercase to align with the Go DB SDK
- Kotlin schema extractor includes module names for all DataRef schema objects, even those declared in the referencing module (this fixes builtin.HttpRequest/Response types for HTTP ingress in Kotlin)
@worstell worstell force-pushed the worstell/20240126-refactor-integration-tests branch from a34169c to 4824784 Compare January 31, 2024 20:04
@worstell worstell merged commit ae379aa into main Jan 31, 2024
17 checks passed
@worstell worstell deleted the worstell/20240126-refactor-integration-tests branch January 31, 2024 20:12
@alecthomas
Copy link
Collaborator

Huge, Lizzy, nice work and thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants