File tree Expand file tree Collapse file tree 1 file changed +24
-8
lines changed
Expand file tree Collapse file tree 1 file changed +24
-8
lines changed Original file line number Diff line number Diff line change @@ -29,17 +29,33 @@ steps:
2929 - desc : " Port conflict resolution works"
3030 exec :
3131 command : |
32+ ROOT_DIR=$(pwd)
33+ PID_FILE=/tmp/gopose_test.pid
34+ OCCUPY_BIN="$ROOT_DIR/occupy_port"
35+ FIXTURE_DIR="$ROOT_DIR/fixtures"
36+
37+ cleanup() {
38+ if [ -f "$PID_FILE" ]; then
39+ kill "$(cat "$PID_FILE")" 2>/dev/null || true
40+ rm -f "$PID_FILE"
41+ fi
42+ rm -f "$OCCUPY_BIN" "$FIXTURE_DIR/{{ vars.override_file }}"
43+ }
44+ trap cleanup EXIT
45+
3246 # Build and run Go port occupier
33- go build -o occupy_port occupy_port.go
34- ./occupy_port 8080 > /dev/null 2>&1 & echo $! > /tmp/gopose_test.pid
47+ go build -o "$OCCUPY_BIN" occupy_port.go
48+ "$OCCUPY_BIN" 8080 > /dev/null 2>&1 & echo $! > "$PID_FILE"
3549 sleep 2
3650
3751 # Test conflict resolution
38- cd fixtures
39- ../../../gopose up -f port-conflict.yml --verbose
40-
41- # Cleanup
42- kill $(cat /tmp/gopose_test.pid) 2>/dev/null || true
43- rm -f /tmp/gopose_test.pid {{ vars.override_file }} occupy_port
52+ cd "$FIXTURE_DIR"
53+ output=$(../../../gopose up -f port-conflict.yml --verbose 2>&1)
54+ echo "$output"
55+
56+ # Assert port conflicts are actually detected and reported
57+ echo "$output" | grep -q "Port Conflicts:"
58+ echo "$output" | grep -q "SERVICE"
59+ echo "$output" | grep -q "web1"
4460 test : |
4561 current.exit_code == 0
You can’t perform that action at this time.
0 commit comments