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

fix docker compose tests #5479

Merged
merged 4 commits into from
Dec 16, 2023
Merged

Conversation

3vilhamster
Copy link
Contributor

@3vilhamster 3vilhamster commented Dec 15, 2023

What changed?
Added health checks for CI runners with cassandra using healthcheck and depends_on: service_healthy.

Also, removed some unnecessary rebuilds/regenerations that were performed in the tests.

Also, removed extra steps from unit test executions and made it possible to run docker-compose like on CI locally.

Why?
Fixing test failures on CI

How did you test it?
Run locally

Potential risks
Failing builds on CI

Release notes

Documentation Changes

healthcheck:
test: ["CMD", "cqlsh", "-u cassandra", "-p cassandra" ,"-e describe keyspaces"]
interval: 15s
timeout: 10s
Copy link
Contributor

Choose a reason for hiding this comment

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

let's increase timeout to 30s to avoid flakiness in case cassandra bootstrap doesn't settle quickly when there's not enough cpu/memory

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Increased

Comment on lines +145 to +146
- /cadence/.build/ # ensure we don't mount the build directory
- /cadence/.bin/ # ensure we don't mount the bin directory
Copy link
Contributor

@Groxx Groxx Dec 15, 2023

Choose a reason for hiding this comment

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

does this.... hide the out-of-docker .build and .bin folders? any other consequences, e.g. reusing them between runs since volumes are generally intended to be persistent?

hiding seems useful and if that's all this does it's nice and simple, though we probably also want to hide the binaries to be a bit more complete (it'll influence build, and arch may be different)

Copy link
Contributor

@Groxx Groxx Dec 15, 2023

Choose a reason for hiding this comment

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

ah, TIL "anonymous volumes". so it sounds like this does reuse them between runs.

might be useful? it'll save re-downloading stuff, which is likely good. assuming the .build / .bin dirty-detection is good enough anyway, otherwise people will also have to know to delete these volumes...

if we really want this all to run quickly on local, we can also mount the GOPATH/pkg/mod folder, since that's platform-agnostic and accounts for the vast majority of the downloads. I'm not sure how to make use of that in buildkite tho.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It not only rebuild stuff, it reruns generate, goimports, copyright. So no point on that.
And it is broken on local machine, unless you are running on linux x86.
I want to introduce GOPATH/pkg/mod cache in a separate pr. Maybe as a separate problem we can introduce volumes. Though, all our steps are running independently, so I doubt they are reusing volumes.

@@ -86,8 +91,9 @@ services:
build:
context: ../../
dockerfile: ./docker/buildkite/Dockerfile
command: make cover_profile
command: sh -c "make .just-build && make install-schema && make cover_profile"
Copy link
Contributor

Choose a reason for hiding this comment

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

poking at this locally, I kinda think we don't want make install-schema here. it fails if the schema already exists, which means you can't re-run unit tests without tossing and restarting the cassandra container :\

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not the tool that you use to run unit tests. This is a "close to CI" way to simulate what is running on buildkite, so I wanted it to behave as CI run. If it will be needed, we can separate it to an extra step, but it was useful to debug the problem

Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose in that scenario, people would have to drop cassandra each time? and that's reasonable because it matches CI?

which may be reasonable, this is in a buildkite folder after all. it's not a totally general thing. just checking / understanding.

@@ -548,7 +548,7 @@ test_e2e_xdc: bins
go test $(TEST_ARG) -coverprofile=$@ "$$dir" $(TEST_TAG) | tee -a test.log; \
done;

cover_profile: bins
Copy link
Contributor

@Groxx Groxx Dec 15, 2023

Choose a reason for hiding this comment

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

bins may be excessive, but this is broadly useful to ensure it builds before running all tests. otherwise it can get like 90% of the way through before failing on a syntax error or partial-refactor or something.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have a separate job that generates bins and verifies copyright and etc. If something is broken, I expect tests to fail. In this case bins generation/verification takes a lot of time.

Copy link
Contributor

Choose a reason for hiding this comment

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

yea, fair. I suppose this is really only intended for CI, most people should be using make cover instead?

@3vilhamster 3vilhamster enabled auto-merge (squash) December 16, 2023 00:02
@3vilhamster 3vilhamster merged commit 40018f1 into uber:master Dec 16, 2023
16 checks passed
Makefile Show resolved Hide resolved
Copy link
Contributor

@Groxx Groxx left a comment

Choose a reason for hiding this comment

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

I'm too late for an official review, but yea this all looks reasonable + an improvement, and it seems to work well for me locally. Thank you!

@3vilhamster 3vilhamster deleted the fix-docker-compose-tests branch December 16, 2023 11:29
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.

None yet

3 participants