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
Improve tests for check-mysql #629
Conversation
susisu
commented
Jul 28, 2022
•
edited
edited
- Specify docker platform explicitly so that they can be run on Docker Desktop for Mac on Apple silicon
- Run all tests on CI
- Because of this, it takes about 1 minute longer than before (but I think it's acceptable)
- Fix some unstable tests
- Refactor test scripts
2f6c090
to
0b303e8
Compare
0b303e8
to
cbae4d1
Compare
93ed4c1
to
e6a0ed9
Compare
@@ -1,7 +1,7 @@ | |||
#!/bin/bash | |||
|
|||
# prepare tests | |||
for f in check-*/test.sh check-*/test-*.sh |
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.
There's no test-*.sh
to be executed directly anymore
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.
[may][nit] or else: check-*/test*.sh
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 also wanted to allow each plugin to control how to run its tests, like avoiding port conflicts #629 (comment).
It's still possible if test.bash
executes all of test*.sh
, but I think only executing test.sh
is easier to control.
|
||
if ! $plugin connection --host=127.0.0.1 --port=$primary_port --user=$user --password=$password; then | ||
echo 'FAIL: connection should be OK' | ||
exit 1 | ||
fi | ||
|
||
sleep 2 |
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.
Since the following test requires uptime to be > 2, it might be unstable.
@@ -12,13 +12,12 @@ fi | |||
|
|||
cd $(dirname $0) | |||
plugin=$(basename $(realpath ../)) | |||
if ! which -s $plugin |
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.
which -s
do not work on the CI environment.
trap 'docker-compose down --rmi local -v' EXIT | ||
sleep $sleep_time | ||
|
||
USER=$user PASSWORD=$password PORT=$primary_port ../wait.sh |
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 think it's better than sleep
, because sleep
does not ensure that MySQL server has been started up.
# starting replication may take a while | ||
sleep 1 |
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.
Because starting replication takes some time, the following test was unstable.
./test_57/test.sh | ||
./test_8/test.sh | ||
./test-tls.sh |
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.
Run sequentially because it's the easiest way to avoid port conflicts.
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~
@@ -1,7 +1,7 @@ | |||
#!/bin/bash | |||
|
|||
# prepare tests | |||
for f in check-*/test.sh check-*/test-*.sh |
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.
[may][nit] or else: check-*/test*.sh