Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Add clear TestMain instructions

...

  1. All integration tests should be in a subpackage, not in the root integration package.
  2. Integration tests should be executing pipelines with ptest.Run(). Tests that do not execute pipelines likely do not belong as integration tests.
    1. If this is a new package, it's required that TestMain(m *testing.M) is defined and calls ptest.Main(m).
  3. The integration package defines a way to enable test filtering for your integration test. All integration tests should have test filtering enabled.
    1. The test filter will fail the test in the event TestMain doesn't call ptest.Main.

Running Tests

  1. Manually: Tests can be run manually with the usual go test command by including any necessary flags. This approach is useful for running specific tests, but it requires any necessary services, such as job servers and cross-language expansion services, to be available with endpoints to use. For example:
    • go test -v ./sdks/go/test/integration/... --runner=portable --endpoint=localhost:8099
  2. Script: The  script beam/sdks/go/test/run_validatesrunner_tests.sh can be run to provide some automation, and is more convenient for running a runner with more complex configuration, such as Dataflow.
  3. Gradle: There are gradle tasks to build required services and run the script in beam/sdks/go/test/build.gradle. This approach is recommended for a convenient way of running the full integration test suite on a single runner. For example:
    • ./gradlew :clean :sdks:go:test:ulrValidatesRunner

...