Skip to content

Commit

Permalink
T3C integration tests: Seed database after resetting it (#7785)
Browse files Browse the repository at this point in the history
  • Loading branch information
zrhoffman committed Sep 6, 2023
1 parent 352337d commit 335406d
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions cache-config/testing/docker/traffic_ops/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
Expand Down Expand Up @@ -128,10 +128,10 @@ if [ -z "$INITIALIZED" ]; then init; fi

i=0
sleep_time=3
while ! nc $DB_SERVER $DB_PORT </dev/null; do
while ! nc $DB_SERVER $DB_PORT </dev/null; do
echo "waiting for $DB_SERVER:$DB_PORT" >> /var/log/traffic_ops/to_admin.log
sleep $sleep_time
let i=i+1
let i=i+1
if [ $i -gt 10 ]; then
let d=i*sleep_time
echo "$DB_SERVER:$DB_PORT is unavailable after $d seconds, giving up" >> /var/log/traffic_ops/to_admin.log
Expand All @@ -145,10 +145,14 @@ set -o errexit
mkdir -p /var/log/traffic_ops/
touch /var/log/traffic_ops/to_admin.log /var/log/traffic_ops/tv_admin.log
tail -f /var/log/traffic_ops/to_admin.log /var/log/traffic_ops/tv_admin.log &
cd /opt/traffic_ops/app && db/admin --env=production reset >> /var/log/traffic_ops/to_admin.log 2>&1
cd /opt/traffic_ops/app && db/admin --trafficvault --env=production reset >> /var/log/traffic_ops/tv_admin.log 2>&1
) || {
echo Failed to run migrations
cd /opt/traffic_ops/app
(
db/admin --env=production reset
db/admin --env=production upgrade
db/admin --trafficvault --env=production reset
db/admin --trafficvault --env=production upgrade
) >> /var/log/traffic_ops/to_admin.log 2>&1) || {
echo Failed to run migrations;
exit 1
}

Expand Down

0 comments on commit 335406d

Please sign in to comment.