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

Feat/e2e release tests #221

Merged
merged 4 commits into from
Oct 10, 2022
Merged

Feat/e2e release tests #221

merged 4 commits into from
Oct 10, 2022

Conversation

colmsnowplow
Copy link
Collaborator

@colmsnowplow colmsnowplow commented Oct 5, 2022

This PR adds end-to-end release testing for stream replicator. This consists of a set of tests which run against the docker asset itself, using predefined configurations.

Resources are emulated via localstack, pubsub emulator, a http server built in-code, and a kafka instance. This is done with a view to using full resource deployments in future.

There are no EventHub tests becuase no local emulator exists for EventHubs.

Additionally:

  • In order to facilitate localstack testing, a configuration option to set a custom AWS endpoint is added to all AWS sources and targets.
  • A bug was discovered whereby a dependency (goccy/go-json) panics sometimes. This is replaced in this PR
  • A couple of other bugs were discovered and logged - these are not addressed here as they require some effort which would block progress on e2e testing. Specifically:

#215
#212
#214

The latter of these means that some Lua transformation modes are untested in these e2e tests - we will address this in the same release, however.

Commands (from repo root):

First build the docker container locally with make all.
Setup test resources: make e2e-up
Run the release tests: make e2e-test
Tear down test resources: make e2e-down

Copy link
Contributor

@TiganeteaRobert TiganeteaRobert left a comment

Choose a reason for hiding this comment

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

Great job on this, also love the fact that we finally (hopefully) tied down the issues we had with gojson too.

pkg/source/sqs/sqs_source_test.go Show resolved Hide resolved
pkg/target/kinesis_test.go Show resolved Hide resolved

// Helper function to run docker command
// This assumes that docker assets are built (make all) and integration resources exist (make integration-up)
func runDockerCommand(secondsBeforeShutdown time.Duration, testName string, configFilePath string, binaryVersion string, additionalOpts string) ([]byte, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason why you chose to use Docker using bash instead of using a package such as https://pkg.go.dev/github.com/docker/docker/client#pkg-index?

Although I'm unsure if it might be worth importing this package just for this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Honest answer is I started with a janky bash script to spike things out, and I never thought of this alternative way.

I'll take a look at what using the package would look like

release_test/e2e_source_test.go Outdated Show resolved Hide resolved
release_test/e2e_target_test.go Outdated Show resolved Hide resolved
Copy link

@dilyand dilyand left a comment

Choose a reason for hiding this comment

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

Looks great @colmsnowplow .

pkg/source/kinesis/kinesis_source.go Show resolved Hide resolved
pkg/target/pubsub_test.go Show resolved Hide resolved
pkg/testutil/localstack.go Outdated Show resolved Hide resolved
pkg/testutil/pubsub_helpers.go Outdated Show resolved Hide resolved
release_test/e2e_common_test.go Show resolved Hide resolved
release_test/e2e_target_test.go Outdated Show resolved Hide resolved
release_test/e2e_source_test.go Show resolved Hide resolved
release_test/input.txt Show resolved Hide resolved
return strings.Split(string(inputData), "\n")
}

func TestE2EPubsubSource(t *testing.T) {
Copy link

Choose a reason for hiding this comment

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

If you run all possible (source, target) combos, you won't need a separate suit of source tests, as the sources will be tested as part of the combo.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think having them separate is advantageous from a debugging point of view - I'd like it to be unambiguous where the problem is.

However, I do think we can extend the tests to combine sources, targets and transformations. I didn't go that far in this PR purely from the POV of keeping it simple and delivering a first iteration.

I'd like to do a bit of scoping work to decide which combinations to test (maybe all sources & targets, maybe all combinations of all 3, maybe just key use cases. Not sure), and deliver something along those lines in a future release.

release_test/e2e_source_test.go Outdated Show resolved Hide resolved
@colmsnowplow colmsnowplow merged commit 0d82250 into release/1.1.0 Oct 10, 2022
@colmsnowplow colmsnowplow deleted the feat/e2e-release-tests branch October 10, 2022 15:08
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.

3 participants