Skip to content

Commit 475835b

Browse files
committed
add integration test for event gateway
1 parent ef223a9 commit 475835b

13 files changed

Lines changed: 5077 additions & 0 deletions

File tree

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# --------------------------------------------------------------------
2+
# Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
3+
#
4+
# WSO2 LLC. licenses this file to you under the Apache License,
5+
# Version 2.0 (the "License"); you may not use this file except
6+
# in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
# --------------------------------------------------------------------
18+
19+
name: Event Gateway Integration Test
20+
21+
on:
22+
workflow_dispatch:
23+
pull_request:
24+
branches:
25+
- main
26+
paths:
27+
- 'event-gateway/**'
28+
- 'gateway/gateway-controller/**'
29+
- 'common/**'
30+
- 'sdk/**'
31+
- '.github/workflows/event-gateway-integration-test.yml'
32+
33+
concurrency:
34+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
35+
cancel-in-progress: true
36+
37+
jobs:
38+
integration-test:
39+
runs-on: ubuntu-24.04
40+
steps:
41+
- name: Checkout code
42+
uses: actions/checkout@v4
43+
44+
- name: Set up Go
45+
uses: actions/setup-go@v5
46+
with:
47+
go-version: '1.26.2'
48+
cache-dependency-path: '**/go.sum'
49+
50+
- name: Set up Docker Buildx
51+
uses: docker/setup-buildx-action@v3
52+
53+
- name: Read version
54+
id: version
55+
run: echo "version=$(cat event-gateway/VERSION)" >> $GITHUB_OUTPUT
56+
57+
- name: Build event-gateway-controller image
58+
run: make -C event-gateway build-event-gateway-controller VERSION=${{ steps.version.outputs.version }}
59+
60+
- name: Build event-gateway-runtime image
61+
run: make -C event-gateway build-gateway-runtime VERSION=${{ steps.version.outputs.version }}
62+
63+
- name: Run integration tests
64+
run: make -C event-gateway/it test
65+
66+
- name: Upload compose logs
67+
uses: actions/upload-artifact@v4
68+
if: always()
69+
with:
70+
name: compose-logs
71+
path: event-gateway/it/logs/
72+
retention-days: 7
73+
74+
- name: Debug on failure - Dump logs
75+
if: failure()
76+
run: |
77+
echo "=== Docker Containers ==="
78+
docker ps -a
79+
80+
echo ""
81+
echo "=== event-gateway/it/logs Directory Contents ==="
82+
if [ -d event-gateway/it/logs ]; then
83+
if [ "$(ls -A event-gateway/it/logs)" ]; then
84+
for f in event-gateway/it/logs/*; do
85+
echo ""
86+
echo "--- Contents of $f ---"
87+
cat "$f"
88+
done
89+
else
90+
echo "No log files found in event-gateway/it/logs."
91+
fi
92+
else
93+
echo "Directory event-gateway/it/logs does not exist."
94+
fi

event-gateway/it/Makefile

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# --------------------------------------------------------------------
2+
# Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
3+
#
4+
# WSO2 LLC. licenses this file to you under the Apache License,
5+
# Version 2.0 (the "License"); you may not use this file except
6+
# in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
# --------------------------------------------------------------------
18+
19+
# Event Gateway Integration Tests
20+
SHELL := /bin/bash
21+
22+
.DEFAULT_GOAL := help
23+
24+
.PHONY: help
25+
help: ## Show available targets
26+
@echo 'Event Gateway Integration Tests'
27+
@echo ''
28+
@echo 'Usage:'
29+
@echo ' make test Run the full integration test suite'
30+
@echo ' make test-health Run only health-check scenarios'
31+
@echo ' make test-websub Run only WebSub management scenarios'
32+
@echo ' make test-e2e Run only end-to-end WebSub flow scenarios'
33+
@echo ' make tidy Run go mod tidy'
34+
@echo ' make clean Remove generated logs and test artefacts'
35+
36+
.PHONY: test
37+
test: ## Run all integration tests
38+
go test -v -timeout 10m ./...
39+
40+
.PHONY: test-health
41+
test-health: ## Run health check feature only
42+
IT_FEATURE_PATHS=health.feature go test -v -timeout 5m ./...
43+
44+
.PHONY: test-websub
45+
test-websub: ## Run WebSub API management feature only
46+
IT_FEATURE_PATHS=websub-api-management.feature go test -v -timeout 5m ./...
47+
48+
.PHONY: test-e2e
49+
test-e2e: ## Run WebSub end-to-end feature only
50+
IT_FEATURE_PATHS=websub-e2e.feature go test -v -timeout 10m ./...
51+
52+
.PHONY: tidy
53+
tidy: ## Tidy go modules
54+
go mod tidy
55+
56+
.PHONY: clean
57+
clean: ## Remove generated artefacts
58+
rm -rf logs/
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# --------------------------------------------------------------------
2+
# Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
3+
#
4+
# WSO2 LLC. licenses this file to you under the Apache License,
5+
# Version 2.0 (the "License"); you may not use this file except
6+
# in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
# --------------------------------------------------------------------
18+
19+
Feature: Event Gateway Health Checks
20+
As an operator
21+
I want to verify that event gateway services are healthy
22+
So that I can ensure the gateway is operational
23+
24+
Background:
25+
Given the event gateway services are running
26+
27+
Scenario: Event gateway liveness probe returns UP
28+
When I send a GET request to the event gateway health endpoint
29+
Then the response status code should be 200
30+
And the response should be valid JSON
31+
And the response should indicate UP status
32+
33+
Scenario: Event gateway readiness probe returns READY
34+
When I send a GET request to the event gateway ready endpoint
35+
Then the response status code should be 200
36+
And the response should be valid JSON
37+
And the response should indicate READY status

0 commit comments

Comments
 (0)