Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change BATS image #259

Merged
merged 21 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from 20 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
35 changes: 16 additions & 19 deletions tests/st2tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,29 @@ services:
environment:
ST2_AUTH_URL: ${ST2_AUTH_URL:-http://st2auth:9100/}
ST2_API_URL: ${ST2_API_URL:-http://st2api:9101/}
ST2_STREAM_URL: ${ST2_STREAM_URL:-http://st2stream:9102/}
ST2_STREAM_URL: ${ST2_STREAM_URL:-http://st2stream:9102/}-
Ein-nor marked this conversation as resolved.
Show resolved Hide resolved
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