-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add support for running tests with docker-compose #300
Add support for running tests with docker-compose #300
Conversation
2259494
to
b0adc32
Compare
This is looking really good! When you convert the replica tests, you can delete those There is also a related FR for improving the replication tests if you get to it: #291 |
LGTM, but asking @kolbe for secondary review since he understands this stuff better. |
268511c
to
39d29ea
Compare
|
scripts/buildandrun.sh
Outdated
go build ./cmd/spirit | ||
|
||
if [ -n "$REPLICA_DSN" ]; then | ||
./spirit --replica-dsn "$REPLICA_DSN" --host $HOST --username $USERNAME --password $PASSWORD --database=$DATABASE --table=$TABLE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we consider supporting MYSQL_DSN
and REPLICA_DSN
environment variables as overrides to the spirit CLI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer not having spirit behave specially in the presence of bizarre environment variables when we have command-line options that do the job just fine.
condition: service_healthy | ||
environment: | ||
MYSQL_DSN: msandbox:msandbox@tcp(mysql)/test | ||
REPLICA_DSN: rsandbox:rsandbox@tcp(mysql_replica)/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must leave the database name in REPLICA_DSN
blank because rsandbox has no privileges to access the DB. It's only a replication client.
39d29ea
to
44e3dcb
Compare
condition: service_healthy | ||
environment: | ||
HOST: mysql:3306 | ||
USERNAME: msandbox |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We run spirit
with the msandbox
user which now has the minimum privilege level needed.
-- using the same password. | ||
create user if not exists tsandbox@'%' identified with caching_sha2_password by 'msandbox'; | ||
grant R_MIGRATOR, R_REPLICATION to tsandbox@'%' ; | ||
grant references, super, process on *.* to tsandbox@'%'; -- used in tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must create this user with these additional privilege because they're used in tests.Still should be much better than using root
or the earlier msandbox
which was effectively root.
My local attempt to run some of this is failing in a pretty surprising way! Maybe just an issue with cross-platform Docker stuff?
|
@kolbe 8.0.28 doesn't work on arm64. Oracle doesn't provide an arm64 build. All other versions should work fine on Mac laptops. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
TODO:
Docs (holding off docs till support is complete)