Skip to content

Commit 4407c26

Browse files
authored
Merge pull request #259 from ZoeLeah/master
Change BATS image
2 parents ce61c8f + 886cacb commit 4407c26

File tree

4 files changed

+27
-30
lines changed

4 files changed

+27
-30
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 2023-10-28
4+
* Refactor st2test, install BATS via `apt install`
5+
* Remove unneeded file st2test-tools.sh
6+
* Fix ST2_AUTH_URL and ST2_STREAM_URL
7+
38
## 2022-05-06
49
* Migrate to Ubuntu 20 / Python 3.8 based containers
510

tests/st2tests-tools.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

tests/st2tests.sh renamed to tests/st2tests.bat

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
#!/usr/bin/env bats
1+
# bats smoke-tests
22

3-
load "${BATS_HELPERS_DIR}/bats-support/load.bash"
4-
load "${BATS_HELPERS_DIR}/bats-assert/load.bash"
5-
load "${BATS_HELPERS_DIR}/bats-file/load.bash"
3+
load "/tools/bats-support/load.bash"
4+
load "/tools/bats-assert/load.bash"
5+
load "/tools/bats-file/load.bash"
66

77
@test 'st2 version deployed and python env are as expected' {
88
run st2 --version
99
assert_success
10-
# st2 3.7.0, on Python 3.8.10
10+
# st2 3.8.0, on Python 3.8.10
1111
assert_line --partial "st2 ${ST2_VERSION}"
1212
assert_line --partial 'on Python 3.8.10'
1313
}
1414

1515
@test 'ST2_AUTH_URL service endpoint is accessible and working' {
16-
run curl -v ${ST2_API_URL}
16+
run curl -v ${ST2_AUTH_URL}
1717
assert_line --partial 'Content-Type: application/json'
1818
assert_line --partial 'St2-Api-Key'
1919
}
@@ -25,7 +25,7 @@ load "${BATS_HELPERS_DIR}/bats-file/load.bash"
2525
}
2626

2727
@test 'ST2_STREAM_URL service endpoint is accessible and working' {
28-
run curl -v ${ST2_API_URL}
28+
run curl -v ${ST2_STREAM_URL}
2929
assert_line --partial 'Content-Type: application/json'
3030
assert_line --partial 'St2-Api-Key'
3131
}

tests/st2tests.yaml

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,27 @@ services:
88
ST2_API_URL: ${ST2_API_URL:-http://st2api:9101/}
99
ST2_STREAM_URL: ${ST2_STREAM_URL:-http://st2stream:9102/}
1010
ST2WEB_HTTPS: ${ST2WEB_HTTPS:-0}
11-
BATS_HELPERS_DIR: /tools/bats-helpers/
1211
ST2_AUTH_USERNAME: ${ST2_AUTH_USERNAME:-st2admin}
1312
ST2_AUTH_PASSWORD: ${ST2_AUTH_PASSWORD:-Ch@ngeMe}
14-
command: bash -c "ln -s /tools/bats/libexec/bats /sbin/bats && /st2tests.sh"
13+
command:
14+
- bash
15+
- -ec
16+
- |
17+
apt update > /dev/null 2>&1
18+
apt install bats -y > /dev/null 2>&1
19+
mkdir /tools
20+
git clone --config advice.detachedHead=false --depth 1 --branch v0.3.0 \
21+
https://github.com/ztombol/bats-assert /tools/bats-assert > /dev/null 2>&1
22+
git clone --config advice.detachedHead=false --depth 1 --branch v0.2.0 \
23+
https://github.com/ztombol/bats-file /tools/bats-file > /dev/null 2>&1
24+
git clone --config advice.detachedHead=false --depth 1 --branch v0.3.0 \
25+
https://github.com/ztombol/bats-support /tools/bats-support > /dev/null 2>&1
26+
bats /opt/stackstorm/st2tests.bat
1527
volumes:
16-
- ./st2tests.sh:/st2tests.sh:ro
17-
- tools:/tools
28+
- ./st2tests.bat:/opt/stackstorm/st2tests.bat:ro
1829
networks:
1930
- st2-docker_private
2031
stop_signal: SIGKILL
21-
depends_on:
22-
- st2test-tools
23-
st2test-tools:
24-
image: dduportal/bats:latest
25-
environment:
26-
BATS_HELPERS_DIR: /tools/bats-helpers/
27-
BATS_DIR: /tools/bats/
28-
command: /st2tests.sh
29-
volumes:
30-
- tools:/tools
31-
- ./st2tests-tools.sh:/st2tests.sh:ro
32-
33-
volumes:
34-
tools:
3532

3633
networks:
3734
st2-docker_private:

0 commit comments

Comments
 (0)