diff --git a/.github/scripts/connectivity-test.sh b/.github/scripts/connectivity-test.sh new file mode 100755 index 000000000..66657ec67 --- /dev/null +++ b/.github/scripts/connectivity-test.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +# Randomly drop db connections to test CLI connectivity for 15 minutes total +start_time=$(date +%s) +postgresql_container_id=$(docker ps --filter "name=platform-opentdfdb-1" -q) + +resource_subcommands=("attributes" "attributes namespaces" "subject-mappings" "resource-mappings" "kas-registry") + +while true; do + # Randomly wait before running the connectivity test (between 1 and 10 seconds) + sleep $((RANDOM % 10 + 1)) + + echo "Restarting PostgreSQL container..." + docker restart $postgresql_container_id + + # Determine how many random otdfctl commands to run after the restart + num_runs=$((RANDOM % 5 + 1)) # Randomly choose to run between 1 and 5 times + + for ((i=0; i + go build -o opentdf -v service/main.go + && .github/scripts/watch.sh opentdf.yaml ./opentdf start + wait-on: | + tcp:localhost:8080 + log-output-if: true + wait-for: 90s + working-directory: platform + + ######## CHECKOUT/BUILD 'otdfctl' ############# + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 + with: + repository: opentdf/otdfctl + ref: main + fetch-depth: 0 + path: otdfctl + - run: go build -o otdfctl + working-directory: otdfctl + - run: cp otdfctl ../platform + working-directory: otdfctl + + ######## RUN TESTS ############# + - run: ./.github/scripts/connectivity-test.sh + name: Flaky Connectivity Test + working-directory: platform + ci-checks: + uses: opentdf/platform/.github/workflows/checks.yaml@main