Skip to content

Commit

Permalink
chore: Added a test to check the forced upgrade. (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSkrypnyk authored May 3, 2023
1 parent 8e8f98b commit d2e5918
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/bats/data.bats
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,20 @@ copy_code(){
step "Assert that data was captured into the new image."
run docker exec "${cid}" /usr/bin/mysql -e "use drupal;show tables;" drupal
assert_output_contains "users"

run docker logs "${cid}"
assert_output_not_contains "starting mysql upgrade"

step "Start container from the seeded image ${dst_image} and request an upgrade."
# Start container with a non-root user to imitate limited host permissions.
cid=$(docker run --user 1000 -d -e FORCE_MYSQL_UPGRADE=1 --rm "${dst_image}")
substep "Waiting for the service to become ready."
docker exec -i "${cid}" sh -c "until nc -z localhost 3306; do sleep 1; echo -n .; done; echo"

step "Assert that data was captured into the new image."
run docker exec "${cid}" /usr/bin/mysql -e "use drupal;show tables;" drupal
assert_output_contains "users"

run docker logs "${cid}"
assert_output_contains "starting mysql upgrade"
}

0 comments on commit d2e5918

Please sign in to comment.