Skip to content

Commit b101af9

Browse files
committed
chore: Update CI workflow and integration test scripts to improve logging and test execution flow
1 parent 9cc6e8b commit b101af9

File tree

3 files changed

+66
-22
lines changed

3 files changed

+66
-22
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,14 +655,26 @@ jobs:
655655
# List loaded images
656656
docker images
657657
658-
- name: Run federation integration tests with pre-built image
658+
- name: Start federation services
659659
working-directory: ./ee/packages/federation-matrix
660660
env:
661661
ROCKETCHAT_IMAGE: ghcr.io/${{ needs.release-versions.outputs.lowercase-repo }}/rocket.chat:${{ needs.release-versions.outputs.gh-docker-tag }}-amd64
662662
ENTERPRISE_LICENSE_RC1: ZAikY+LLaal7mT6RNYxpyWEmMQyucrl50/7pYBXqHczc90j+RLwF+T0xuCT2pIpKMC5DxcZ1TtkV6MYJk5whrwmap+mQ0FV+VpILJlL0i4T21K4vMfzZXTWm/pzcAy2fMTUNH+mUA9HTBD6lYYh40KnbGXPAd80VbZk0MO/WbWBm2dOT0YCwfvlRyurRqkDAQrftLaffzCNUsMKk0fh+MKs73UDHZQDp1yvs7WoGpPu5ZVi5mTBOt3ZKVz5KjGfClLwJptFPmW1w6nKelAiJBDPpjcX1ylfjxpnBoixko7uN52zlyaeoAYwfRcdDLnZ8k0Ou6tui/vTQUXjGIjHw2AhMaKwonn4E9LYpuA1KEXt08qJL5J3ZtjSCV1T+A9Z3zFhhLgp5dxP/PPUbxDn/P8XKp7nXM9duIfcCMlnea7V8ixEyCHwwvKQaXVVidcsUGtB8CwS0GlsAEBLOzqMehuQUK2rdQ4WgEz3AYveikeVvSzgBHvyXsxssWAThc0Mht0eEJqdDhUB2QeZ2WmPsaSSD639Z4WgjSUoR0zh8bfqepH+2XRcUryXe2yN+iU+3POzi9wfg0k65MxXT8pBg3PD5RHnR8oflEP0tpZts33JiBhYRxX3MKplAFm4dMuphTsDJTh+e534pT7IPuZF79QSVaLEWZfVVVb7nGFtmMwA=
663663
QASE_TESTOPS_JEST_API_TOKEN: ${{ secrets.QASE_TESTOPS_JEST_API_TOKEN }}
664664
PR_NUMBER: ${{ github.event.number }}
665-
run: yarn test:integration --image "${ROCKETCHAT_IMAGE}"
665+
run: yarn test:integration:start-containers-only --image "${ROCKETCHAT_IMAGE}"
666+
667+
- name: Run federation integration tests
668+
working-directory: ./ee/packages/federation-matrix
669+
env:
670+
QASE_TESTOPS_JEST_API_TOKEN: ${{ secrets.QASE_TESTOPS_JEST_API_TOKEN }}
671+
PR_NUMBER: ${{ github.event.number }}
672+
run: yarn test:integration:ci
673+
674+
- name: Show federation integration tests logs
675+
if: failure()
676+
working-directory: ./ee/packages/federation-matrix
677+
run: yarn test:integration:logs
666678

667679
- name: Show rc server logs if tests failed
668680
if: failure()

ee/packages/federation-matrix/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
"lint": "eslint .",
1414
"lint:fix": "eslint --fix .",
1515
"test": "jest",
16+
"test:integration:logs": "./tests/scripts/run-integration-tests.sh --logs",
17+
"test:integration:start-containers-only": "./tests/scripts/run-integration-tests.sh --start-containers-only",
1618
"test:integration": "./tests/scripts/run-integration-tests.sh",
19+
"test:integration:ci": "./tests/scripts/run-integration-tests.sh --ci",
1720
"test:federation": "jest --config jest.config.federation.ts",
1821
"testunit": "jest",
1922
"typecheck": "tsc --noEmit"

ee/packages/federation-matrix/tests/scripts/run-integration-tests.sh

Lines changed: 49 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,27 @@ PREBUILT_IMAGE=""
3535
INTERRUPTED=false
3636
PROFILE_PREFIX="local" # Default to local build
3737
NO_TEST=false
38+
CI=false
39+
LOGS=false
40+
3841

3942
while [[ $# -gt 0 ]]; do
4043
case $1 in
44+
--start-containers-only)
45+
NO_TEST=true
46+
KEEP_RUNNING=true
47+
shift
48+
;;
49+
--ci)
50+
CI=true
51+
KEEP_RUNNING=true
52+
shift
53+
;;
54+
--logs)
55+
LOGS=true
56+
NO_TEST=true
57+
shift
58+
;;
4159
--keep-running)
4260
KEEP_RUNNING=true
4361
shift
@@ -102,35 +120,43 @@ log_error() {
102120
echo -e "${RED}❌ [$(date '+%Y-%m-%d %H:%M:%S')] $1${NC}"
103121
}
104122

123+
docker_log() {
124+
local container=$1
125+
if docker ps -q -f name=$container | grep -q .; then
126+
docker logs $container 2>&1 | sed 's/^/ /'
127+
else
128+
echo " $container container not found or no logs"
129+
fi
130+
}
131+
132+
docker_logs() {
133+
echo ""
134+
echo "ROCKET.CHAT (rc1) LOGS:"
135+
echo "----------------------------------------"
136+
docker_log "rc1"
137+
138+
echo ""
139+
echo "SYNAPSE (hs1) LOGS:"
140+
echo "----------------------------------------"
141+
docker_log "hs1"
142+
143+
echo ""
144+
echo "=========================================="
145+
}
146+
105147
# Cleanup function
106148
cleanup() {
149+
if [ "$CI" = true ]; then
150+
return
151+
fi
107152
# Show container logs if tests failed
108153
if [ -n "${TEST_EXIT_CODE:-}" ] && [ "$TEST_EXIT_CODE" -ne 0 ]; then
109154
echo ""
110155
echo "=========================================="
111156
echo "CONTAINER LOGS (Test Failed)"
112157
echo "=========================================="
113158

114-
echo ""
115-
echo "ROCKET.CHAT (rc1) LOGS:"
116-
echo "----------------------------------------"
117-
if docker ps -q -f name=rc1 | grep -q .; then
118-
docker logs rc1 2>&1 | sed 's/^/ /'
119-
else
120-
echo " Rocket.Chat container not found or no logs"
121-
fi
122-
123-
echo ""
124-
echo "SYNAPSE (hs1) LOGS:"
125-
echo "----------------------------------------"
126-
if docker ps -q -f name=hs1 | grep -q .; then
127-
docker logs hs1 2>&1 | sed 's/^/ /'
128-
else
129-
echo " Synapse container not found or no logs"
130-
fi
131-
132-
echo ""
133-
echo "=========================================="
159+
docker_logs
134160
fi
135161

136162
if [ "$KEEP_RUNNING" = true ]; then
@@ -333,6 +359,9 @@ if [ "$NO_TEST" = false ]; then
333359
IS_EE=true NODE_EXTRA_CA_CERTS=$(pwd)/docker-compose/traefik/certs/ca/rootCA.crt yarn test:federation
334360
TEST_EXIT_CODE=$?
335361
set -e
362+
elif [ "$LOGS" = true ]; then
363+
docker_logs
364+
exit 0
336365
else
337366
log_info "No-test mode: skipping test execution"
338367
log_info "Services are ready and running. You can now:"

0 commit comments

Comments
 (0)