pulsar-client-go icon indicating copy to clipboard operation
pulsar-client-go copied to clipboard

Feat: Integration testing with testcontainers go

Open flowchartsman opened this issue 2 years ago • 2 comments

Motivation

Instead of building a customized container, test using base image and testcontainers-go. This enables manual individual test execution, and will only create the integration container if tests are run which require it.

Modifications

  • Integration container singleton using testcontainers-go
  • Modify helper URLs to pull from mapped ports on integration container, ensuring that only tests which access these URLS will cause the integration container to get created.

Verifying this change

cd <repo root>/pulsar && go test -v -race ./...

  • [ ] Make sure that the change passes the CI checks.

This change is already covered by existing integration tests.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): yes
    • docker library dependencies have been updated to avoid the http: invalid Host header error (moby/moby#45935)
  • The public API: no
  • The schema: no
  • The default values of configurations: no
  • The wire protocol: no

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? not applicable
  • If a feature is not applicable for documentation, explain why?
    • this is a test-only feature

WIP

Some connection tests are failing, such as the "retry on multipl hostname" or producer connection tests, however it's unclear how these changes would suddenly cause this test to fail, so it's possible these are flakey.

Tasks:

  • [ ] Collect output with go test -v and compare against vanilla repo in an attempt to identify tests that are passing, but shouldn't, and determine of the above errors are flakey tests or something different about the testcontainers-go environment
  • [ ] allow container to (optionally) persist for local iteration on a single test or feature

flowchartsman avatar Aug 13 '23 03:08 flowchartsman