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

Improve tests for check-mysql #629

Merged
merged 9 commits into from Jul 29, 2022
Merged

Improve tests for check-mysql #629

merged 9 commits into from Jul 29, 2022

Conversation

susisu
Copy link
Contributor

@susisu susisu commented Jul 28, 2022

  • 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

@susisu susisu marked this pull request as ready for review July 28, 2022 12:22
@@ -1,7 +1,7 @@
#!/bin/bash

# prepare tests
for f in check-*/test.sh check-*/test-*.sh
Copy link
Contributor Author

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

Copy link
Member

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

Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Contributor Author

@susisu susisu Jul 28, 2022

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
Copy link
Contributor Author

@susisu susisu Jul 28, 2022

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.

Comment on lines +83 to +84
# starting replication may take a while
sleep 1
Copy link
Contributor Author

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.

Comment on lines +9 to +11
./test_57/test.sh
./test_8/test.sh
./test-tls.sh
Copy link
Contributor Author

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.

@susisu susisu changed the title Update tests for check-mysql Improve tests for check-mysql Jul 28, 2022
Copy link
Member

@lufia lufia left a 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
Copy link
Member

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

@susisu susisu merged commit a5efe13 into master Jul 29, 2022
@susisu susisu deleted the update-mysql-test branch July 29, 2022 05:46
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

2 participants