-
Notifications
You must be signed in to change notification settings - Fork 2
132 lines (108 loc) · 4.65 KB
/
test-e2e-config.yml
File metadata and controls
132 lines (108 loc) · 4.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
---
name: E2E Configuration Tests
# This workflow tests ONLY software configuration, release, and run phases
# using Docker containers. It does NOT test infrastructure provisioning
# (VMs/containers creation) as that is handled by the E2E Provision Tests
# workflow.
#
# This workflow uses Docker containers instead of LXD VMs to avoid GitHub
# Actions network connectivity issues within VMs that prevent software
# installation.
#
# NETWORK TUNING: We use smorimoto/tune-github-hosted-runner-network to fix
# flaky networking issues that cause Docker GPG key downloads to fail
# intermittently in GitHub Actions.
# See: https://github.com/actions/runner-images/issues/1187 and
# https://github.com/actions/runner-images/issues/2890
on:
push:
pull_request:
workflow_dispatch: # Allow manual triggering
jobs:
e2e-config-tests:
runs-on: ubuntu-latest
timeout-minutes: 45 # Timeout for complete configuration testing with software installation
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Tune GitHub hosted runner network
uses: smorimoto/tune-github-hosted-runner-network@v1
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Install Ansible
run: ./scripts/setup/install-ansible.sh
- name: Setup Docker
uses: docker/setup-buildx-action@v3
- name: Verify installations
run: |
docker --version
ansible --version
cargo --version
- name: Set SSH key permissions
run: |
# SSH requires private key files to have restrictive permissions (0600)
# Git checkout doesn't preserve file permissions, so we need to set them manually
chmod 600 fixtures/testing_rsa
ls -la fixtures/testing_rsa
- name: Build E2E configuration tests binary
run: |
cargo build --bin e2e-config-tests --release
- name: Run E2E configuration test
run: |
# Run the E2E configuration test with debug logging for better debugging
echo "🚀 Starting E2E configuration test at $(date)"
cargo run --bin e2e-config-tests
echo "✅ E2E configuration test completed at $(date)"
env:
# Preserve environment variables for the E2E test
RUST_LOG: debug
- name: Get test outputs (on success)
if: success()
run: |
echo "=== Docker Containers ==="
docker ps -a || echo "No containers found"
echo "=== Docker Images ==="
docker images || echo "No images found"
- name: Debug information (on failure)
if: failure()
run: |
echo "=== Docker Status ==="
docker ps -a || echo "Docker ps failed"
echo "=== Docker Logs ==="
# Get logs from any containers that might still be running
for container in $(docker ps -aq 2>/dev/null || true); do
echo "=== Logs for container $container ==="
docker logs "$container" 2>/dev/null || echo "Could not get logs for container $container"
done
echo "=== System Resources ==="
df -h
free -h
echo "=== Recent logs ==="
sudo journalctl --since "10 minutes ago" --no-pager | tail -50 || echo "Journal logs not available"
- name: Cleanup containers (always run)
if: always()
run: |
echo "Cleaning up test containers..."
# This is a safety fallback cleanup in case testcontainers cleanup didn't complete
# properly (e.g., if the test was abruptly halted). Under normal circumstances,
# the testcontainers crate should automatically clean up containers when tests finish.
# Clean up the specific container created for e2e-config tests
docker rm -f torrust-tracker-vm-e2e-config 2>/dev/null || echo "Container torrust-tracker-vm-e2e-config not found or already removed"
# Clean up any test images if needed
docker images --filter "reference=torrust-provisioned-instance*" -q | xargs -r docker rmi -f || echo "No test images to remove"
- name: Final verification
if: always()
run: |
echo "Verifying final cleanup..."
docker ps -a
echo "=== Test Summary ==="
echo "E2E configuration test workflow completed"
if [ "${{ job.status }}" = "success" ]; then
echo "✅ All configuration tests passed successfully"
else
echo "❌ Some configuration tests failed - check logs above"
fi