-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example
tester
service to show API Integration Testing of a Goa…
… System (#331) * initial commit * Empty-Commit * add readme file (still need to fill out) * tester readme update * Trying out a workflow to run integration tests against local binaries * Add proto install to /example/weather/scripts/setup * fix integration.yaml * disable mono on ubuntu * move mono stop * Try to find out what's running on 8084 * Trying to disable mono? * trying to stop mono 2 * add a sleep after stop/disable? * add some echo * see if stop/disable mono fails * add back in || true, change front ports to see if this even works at all * oops forgot to change int test port * try no send to dev null? * sleep before testing * take out netstat * sleep longer? give time for docker to do work to get grafana? * remove dev>null again... :\ * sleep 60 :( * Implement review comment changes * Fix runTests check for filtering if * Empty-Commit * try starting each service individually, check fo rmono * just KILL mono? * back to 8084, check all ports * fix typo * add flag to turn off grafana for services (for CI testing) * clean up integration.yaml script * review fixes * Get Stack Trace to Err Log on Panic * small fixes for style * protoc -> 25.1, better wait in integration.yaml * Add synchronous testing feature * Make one of the synchronous as an example * move func maps to service definition
- Loading branch information
1 parent
0097ea4
commit 15fc752
Showing
93 changed files
with
6,287 additions
and
392 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: Integration Tests | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
types: [opened, reopened, synchronize] | ||
|
||
jobs: | ||
integration-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.21" | ||
- name: tests | ||
run: | | ||
check_service_health() { | ||
local health_url="$1" | ||
local start_time=$(date +%s) | ||
while : ; do | ||
if curl -s --fail "$health_url" > /dev/null; then | ||
echo "Service is up!" | ||
return 0 | ||
fi | ||
local current_time=$(date +%s) | ||
if (( current_time - start_time >= 5 )); then | ||
echo "Timed out waiting for service to be up." | ||
return 1 | ||
fi | ||
sleep 0.2 | ||
done | ||
} | ||
echo "stop/disable/kill mono" | ||
sudo systemctl stop mono-xsp4.service || true | ||
sudo systemctl disable mono-xsp4.service || true | ||
sudo pkill mono || true | ||
echo "change to weather example directory" | ||
cd example/weather | ||
echo "run setup script" | ||
./scripts/setup | ||
echo "run server" | ||
./bin/forecaster -monitoring-enabled=false & | ||
./bin/locator -monitoring-enabled=false & | ||
./bin/tester -monitoring-enabled=false & | ||
./bin/front -monitoring-enabled=false & | ||
check_service_health "http://localhost:8081/healthz" & | ||
check_service_health "http://localhost:8083/healthz" & | ||
check_service_health "http://localhost:8091/healthz" & | ||
check_service_health "http://localhost:8085/healthz" & | ||
wait -n | ||
echo "-----RUN TESTS-----" | ||
results=$(curl -X POST http://localhost:8084/tester/smoke) | ||
echo "-----RESULTS-----" | ||
echo $results | ||
echo "----------" | ||
if [ $(echo $results | jq '.fail_count') -gt 0 ]; | ||
then | ||
echo "Test errors found." | ||
exit 1 | ||
else | ||
echo "Tests passed." | ||
exit 0 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
forecaster: bin/forecaster | ||
locator: bin/locator | ||
front: bin/front | ||
tester: bin/tester |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.