6262 TARGET_COMPONENT_NAME="maestro"
6363 REPO_URL=$(echo $SNAPSHOT | jq -r '.components[] | select(.name == "maestro").source.git.url')
6464 REPO_COMMIT=$(echo $SNAPSHOT | jq -r '.components[] | select(.name == "maestro").source.git.revision')
65- test_output_file=${PWD}/test_output.json
65+ mqtt_test_output_file=${PWD}/mqtt_test_output.json
66+ pubsub_test_output_file=${PWD}/pubsub_test_output.json
67+ grpc_test_output_file=${PWD}/grpc_test_output.json
6668
6769 # Log Vars for Tracibility
6870 echo "REPO_URL: $REPO_URL"
@@ -84,16 +86,38 @@ spec:
8486 # Generate mqtt config file
8587 echo '{"brokerHost":"localhost:1883","username":"","password":"","topics":{"sourceEvents":"sources/maestro/consumers/+/sourceevents","agentEvents":"sources/maestro/consumers/+/agentevents"}}' > secrets/mqtt.config
8688
89+ # Generate pubsub config file
90+ echo '{"projectID":"maestro-test","endpoint":"localhost:8085","insecure":true,"topics":{"sourceEvents":"projects/maestro-test/topics/sourceevents","sourceBroadcast":"projects/maestro-test/topics/sourcebroadcast"},"subscriptions":{"agentEvents":"projects/maestro-test/subscriptions/agentevents-maestro","agentBroadcast":"projects/maestro-test/subscriptions/agentbroadcast-maestro"}}' > secrets/pubsub.config
91+
8792 # Generate db.password
8893 echo 'foobar-bizz-buzz' > secrets/db.password
8994
95+ # Wait for the pubsub emulator to be ready
96+ echo "[INFO] Waiting for pubsub emulator to be ready for connection"
97+ timeout 5m bash -c 'until curl -s http://localhost:8085 > /dev/null 2>&1; do sleep 2s; done'
98+
99+ # Initialize pubsub topics and subscriptions
100+ export PUBSUB_EMULATOR_HOST=localhost:8085
101+ export PUBSUB_PROJECT_ID=maestro-test
102+ bash hack/init-pubsub-emulator.sh
103+
90104 # Run integration tests with JSON output
91- make test-integration integration_test_json_output="$test_output_file"
105+ make test-integration \
106+ mqtt_integration_test_json_output="$mqtt_test_output_file" \
107+ pubsub_integration_test_json_output="$pubsub_test_output_file" \
108+ grpc_integration_test_json_output="$grpc_test_output_file"
92109
93110 # Read, process, and write output in accepted format
94111 # Formatting docs: https://redhat-appstudio.github.io/book/ADR/0030-tekton-results-naming-convention.html#test_output-schema-validation
95- FAILURES=$(cat $test_output_file | jq 'select(.Action == "fail")' | jq -r --slurp 'length')
96- SUCCESSES=$(cat $test_output_file | jq 'select(.Action == "pass")' | jq -r --slurp 'length')
112+ # Combine results from all three broker tests
113+ MQTT_FAILURES=$(cat $mqtt_test_output_file | jq 'select(.Action == "fail")' | jq -r --slurp 'length')
114+ MQTT_SUCCESSES=$(cat $mqtt_test_output_file | jq 'select(.Action == "pass")' | jq -r --slurp 'length')
115+ PUBSUB_FAILURES=$(cat $pubsub_test_output_file | jq 'select(.Action == "fail")' | jq -r --slurp 'length')
116+ PUBSUB_SUCCESSES=$(cat $pubsub_test_output_file | jq 'select(.Action == "pass")' | jq -r --slurp 'length')
117+ GRPC_FAILURES=$(cat $grpc_test_output_file | jq 'select(.Action == "fail")' | jq -r --slurp 'length')
118+ GRPC_SUCCESSES=$(cat $grpc_test_output_file | jq 'select(.Action == "pass")' | jq -r --slurp 'length')
119+ FAILURES=$((MQTT_FAILURES + PUBSUB_FAILURES + GRPC_FAILURES))
120+ SUCCESSES=$((MQTT_SUCCESSES + PUBSUB_SUCCESSES + GRPC_SUCCESSES))
97121 # Hard-code warnings
98122 WARNINGS=0
99123 RESULT="$(if [[ $FAILURES == 0 ]]; then echo "SUCCESS"; else echo "FAILURE"; fi)"
@@ -129,6 +153,16 @@ spec:
129153 volumeMounts :
130154 - mountPath : /mosquitto/data
131155 name : mqttdata
156+ - image : gcr.io/google.com/cloudsdktool/google-cloud-cli:emulators
157+ name : pubsub-test
158+ command :
159+ - gcloud
160+ - beta
161+ - emulators
162+ - pubsub
163+ - start
164+ - --host-port=0.0.0.0:8085
165+ - --project=maestro-test
132166 volumes :
133167 - name : pgdata
134168 emptyDir : {}
0 commit comments