Skip to content

Commit d10638b

Browse files
committed
Merge pull request #3325 from mboersma/random-test-fixes
Random test fixes
2 parents c9eb523 + 64ed491 commit d10638b

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

controller/deis/settings.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
from __future__ import unicode_literals
66
import os.path
7+
import random
8+
import string
79
import sys
810
import tempfile
911

@@ -303,6 +305,9 @@
303305
'default': {
304306
'ENGINE': 'django.db.backends.' + os.environ.get('DATABASE_ENGINE', 'postgresql_psycopg2'),
305307
'NAME': os.environ.get('DATABASE_NAME', 'deis'),
308+
# randomize test database name so we can run multiple unit tests simultaneously
309+
'TEST_NAME': "unittest-{}".format(''.join(
310+
random.choice(string.ascii_letters + string.digits) for _ in range(8)))
306311
}
307312
}
308313

tests/bin/test-integration-ec2.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66

77
# fail on any command exiting non-zero
8-
set -e
8+
set -eo pipefail
99

1010
# absolute path to current directory
1111
export THIS_DIR=$(cd $(dirname $0); pwd)
@@ -68,8 +68,7 @@ fi
6868

6969
make discovery-url
7070
# add random characters after STACK_TAG to avoid collisions
71-
# TODO: somehow this breaks "set -eo pipefail"
72-
STACK_TAG=${STACK_TAG:-test}-$(base64 /dev/urandom | tr -dc a-z0-9 | head -c 6)
71+
STACK_TAG=${STACK_TAG:-test}-$(openssl rand -hex 4)
7372
STACK_NAME=deis-$STACK_TAG
7473
echo "Creating CloudFormation stack $STACK_NAME"
7574
$DEIS_ROOT/contrib/ec2/provision-ec2-cluster.sh $STACK_NAME

0 commit comments

Comments
 (0)