1+ name : Load Test with IBM MQ
2+
3+ on :
4+ push :
5+ branches : [ main, develop ]
6+ pull_request :
7+ branches : [ main ]
8+ workflow_dispatch :
9+
10+ jobs :
11+ load-test :
12+ runs-on : ubuntu-latest
13+
14+ steps :
15+ - name : Checkout code
16+ uses : actions/checkout@v4
17+
18+ - name : Set up JDK 17
19+ uses : actions/setup-java@v4
20+ with :
21+ java-version : ' 17'
22+ distribution : ' temurin'
23+
24+ - name : Cache Maven dependencies
25+ uses : actions/cache@v3
26+ with :
27+ path : ~/.m2
28+ key : ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
29+ restore-keys : ${{ runner.os }}-m2
30+
31+ - name : Install JMeter
32+ run : |
33+ wget https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-5.6.3.tgz
34+ tar -xzf apache-jmeter-5.6.3.tgz
35+ sudo mv apache-jmeter-5.6.3 /opt/jmeter
36+ sudo ln -s /opt/jmeter/bin/jmeter /usr/local/bin/jmeter
37+
38+ - name : Download IBM MQ JAR dependencies
39+ run : |
40+ mkdir -p /opt/jmeter/lib
41+ # Download IBM MQ client JARs (these would be from your Maven repository)
42+ # For now, we'll build the application first to get them from .m2
43+
44+ - name : Build application
45+ run : mvn clean package -DskipTests
46+
47+ - name : Copy IBM MQ JARs to JMeter
48+ run : |
49+ # Copy IBM MQ JARs from Maven cache to JMeter lib
50+ find ~/.m2/repository -name "*ibm.mq*.jar" -exec cp {} /opt/jmeter/lib/ \;
51+ find ~/.m2/repository -name "*connector-api*.jar" -exec cp {} /opt/jmeter/lib/ \;
52+
53+ - name : Start Docker services
54+ run : |
55+ docker-compose -f .github/docker-compose.ci.yml up -d
56+ # Wait for services to be ready
57+ sleep 30
58+
59+ - name : Check IBM MQ status
60+ run : |
61+ docker logs ibmmq-ci
62+ docker ps
63+
64+ - name : Wait for IBM MQ to be ready
65+ run : |
66+ # Wait up to 2 minutes for IBM MQ to be ready
67+ timeout 120 bash -c 'until docker exec ibmmq-ci dspmq -m QM1 | grep "Running"; do sleep 5; done'
68+
69+ - name : Start Payara application
70+ run : |
71+ mvn payara-micro:start &
72+ # Wait for application to start
73+ sleep 45
74+
75+ - name : Check application health
76+ run : |
77+ curl -f http://localhost:8080/payara6-ibmmq/api/simple/health || exit 1
78+ curl -f http://localhost:8080/payara6-ibmmq/api/batch/jobs || exit 1
79+ curl -f http://localhost:8080/payara6-ibmmq/api/metrics/prometheus || exit 1
80+
81+ - name : Test IBM MQ connection
82+ run : |
83+ # Test if we can send a message via REST API
84+ curl -X POST \
85+ -H "Content-Type: text/plain" \
86+ -d "GitHub Actions test message" \
87+ http://localhost:8080/payara6-ibmmq/api/mq/send || echo "MQ connection failed"
88+
89+ - name : Run High Performance Load Tests
90+ run : |
91+ cd load-tests
92+ echo "Starting high-performance load tests..."
93+
94+ # Run REST API Load Test (50 requests/s for 5 minutes)
95+ echo "=== REST API Load Test ==="
96+ jmeter -n \
97+ -t simple-rest-load-test.jmx \
98+ -l results/rest-load-$(date +%Y%m%d_%H%M%S).jtl \
99+ -e \
100+ -o results/rest-load-report-$(date +%Y%m%d_%H%M%S) \
101+ -Japp_host=localhost \
102+ -Japp_port=8080 \
103+ || echo "REST API test completed with some errors"
104+
105+ # Wait before next test
106+ sleep 30
107+
108+ # Run MQ High Performance Test (50 messages/s for 5 minutes)
109+ echo "=== MQ High Performance Test ==="
110+ jmeter -n \
111+ -t high-performance-mq-test.jmx \
112+ -l results/mq-load-$(date +%Y%m%d_%H%M%S).jtl \
113+ -e \
114+ -o results/mq-load-report-$(date +%Y%m%d_%H%M%S) \
115+ -Japp_host=localhost \
116+ -Japp_port=8080 \
117+ -Jmq_threads=50 \
118+ -Jtest_duration=300 \
119+ || echo "MQ test completed with some errors"
120+
121+ - name : Generate summary report
122+ run : |
123+ cd load-tests
124+ echo "# High Performance Load Test Results 🚀" > test-summary.md
125+ echo "" >> test-summary.md
126+ echo "## Test Configuration" >> test-summary.md
127+ echo "- **Platform:** ${{ runner.os }} x86_64" >> test-summary.md
128+ echo "- **Date:** $(date)" >> test-summary.md
129+ echo "- **Target:** 50 Requests/s for 5 minutes" >> test-summary.md
130+ echo "- **REST API Test:** 50 threads, 60s ramp-up, 300s duration" >> test-summary.md
131+ echo "- **MQ Test:** 50 message producers, 300s duration" >> test-summary.md
132+ echo "" >> test-summary.md
133+
134+ echo "## REST API Load Test Results" >> test-summary.md
135+ if [ -f results/rest-load-report-*/statistics.json ]; then
136+ echo "✅ REST API load test completed" >> test-summary.md
137+ echo "" >> test-summary.md
138+ echo "### REST API Statistics" >> test-summary.md
139+ echo "\`\`\`json" >> test-summary.md
140+ cat results/rest-load-report-*/statistics.json >> test-summary.md
141+ echo "\`\`\`" >> test-summary.md
142+ else
143+ echo "❌ REST API load test failed" >> test-summary.md
144+ fi
145+
146+ echo "" >> test-summary.md
147+ echo "## MQ High Performance Test Results" >> test-summary.md
148+ if [ -f results/mq-load-report-*/statistics.json ]; then
149+ echo "✅ MQ load test completed" >> test-summary.md
150+ echo "" >> test-summary.md
151+ echo "### MQ Statistics" >> test-summary.md
152+ echo "\`\`\`json" >> test-summary.md
153+ cat results/mq-load-report-*/statistics.json >> test-summary.md
154+ echo "\`\`\`" >> test-summary.md
155+ else
156+ echo "❌ MQ load test failed" >> test-summary.md
157+ fi
158+
159+ echo "" >> test-summary.md
160+ echo "## Test Summary" >> test-summary.md
161+ TOTAL_TESTS=$(find results -name "*.jtl" | wc -l)
162+ echo "- **Total Test Runs:** $TOTAL_TESTS" >> test-summary.md
163+ echo "- **Expected Duration:** ~11 minutes (5min + 30s + 5min)" >> test-summary.md
164+ echo "- **Reports Generated:** $(find results -name "index.html" | wc -l)" >> test-summary.md
165+
166+ - name : Upload test results
167+ uses : actions/upload-artifact@v3
168+ if : always()
169+ with :
170+ name : load-test-results
171+ path : |
172+ load-tests/results/
173+ load-tests/test-summary.md
174+
175+ - name : Comment PR with results
176+ uses : actions/github-script@v6
177+ if : github.event_name == 'pull_request'
178+ with :
179+ script : |
180+ const fs = require('fs');
181+ const path = 'load-tests/test-summary.md';
182+ if (fs.existsSync(path)) {
183+ const summary = fs.readFileSync(path, 'utf8');
184+ github.rest.issues.createComment({
185+ issue_number: context.issue.number,
186+ owner: context.repo.owner,
187+ repo: context.repo.repo,
188+ body: summary
189+ });
190+ }
191+
192+ - name : Show container logs on failure
193+ if : failure()
194+ run : |
195+ echo "=== IBM MQ Logs ==="
196+ docker logs ibmmq-ci
197+ echo "=== PostgreSQL Logs ==="
198+ docker logs postgres-ci
199+ echo "=== Container Status ==="
200+ docker ps -a
0 commit comments