|
1 | | -name: Test Docker Compose |
2 | | - |
3 | | -on: |
4 | | - push: |
5 | | - branches: |
6 | | - - main |
7 | | - - feat/** |
8 | | - pull_request: |
9 | | - branches: |
10 | | - - main |
11 | | - |
12 | | -jobs: |
13 | | - test: |
14 | | - runs-on: ubuntu-latest |
15 | | - timeout-minutes: 10 |
16 | | - |
17 | | - steps: |
18 | | - - name: Checkout code |
19 | | - uses: actions/checkout@v4 |
20 | | - |
21 | | - - name: Set up Docker |
22 | | - uses: docker/setup-buildx-action@v3 |
23 | | - |
24 | | - - name: Start Docker Compose services |
25 | | - run: docker compose up -d |
26 | | - |
27 | | - - name: Wait for services to be healthy |
28 | | - run: | |
29 | | - # Give services time to start |
30 | | - sleep 120 |
31 | | -
|
32 | | - # Wait for all services to be healthy |
33 | | - echo "Waiting for services to become healthy..." |
34 | | - for i in {1..50}; do |
35 | | - # Check if all expected services are healthy |
36 | | - status=$(docker compose ps --format "{{.Service}}: {{.State}}" | grep -v "healthy" || true) |
37 | | -
|
38 | | - if [ -z "$status" ]; then |
39 | | - echo "✓ All services are healthy" |
40 | | - break |
41 | | - fi |
42 | | -
|
43 | | - echo "Attempt $i/50: Waiting for services..." |
44 | | - if [ $i -eq 50 ]; then |
45 | | - echo "✗ Services did not become healthy in time" |
46 | | - docker compose logs |
47 | | - exit 1 |
48 | | - fi |
49 | | - sleep 10 |
50 | | - done |
51 | | -
|
52 | | - - name: Verify all containers are running |
53 | | - run: | |
54 | | - echo "Verifying containers..." |
55 | | - docker compose ps |
56 | | -
|
57 | | - # Check that all expected services exist and are running |
58 | | - expected_services="axondb-search timseriesdb axon-server axon-dash" |
59 | | - for service in $expected_services; do |
60 | | - if ! docker compose ps "$service" | grep -q "Up"; then |
61 | | - echo "✗ Service $service is not running" |
62 | | - docker compose logs "$service" |
63 | | - exit 1 |
64 | | - fi |
65 | | - echo "✓ Service $service is running" |
66 | | - done |
67 | | -
|
68 | | - - name: Test connectivity to AxonOps Dashboard (port 3000) |
69 | | - run: | |
70 | | - echo "Testing connectivity to port 3000..." |
71 | | - max_attempts=30 |
72 | | - attempt=1 |
73 | | -
|
74 | | - while [ $attempt -le $max_attempts ]; do |
75 | | - if curl -sf http://localhost:3000 > /dev/null; then |
76 | | - echo "✓ Successfully connected to AxonOps Dashboard on port 3000" |
77 | | - exit 0 |
78 | | - fi |
79 | | -
|
80 | | - echo "Attempt $attempt/$max_attempts: Port 3000 not ready yet..." |
81 | | - attempt=$((attempt + 1)) |
82 | | - sleep 2 |
83 | | - done |
84 | | -
|
85 | | - echo "✗ Failed to connect to port 3000 after $max_attempts attempts" |
86 | | - exit 1 |
87 | | -
|
88 | | - - name: Test AxonOps Server API (port 8080) |
89 | | - run: | |
90 | | - if curl -sf http://localhost:8080/api/v1/healthz > /dev/null; then |
91 | | - echo "✓ AxonOps Server API is responding on port 8080" |
92 | | - else |
93 | | - echo "⚠ AxonOps Server API did not respond (may still be starting)" |
94 | | - fi |
95 | | -
|
96 | | - - name: Test Cassandra (port 9042) |
97 | | - run: | |
98 | | - if nc -z localhost 9042; then |
99 | | - echo "✓ Cassandra is listening on port 9042" |
100 | | - else |
101 | | - echo "⚠ Cassandra is not responding on port 9042" |
102 | | - fi |
103 | | -
|
104 | | - - name: Run health check script |
105 | | - run: | |
106 | | - chmod +x ./check_health.sh |
107 | | - if ./check_health.sh; then |
108 | | - echo "✓ Health check passed" |
109 | | - else |
110 | | - echo "⚠ Health check script reported issues (may be transient)" |
111 | | - fi |
112 | | -
|
113 | | - - name: Collect logs on failure |
114 | | - if: failure() |
115 | | - run: | |
116 | | - echo "=== Docker Compose Logs ===" |
117 | | - docker compose logs |
118 | | - echo "" |
119 | | - echo "=== Docker Stats ===" |
120 | | - docker stats --no-stream |
121 | | - echo "" |
122 | | - echo "=== Service Status ===" |
123 | | - docker compose ps -a |
124 | | -
|
125 | | - - name: Cleanup |
126 | | - if: always() |
127 | | - run: docker compose down -v |
| 1 | +# name: Test Docker Compose |
| 2 | + |
| 3 | +# on: |
| 4 | +# push: |
| 5 | +# branches: |
| 6 | +# - main |
| 7 | +# - feat/** |
| 8 | +# pull_request: |
| 9 | +# branches: |
| 10 | +# - main |
| 11 | + |
| 12 | +# jobs: |
| 13 | +# test: |
| 14 | +# runs-on: ubuntu-latest |
| 15 | +# timeout-minutes: 10 |
| 16 | + |
| 17 | +# steps: |
| 18 | +# - name: Checkout code |
| 19 | +# uses: actions/checkout@v4 |
| 20 | + |
| 21 | +# - name: Set up Docker |
| 22 | +# uses: docker/setup-buildx-action@v3 |
| 23 | + |
| 24 | +# - name: Start Docker Compose services |
| 25 | +# run: docker compose up -d |
| 26 | + |
| 27 | +# - name: Wait for services to be healthy |
| 28 | +# run: | |
| 29 | +# # Give services time to start |
| 30 | +# sleep 120 |
| 31 | + |
| 32 | +# # Wait for all services to be healthy |
| 33 | +# echo "Waiting for services to become healthy..." |
| 34 | +# for i in {1..50}; do |
| 35 | +# # Check if all expected services are healthy |
| 36 | +# status=$(docker compose ps --format "{{.Service}}: {{.State}}" | grep -v "healthy" || true) |
| 37 | + |
| 38 | +# if [ -z "$status" ]; then |
| 39 | +# echo "✓ All services are healthy" |
| 40 | +# break |
| 41 | +# fi |
| 42 | + |
| 43 | +# echo "Attempt $i/50: Waiting for services..." |
| 44 | +# if [ $i -eq 50 ]; then |
| 45 | +# echo "✗ Services did not become healthy in time" |
| 46 | +# docker compose logs |
| 47 | +# exit 1 |
| 48 | +# fi |
| 49 | +# sleep 10 |
| 50 | +# done |
| 51 | + |
| 52 | +# - name: Verify all containers are running |
| 53 | +# run: | |
| 54 | +# echo "Verifying containers..." |
| 55 | +# docker compose ps |
| 56 | + |
| 57 | +# # Check that all expected services exist and are running |
| 58 | +# expected_services="axondb-search timseriesdb axon-server axon-dash" |
| 59 | +# for service in $expected_services; do |
| 60 | +# if ! docker compose ps "$service" | grep -q "Up"; then |
| 61 | +# echo "✗ Service $service is not running" |
| 62 | +# docker compose logs "$service" |
| 63 | +# exit 1 |
| 64 | +# fi |
| 65 | +# echo "✓ Service $service is running" |
| 66 | +# done |
| 67 | + |
| 68 | +# - name: Test connectivity to AxonOps Dashboard (port 3000) |
| 69 | +# run: | |
| 70 | +# echo "Testing connectivity to port 3000..." |
| 71 | +# max_attempts=30 |
| 72 | +# attempt=1 |
| 73 | + |
| 74 | +# while [ $attempt -le $max_attempts ]; do |
| 75 | +# if curl -sf http://localhost:3000 > /dev/null; then |
| 76 | +# echo "✓ Successfully connected to AxonOps Dashboard on port 3000" |
| 77 | +# exit 0 |
| 78 | +# fi |
| 79 | + |
| 80 | +# echo "Attempt $attempt/$max_attempts: Port 3000 not ready yet..." |
| 81 | +# attempt=$((attempt + 1)) |
| 82 | +# sleep 2 |
| 83 | +# done |
| 84 | + |
| 85 | +# echo "✗ Failed to connect to port 3000 after $max_attempts attempts" |
| 86 | +# exit 1 |
| 87 | + |
| 88 | +# - name: Test AxonOps Server API (port 8080) |
| 89 | +# run: | |
| 90 | +# if curl -sf http://localhost:8080/api/v1/healthz > /dev/null; then |
| 91 | +# echo "✓ AxonOps Server API is responding on port 8080" |
| 92 | +# else |
| 93 | +# echo "⚠ AxonOps Server API did not respond (may still be starting)" |
| 94 | +# fi |
| 95 | + |
| 96 | +# - name: Test Cassandra (port 9042) |
| 97 | +# run: | |
| 98 | +# if nc -z localhost 9042; then |
| 99 | +# echo "✓ Cassandra is listening on port 9042" |
| 100 | +# else |
| 101 | +# echo "⚠ Cassandra is not responding on port 9042" |
| 102 | +# fi |
| 103 | + |
| 104 | +# - name: Run health check script |
| 105 | +# run: | |
| 106 | +# chmod +x ./check_health.sh |
| 107 | +# if ./check_health.sh; then |
| 108 | +# echo "✓ Health check passed" |
| 109 | +# else |
| 110 | +# echo "⚠ Health check script reported issues (may be transient)" |
| 111 | +# fi |
| 112 | + |
| 113 | +# - name: Collect logs on failure |
| 114 | +# if: failure() |
| 115 | +# run: | |
| 116 | +# echo "=== Docker Compose Logs ===" |
| 117 | +# docker compose logs |
| 118 | +# echo "" |
| 119 | +# echo "=== Docker Stats ===" |
| 120 | +# docker stats --no-stream |
| 121 | +# echo "" |
| 122 | +# echo "=== Service Status ===" |
| 123 | +# docker compose ps -a |
| 124 | + |
| 125 | +# - name: Cleanup |
| 126 | +# if: always() |
| 127 | +# run: docker compose down -v |
0 commit comments