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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 2023-10-28
* Refactor st2test, install BATS via `apt install`
* Remove unneeded file st2test-tools.sh
* Fix ST2_AUTH_URL and ST2_STREAM_URL

## 2022-05-06
* Migrate to Ubuntu 20 / Python 3.8 based containers

Expand Down
5 changes: 0 additions & 5 deletions tests/st2tests-tools.sh

This file was deleted.

14 changes: 7 additions & 7 deletions tests/st2tests.sh → tests/st2tests.bat
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#!/usr/bin/env bats
# bats smoke-tests

load "${BATS_HELPERS_DIR}/bats-support/load.bash"
load "${BATS_HELPERS_DIR}/bats-assert/load.bash"
load "${BATS_HELPERS_DIR}/bats-file/load.bash"
load "/tools/bats-support/load.bash"
load "/tools/bats-assert/load.bash"
load "/tools/bats-file/load.bash"

@test 'st2 version deployed and python env are as expected' {
run st2 --version
assert_success
# st2 3.7.0, on Python 3.8.10
# st2 3.8.0, on Python 3.8.10
assert_line --partial "st2 ${ST2_VERSION}"
assert_line --partial 'on Python 3.8.10'
}

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

@test 'ST2_STREAM_URL service endpoint is accessible and working' {
run curl -v ${ST2_API_URL}
run curl -v ${ST2_STREAM_URL}
assert_line --partial 'Content-Type: application/json'
assert_line --partial 'St2-Api-Key'
}
Expand Down
33 changes: 15 additions & 18 deletions tests/st2tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,27 @@ services:
ST2_API_URL: ${ST2_API_URL:-http://st2api:9101/}
ST2_STREAM_URL: ${ST2_STREAM_URL:-http://st2stream:9102/}
ST2WEB_HTTPS: ${ST2WEB_HTTPS:-0}
BATS_HELPERS_DIR: /tools/bats-helpers/
ST2_AUTH_USERNAME: ${ST2_AUTH_USERNAME:-st2admin}
ST2_AUTH_PASSWORD: ${ST2_AUTH_PASSWORD:-Ch@ngeMe}
command: bash -c "ln -s /tools/bats/libexec/bats /sbin/bats && /st2tests.sh"
command:
- bash
- -ec
- |
apt update > /dev/null 2>&1
apt install bats -y > /dev/null 2>&1
mkdir /tools
git clone --config advice.detachedHead=false --depth 1 --branch v0.3.0 \
https://github.com/ztombol/bats-assert /tools/bats-assert > /dev/null 2>&1
git clone --config advice.detachedHead=false --depth 1 --branch v0.2.0 \
https://github.com/ztombol/bats-file /tools/bats-file > /dev/null 2>&1
git clone --config advice.detachedHead=false --depth 1 --branch v0.3.0 \
https://github.com/ztombol/bats-support /tools/bats-support > /dev/null 2>&1
bats /opt/stackstorm/st2tests.bat
volumes:
- ./st2tests.sh:/st2tests.sh:ro
- tools:/tools
- ./st2tests.bat:/opt/stackstorm/st2tests.bat:ro
networks:
- st2-docker_private
stop_signal: SIGKILL
depends_on:
- st2test-tools
st2test-tools:
image: dduportal/bats:latest
environment:
BATS_HELPERS_DIR: /tools/bats-helpers/
BATS_DIR: /tools/bats/
command: /st2tests.sh
volumes:
- tools:/tools
- ./st2tests-tools.sh:/st2tests.sh:ro

volumes:
tools:

networks:
st2-docker_private:
Expand Down