Skip to content

Commit fe091d1

Browse files
committed
fix(tests): allow concurrent client tests with DEIS_PROFILE
1 parent 37d8f0e commit fe091d1

3 files changed

Lines changed: 15 additions & 6 deletions

File tree

tests/bin/test-integration-ec2.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ fi
6868

6969
make discovery-url
7070
# add random characters after STACK_TAG to avoid collisions
71-
STACK_TAG=${STACK_TAG:-test}-$(openssl rand -hex 4)
71+
STACK_TAG=${STACK_TAG:-test}-$DEIS_TEST_ID
7272
STACK_NAME=deis-$STACK_TAG
7373
echo "Creating CloudFormation stack $STACK_NAME"
7474
$DEIS_ROOT/contrib/ec2/provision-ec2-cluster.sh $STACK_NAME

tests/bin/test-setup.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ echo "HOST_IPADDR=$HOST_IPADDR"
5050
export DEV_REGISTRY=${DEV_REGISTRY?}
5151
echo "DEV_REGISTRY=$DEV_REGISTRY"
5252

53+
# random 10-char (5-byte) hex string to identify a test run
54+
export DEIS_TEST_ID=${DEIS_TEST_ID:-$(openssl rand -hex 5)}
55+
echo "DEIS_TEST_ID=$DEIS_TEST_ID"
56+
57+
# give this session a unique ~/.deis/<client>.json file
58+
export DEIS_PROFILE=test-$DEIS_TEST_ID
59+
rm -f $HOME/.deis/test-$DEIS_TEST_ID.json
60+
5361
# bail if registry is not accessible
5462
if ! curl -s $DEV_REGISTRY; then
5563
echo "DEV_REGISTRY is not accessible, exiting..."
@@ -77,9 +85,6 @@ ssh-add -D || eval $(ssh-agent) && ssh-add -D
7785
ssh-add ~/.ssh/$DEIS_TEST_AUTH_KEY
7886
ssh-add $DEIS_TEST_SSH_KEY
7987

80-
# clean out deis session data
81-
rm -rf ~/.deis
82-
8388
# wipe out all vagrants & deis virtualboxen
8489
function cleanup {
8590
log_phase "Cleaning up"

tests/integration_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@ package tests
55
import (
66
"encoding/json"
77
"io/ioutil"
8+
"os"
89
"os/user"
910
"path"
1011
"testing"
1112

1213
"github.com/deis/deis/tests/utils"
1314
)
1415

15-
const clientJsonFilePath string = ".deis/client.json"
16-
1716
var (
1817
gitCloneCmd = "if [ ! -d {{.ExampleApp}} ] ; then git clone https://github.com/deis/{{.ExampleApp}}.git ; fi"
1918
gitRemoveCmd = "git remote remove deis"
@@ -39,6 +38,11 @@ func clientTest(t *testing.T, params *utils.DeisTestConfig) {
3938
if err != nil {
4039
t.Fatal(err)
4140
}
41+
profile := os.Getenv("DEIS_PROFILE")
42+
if profile == "" {
43+
profile = "client"
44+
}
45+
clientJsonFilePath := ".deis/" + profile + ".json"
4246
data, err := ioutil.ReadFile(path.Join(user.HomeDir, clientJsonFilePath))
4347
if err != nil {
4448
t.Fatal(err)

0 commit comments

Comments
 (0)