Add wrapper script
This commit is contained in:
parent
48349e947f
commit
5e981a7283
10
.github/workflows/replica-tests.yml
vendored
10
.github/workflows/replica-tests.yml
vendored
|
@ -4,7 +4,6 @@ on:
|
|||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
matrix:
|
||||
|
@ -25,13 +24,8 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: generate mysql environment file
|
||||
env:
|
||||
TEST_STORAGE_ENGINE: "${{ matrix.tests.engine }}"
|
||||
run: localtests/mysql-env.sh
|
||||
|
||||
- name: run localtests
|
||||
env:
|
||||
TEST_DOCKER_IMAGE: "${{ matrix.tests.image }}"
|
||||
run: docker-compose -f localtests/docker-compose.yml up --abort-on-container-exit --no-log-prefix tests
|
||||
|
||||
TEST_STORAGE_ENGINE: "${{ matrix.tests.engine }}"
|
||||
run: localtests/tests.sh
|
||||
|
|
|
@ -136,9 +136,11 @@ func (test *Test) Migrate(config Config, primary, replica *sql.DB) (err error) {
|
|||
stopStdout := make(chan bool)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
|
||||
if isGitHubActions() {
|
||||
fmt.Printf("::group::%s stdout\n", test.Name)
|
||||
}
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-stopStdout:
|
||||
|
|
|
@ -3,7 +3,6 @@ services:
|
|||
tests:
|
||||
build:
|
||||
context: "../"
|
||||
dockerfile: "localtests/Dockerfile"
|
||||
env_file: "mysql.env"
|
||||
depends_on:
|
||||
- "primary"
|
||||
|
|
31
localtests/tests.sh
Executable file
31
localtests/tests.sh
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
export TEST_DOCKER_IMAGE=${1:-mysql:5.7}
|
||||
|
||||
LOCALTESTS_DIR="$(readlink -f $(dirname $0))"
|
||||
cd $LOCALTESTS_DIR
|
||||
|
||||
# generate mysql.env file for containers
|
||||
[ ! -z "$GITHUB_ACTION" ] && echo "::group::generate mysql env"
|
||||
./mysql-env.sh
|
||||
[ ! -z "$GITHUB_ACTION" ] && echo "::endgroup::"
|
||||
|
||||
# conditional pre-build
|
||||
EXTRA_UP_FLAGS=
|
||||
if [ -z "$GITHUB_ACTION" ]; then
|
||||
EXTRA_UP_FLAGS="--build"
|
||||
else
|
||||
echo "::group::docker image build"
|
||||
docker-compose build
|
||||
echo "::endgroup::"
|
||||
fi
|
||||
|
||||
# this will start the test container and the
|
||||
# mysql primary/replica w/docker-compose
|
||||
docker-compose up \
|
||||
--abort-on-container-exit \
|
||||
--no-log-prefix \
|
||||
$EXTRA_UP_FLAGS \
|
||||
tests
|
Loading…
Reference in New Issue
Block a user