Skip to content

Commit fdacf43

Browse files
authored
Merge pull request #871 from StackStorm/use_st2docker_master
Use st2-docker master docker compose setup for end to end tests
2 parents 26f5b57 + 752b0c3 commit fdacf43

File tree

4 files changed

+28
-36
lines changed

4 files changed

+28
-36
lines changed

.circleci/config.yml

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ jobs:
1212
DEPLOY_PACKAGES: 1
1313
DEB: xenial bionic
1414
RPM: el7 el8
15+
ST2_VERSION: "3.5dev"
1516
ST2_HOST: localhost
16-
ST2_USERNAME: admin
17-
ST2_PASSWORD: 123
17+
ST2_PROTOCOL: http
18+
ST2_USERNAME: st2admin
19+
ST2_PASSWORD: Ch@ngeMe
1820
ST2_TEST_ENVIRONMENT: https://github.com/StackStorm/st2-docker
1921
steps:
2022
- checkout
@@ -73,49 +75,37 @@ jobs:
7375
- run:
7476
name: Clone test containers
7577
command: |
76-
# Use DEPRECATED/all-in-one for now, we'll have to circle back around
77-
# and fix this to use the master branch
78-
echo "Cloning ${ST2_DOCKER_BRANCH:-DEPRECATED/all-in-one} branch of st2-docker"
79-
git clone --branch ${ST2_DOCKER_BRANCH:-DEPRECATED/all-in-one} --depth 1 ${ST2_TEST_ENVIRONMENT} ~/st2-docker
78+
echo "Cloning ${ST2_DOCKER_BRANCH:-master} branch of st2-docker"
79+
git clone --branch ${ST2_DOCKER_BRANCH:-master} --depth 1 ${ST2_TEST_ENVIRONMENT} ~/st2-docker
8080
- run:
81-
name: Update env variables for test containers
81+
name: Configufe docker compose config
8282
command: |
83-
make -C ~/st2-docker env
84-
echo -e "ST2_USER=${ST2_USERNAME}\nST2_PASSWORD=${ST2_PASSWORD}" > ~/st2-docker/conf/stackstorm.env
85-
cat ~/st2-docker/conf/stackstorm.env
83+
# Configure allow origin in the user config
84+
echo "[api]" > ~/st2-docker/files/st2.user.conf
85+
echo "allow_origin = *" >> ~/st2-docker/files/st2.user.conf
8686
- run:
8787
name: Start test containers
88-
environment:
89-
ST2_IMAGE_TAG: "latest"
9088
command: |
9189
docker-compose -f ~/st2-docker/docker-compose.yml up -d
92-
sleep 60
93-
docker-compose -f ~/st2-docker/docker-compose.yml exec stackstorm crudini --set /etc/st2/st2.conf api allow_origin "*"
94-
docker-compose -f ~/st2-docker/docker-compose.yml exec stackstorm st2ctl restart
90+
sleep 100
9591
- run:
9692
name: Check test containers
9793
command: |
98-
docker-compose -f ~/st2-docker/docker-compose.yml exec stackstorm st2 run core.noop
94+
docker-compose -f ~/st2-docker/docker-compose.yml exec st2client st2 run core.noop
9995
- run:
10096
name: Run functional tests
10197
command: npm run test-functional
10298
- run:
10399
name: Reset test containers
104-
environment:
105-
ST2_IMAGE_TAG: "latest"
106100
command: |
107-
docker-compose -f ~/st2-docker/docker-compose.yml down
101+
docker-compose -f ~/st2-docker/docker-compose.yml down --rmi
108102
docker-compose -f ~/st2-docker/docker-compose.yml up -d
109-
sleep 60
110-
docker-compose -f ~/st2-docker/docker-compose.yml exec stackstorm crudini --set /etc/st2/st2.conf api allow_origin "*"
111-
docker-compose -f ~/st2-docker/docker-compose.yml exec stackstorm st2ctl restart
103+
sleep 100
112104
- run:
113105
name: Recheck test containers
114-
environment:
115-
ST2_IMAGE_TAG: "latest"
116106
command: |
117-
docker-compose -f ~/st2-docker/docker-compose.yml exec stackstorm st2 run core.noop
118-
docker-compose -f ~/st2-docker/docker-compose.yml exec stackstorm st2 execution list
107+
docker-compose -f ~/st2-docker/docker-compose.yml exec st2client st2 run core.noop
108+
docker-compose -f ~/st2-docker/docker-compose.yml exec st2client st2 execution list
119109
- run:
120110
name: Run tests on production version
121111
command: npm run test-production

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ We're using [zombie](https://github.com/assaf/zombie) as our headless browser fo
123123

124124
First of all, you need to make sure you have a running copy of st2 to run tests against. We're using [official docker images](https://github.com/stackstorm/st2-docker) for our automated tests, but the [AIO](https://docs.stackstorm.com/install/index.html) deployment will work just as good (though will take more time to deploy).
125125

126-
To let test runner know the details of your st2 installation, you need to set ST2_HOST, ST2_USERNAME and ST2_PASSWORD env variables, then call `gulp test`.
126+
To let test runner know the details of your st2 installation, you need to set ST2_PROTOCOL, ST2_HOST, ST2_USERNAME and ST2_PASSWORD env variables, then call `gulp test`.
127127

128-
$ ST2_HOST=localhost ST2_USERNAME=admin ST2_PASSWORD=123 gulp test
128+
$ ST2_PROTOCOL=http ST2_HOST=localhost ST2_USERNAME=admin ST2_PASSWORD=123 gulp test
129129

130130
Copyright, License, and Contributors Agreement
131131
----------------------------------------------

tests/test-history.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ describe('User visits history page', function () {
8080
let resource;
8181

8282
before(() => {
83-
resource = browser.resources.filter((e) => new RegExp('^https://example.com/api/v1/executions/\\w+$').test(e.url));
83+
resource = browser.resources.filter((e) => new RegExp('^https://example.com/api/v1/executions/\\w+\\?max_result_size=102400$').test(e.url));
8484
});
8585

8686
it('should make a call to execution endpoint once', () => {

tests/util.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,20 @@ module.exports = function (browser) {
5959
return new zombie.Response(`angular.module('main').constant('st2Config', {
6060
hosts: [{
6161
name: 'Test',
62-
url: 'https://${process.env.ST2_HOST}/api',
63-
auth: 'https://${process.env.ST2_HOST}/auth',
62+
url: '${process.env.ST2_PROTOCOL}://${process.env.ST2_HOST}/api',
63+
auth: '${process.env.ST2_PROTOCOL}://${process.env.ST2_HOST}/auth',
6464
}],
65-
});`);
65+
});`);
6666
}
6767

6868
if (url.path().indexOf('/reamaze.js') >= 0) {
6969
return new zombie.Response('');
7070
}
7171

7272
if (url.host() === process.env.ST2_HOST) {
73-
response._url = url.host('example.com').toString();
73+
// All the tests expect https:// so we just hack that and replace http with https in case
74+
// https is not used
75+
response._url = url.host('example.com').toString().replace("http://", "https://");
7476
request.url = response.url;
7577
}
7678

@@ -103,11 +105,11 @@ module.exports = function (browser) {
103105
const api = new API();
104106

105107
client = api.connect({
106-
url: `https://${process.env.ST2_HOST}/api`,
107-
auth: `https://${process.env.ST2_HOST}/auth`,
108+
url: `${process.env.ST2_PROTOCOL}://${process.env.ST2_HOST}/api`,
109+
auth: `${process.env.ST2_PROTOCOL}://${process.env.ST2_HOST}/auth`,
108110
}, process.env.ST2_USERNAME, process.env.ST2_PASSWORD)
109111
.then(() => api);
110-
}
112+
}
111113

112114
return client;
113115
},

0 commit comments

Comments
 (0)