diff --git a/Dockerfile b/Dockerfile index d086121..d3f5b6f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,8 +10,8 @@ ARG HOMEDIR="/opt/akamai-uls" ARG ULS_DIR="$HOMEDIR/uls" ARG EXT_DIR="$ULS_DIR/ext" -ARG ETP_CLI_VERSION="0.4.4" -ARG EAA_CLI_VERSION="0.6.2" +ARG ETP_CLI_VERSION="0.4.5" +ARG EAA_CLI_VERSION="0.6.3" ARG MFA_CLI_VERSION="0.1.1" ARG GC_CLI_VERSION="v0.0.2(beta)" ARG LINODE_CLI_VERSION="dev" diff --git a/bin/config/global_config.py b/bin/config/global_config.py index 06c6535..2ef22bb 100644 --- a/bin/config/global_config.py +++ b/bin/config/global_config.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # Common global variables / constants -__version__ = "1.7.0" +__version__ = "1.7.1" __tool_name_long__ = "Akamai Unified Log Streamer" __tool_name_short__ = "ULS" diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index a2bcbbb..f28862c 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,4 +1,17 @@ # Version History +## v1.7.1 +||| +|---|---| +|Date|2023-10-11 +|Kind| BUGFIX release +|Author|mschiess@akamai.com, +- **BUGFIX** + - Fixed a bug in the ETP & EAA CLI that prevented ULS to run properly in docker environment + - [docker] bumped CLI-EAA to "0.6.3" + - [docker] bumped CLI-ETP version to "0.4.5" +- **Housekeeping** + - Added additional automated testing to the docker release process + ## v1.7.0 ||| |---|---| diff --git a/docs/examples/kubernetes/helm/akamai-uls/Chart.yaml b/docs/examples/kubernetes/helm/akamai-uls/Chart.yaml index 0447870..00334d2 100644 --- a/docs/examples/kubernetes/helm/akamai-uls/Chart.yaml +++ b/docs/examples/kubernetes/helm/akamai-uls/Chart.yaml @@ -4,4 +4,4 @@ description: Akamai Universal Log Streamer Helm installation type: application version: 2.0.0 -appVersion: "1.7.0" +appVersion: "1.7.1" diff --git a/test/docker_test.bats b/test/docker_test.bats new file mode 100644 index 0000000..f4858f5 --- /dev/null +++ b/test/docker_test.bats @@ -0,0 +1,103 @@ +#!/usr/bin/env bats + +## THIS Should be run from ULS ROOT DIR + +# Variables + # ULS Binary +uls_bin=bin/uls.py + + # Should we using a mocked edgerc (TRUE/FALSE) ? +mocked_edgerc=FALSE + +# TIMEOUT + # How much time is timeout alklowed to run + uls_test_timeout=10 + # Send a kill signal after + uls_kill_timeout=15 + # Used for regular timeout + uls_timeout_signal="TERM" + uls_timeout_params=" --preserve-status --kill-after $uls_kill_timeout --signal ${uls_timeout_signal} ${uls_test_timeout} " + +### Switch between mocked and real edgerc +if [ "$mocked_edgerc"=="FALSE" ] ; then + # REAL EDGERC FILE + uls_edgerc=~/.edgerc + uls_section=akamaidemo + + + # Variables + eaa_access_assert="username" + eaa_devinv_assert="client_version" + etp_assert="configId" + gc_assert="flow_id" + linode_assert="" + jmespath_assert="['" +else + # TESTING EDGERC FILE & section + uls_edgerc=test/_mocked_edgerc + uls_section=testing + # Variables + eaa_access_assert="" + eaa_devinv_assert="" + etp_assert="" + gc_assert="" + linode_assert="" + jmespath_assert="" +fi + + +# Load support libs +load 'bats/bats-support/load.bash' +load 'bats/bats-assert/load.bash' + +# DOCKER TESTING + +## Make sure everything is tidy and clean after every test ;) +teardown () { + docker stop uls-bats-test && docker rm uls-bats-test + return 0 +} + +## CREATE a local DOCKER IMAGE +@test "DOCKER IMAGE BUILD" { + run docker build -t uls:bats . + [ "$status" -eq 0 ] +} + +## RUN AN EAA TEST +@test "DOCKER EAA TEST" { + run timeout ${uls_timeout_params} docker run --rm --name "uls-bats-test" --mount type=bind,source="${uls_edgerc}",target="/opt/akamai-uls/.edgerc",readonly uls:bats --section ${uls_section} --input eaa --feed access --output raw --loglevel info + assert_line --partial "UlsInputCli - started PID" + refute_line --partial "was found stale -" + #[ "$status" -eq 0 ] +} + +## RUN AN ETP TEST +@test "DOCKER ETP TEST" { + run timeout ${uls_timeout_params} docker run --rm --name "uls-bats-test" --mount type=bind,source="${uls_edgerc}",target="/opt/akamai-uls/.edgerc",readonly uls:bats --section ${uls_section} --input etp --feed threat --output raw --loglevel info + assert_line --partial "UlsInputCli - started PID" + refute_line --partial "was found stale -" + #[ "$status" -eq 0 ] +} + +## RUN AN MFA TEST +@test "DOCKER MFA TEST" { + run timeout ${uls_timeout_params} docker run --rm --name "uls-bats-test" --mount type=bind,source="${uls_edgerc}",target="/opt/akamai-uls/.edgerc",readonly uls:bats --section ${uls_section} --input mfa --feed event --output raw --loglevel info + assert_line --partial "UlsInputCli - started PID" + refute_line --partial "was found stale -" + #[ "$status" -eq 0 ] +} + +## RUN AN GC TEST +@test "DOCKER GC TEST" { + run timeout ${uls_timeout_params} docker run --rm --name "uls-bats-test" --mount type=bind,source="${uls_edgerc}",target="/opt/akamai-uls/.edgerc",readonly uls:bats --section ${uls_section} --input gc --feed netlog --output raw --loglevel info + assert_line --partial "UlsInputCli - started PID" + refute_line --partial "was found stale -" + #[ "$status" -eq 0 ] +} + +## REMOVE the local DOCKER IMAGE +@test "DOCKER IMAGE BUILD" { + docker image rm uls:bats + [ "$status" -eq 0 ] +} \ No newline at end of file diff --git a/test/test.sh b/test/test.sh index 9624dee..867e45f 100644 --- a/test/test.sh +++ b/test/test.sh @@ -1,6 +1,6 @@ #!/bin/bash # test.sh [file - $tests_available] [regex merge] -tests_available="basic positive negative " +tests_available="basic positive negative docker " parallel_tests=20 @@ -8,7 +8,7 @@ parallel_tests=20 function do_test() { if [ -f "test/$1_test.bats" ] ; then echo -e "$1 TESTING\n" - if [ ${parallel_tests} -gt 1 ] ; then + if [ ${parallel_tests} -gt 1 ] && [ ${1} != "docker" ]; then bats --jobs ${parallel_tests} test/$1_test.bats $filter else bats test/$1_test.bats $filter