Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 16 additions & 26 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ jobs:
DEPLOY_PACKAGES: 1
DEB: xenial bionic
RPM: el7 el8
ST2_VERSION: "3.5dev"
ST2_HOST: localhost
ST2_USERNAME: admin
ST2_PASSWORD: 123
ST2_PROTOCOL: http
ST2_USERNAME: st2admin
ST2_PASSWORD: Ch@ngeMe
ST2_TEST_ENVIRONMENT: https://github.com/StackStorm/st2-docker
steps:
- checkout
Expand Down Expand Up @@ -73,49 +75,37 @@ jobs:
- run:
name: Clone test containers
command: |
# Use DEPRECATED/all-in-one for now, we'll have to circle back around
# and fix this to use the master branch
echo "Cloning ${ST2_DOCKER_BRANCH:-DEPRECATED/all-in-one} branch of st2-docker"
git clone --branch ${ST2_DOCKER_BRANCH:-DEPRECATED/all-in-one} --depth 1 ${ST2_TEST_ENVIRONMENT} ~/st2-docker
echo "Cloning ${ST2_DOCKER_BRANCH:-master} branch of st2-docker"
git clone --branch ${ST2_DOCKER_BRANCH:-master} --depth 1 ${ST2_TEST_ENVIRONMENT} ~/st2-docker
- run:
name: Update env variables for test containers
name: Configufe docker compose config
command: |
make -C ~/st2-docker env
echo -e "ST2_USER=${ST2_USERNAME}\nST2_PASSWORD=${ST2_PASSWORD}" > ~/st2-docker/conf/stackstorm.env
cat ~/st2-docker/conf/stackstorm.env
# Configure allow origin in the user config
echo "[api]" > ~/st2-docker/files/st2.user.conf
echo "allow_origin = *" >> ~/st2-docker/files/st2.user.conf
- run:
name: Start test containers
environment:
ST2_IMAGE_TAG: "latest"
command: |
docker-compose -f ~/st2-docker/docker-compose.yml up -d
sleep 60
docker-compose -f ~/st2-docker/docker-compose.yml exec stackstorm crudini --set /etc/st2/st2.conf api allow_origin "*"
docker-compose -f ~/st2-docker/docker-compose.yml exec stackstorm st2ctl restart
sleep 100
- run:
name: Check test containers
command: |
docker-compose -f ~/st2-docker/docker-compose.yml exec stackstorm st2 run core.noop
docker-compose -f ~/st2-docker/docker-compose.yml exec st2client st2 run core.noop
- run:
name: Run functional tests
command: npm run test-functional
- run:
name: Reset test containers
environment:
ST2_IMAGE_TAG: "latest"
command: |
docker-compose -f ~/st2-docker/docker-compose.yml down
docker-compose -f ~/st2-docker/docker-compose.yml down --rmi
docker-compose -f ~/st2-docker/docker-compose.yml up -d
sleep 60
docker-compose -f ~/st2-docker/docker-compose.yml exec stackstorm crudini --set /etc/st2/st2.conf api allow_origin "*"
docker-compose -f ~/st2-docker/docker-compose.yml exec stackstorm st2ctl restart
sleep 100
- run:
name: Recheck test containers
environment:
ST2_IMAGE_TAG: "latest"
command: |
docker-compose -f ~/st2-docker/docker-compose.yml exec stackstorm st2 run core.noop
docker-compose -f ~/st2-docker/docker-compose.yml exec stackstorm st2 execution list
docker-compose -f ~/st2-docker/docker-compose.yml exec st2client st2 run core.noop
docker-compose -f ~/st2-docker/docker-compose.yml exec st2client st2 execution list
- run:
name: Run tests on production version
command: npm run test-production
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ We're using [zombie](https://github.com/assaf/zombie) as our headless browser fo

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).

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`.
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`.

$ ST2_HOST=localhost ST2_USERNAME=admin ST2_PASSWORD=123 gulp test
$ ST2_PROTOCOL=http ST2_HOST=localhost ST2_USERNAME=admin ST2_PASSWORD=123 gulp test

Copyright, License, and Contributors Agreement
----------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion tests/test-history.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe('User visits history page', function () {
let resource;

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

it('should make a call to execution endpoint once', () => {
Expand Down
16 changes: 9 additions & 7 deletions tests/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,20 @@ module.exports = function (browser) {
return new zombie.Response(`angular.module('main').constant('st2Config', {
hosts: [{
name: 'Test',
url: 'https://${process.env.ST2_HOST}/api',
auth: 'https://${process.env.ST2_HOST}/auth',
url: '${process.env.ST2_PROTOCOL}://${process.env.ST2_HOST}/api',
auth: '${process.env.ST2_PROTOCOL}://${process.env.ST2_HOST}/auth',
}],
});`);
});`);
}

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

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

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

client = api.connect({
url: `https://${process.env.ST2_HOST}/api`,
auth: `https://${process.env.ST2_HOST}/auth`,
url: `${process.env.ST2_PROTOCOL}://${process.env.ST2_HOST}/api`,
auth: `${process.env.ST2_PROTOCOL}://${process.env.ST2_HOST}/auth`,
}, process.env.ST2_USERNAME, process.env.ST2_PASSWORD)
.then(() => api);
}
}

return client;
},
Expand Down