test: Add 1 and update 10 files
All checks were successful
Build-Test-Publish / build (linux/amd64) (push) Successful in 1m26s
Build-Test-Publish / build (linux/arm64) (push) Successful in 2m14s
Build-Test-Publish / create-manifest (push) Successful in 13s

This commit is contained in:
Your Name
2025-08-10 22:33:56 +12:00
parent 8ab6028597
commit 623879f67a
11 changed files with 140 additions and 108 deletions

View File

@@ -80,7 +80,7 @@ ${SCRIPT_DIR}/../build.sh
# Use static test configuration with known tokens for Docker testing
title "Setting up test configuration"
# Use the static Docker config with known hashes
cp ${SCRIPT_DIR}/sos_config_docker.json ${SCRIPT_DIR}/sos_config.json
cp "${SCRIPT_DIR}/sos_config_docker.json" "${SCRIPT_DIR}/sos_config.json"
# Export the known plaintext tokens that correspond to the hashes in sos_config_docker.json
export TEST_TOKEN1="t570H7DmK2VBfCwUmtFaUXyzVklL90E1"
@@ -92,7 +92,9 @@ echo "Using static test configuration with known tokens"
#------------------------------------------------------------------------------------------------
# run the docker container
title "Running docker container"
export LOCALCONFIG="${SCRIPT_DIR}/sos_config.json"
# Config file is always in SCRIPT_DIR after the copy above
LOCALCONFIG="${SCRIPT_DIR}/sos_config.json"
[ -f "${LOCALCONFIG}" ] || die "Config file not found: ${LOCALCONFIG}"
[ -f "${COMPOSE_FILE}" ] || die "Compose file not found: ${COMPOSE_FILE}"
@@ -107,13 +109,16 @@ cd "${SCRIPT_DIR}"
docker stop sos-test 2>/dev/null || true
docker rm -v sos-test 2>/dev/null || true
# Start the container and mark that cleanup is needed
LOCALCONFIG=${LOCALCONFIG} docker compose \
-f "${COMPOSE_FILE}" up -d
# Start the container (without config volume mount)
docker compose -f "${COMPOSE_FILE}" up -d
# Mark that we need cleanup from this point on
CLEANUP_NEEDED=true
# Copy the config file into the running container
echo "Copying config file into container..."
docker cp "${LOCALCONFIG}" sos-test:/testing/sos_config.json
# wait until healthy.
if ! wait_for_container "sos-test"; then
echo "----------------------------------------"
@@ -123,9 +128,12 @@ if ! wait_for_container "sos-test"; then
die "Container sos-test is not healthy"
fi
# run the tests. Docker inside docker support!
docker exec -i sos-test ls /testing || true
# Pass the plaintext tokens as environment variables to the test script
# Verify the config and test files are accessible
echo "Verifying test environment..."
docker exec sos-test ls -la /testing/ || die "Cannot access /testing directory in container"
# Run the tests inside the container
echo "Running tests inside container..."
docker exec -i \
-e TEST_TOKEN1="${TEST_TOKEN1:-}" \
-e TEST_TOKEN2="${TEST_TOKEN2:-}" \