Skip to content

Commit cc559c3

Browse files
committed
pr ci include test runs against api mock
Using openapi.yml godon-api mock deliberately. That avoids having to start godon-api dependencies and keeps the test flow simple.
1 parent 642f283 commit cc559c3

1 file changed

Lines changed: 74 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
3333
# Set environment variables for this session
3434
export SSL_CERT_FILE="/etc/ssl/certs/ca-bundle.crt"
35-
export NIX_SSL_CERT_FILE="/etc/ssl/certs/ca-bundle.crt"
35+
export NIX_SSL_CERT_FILE="/etc/ssl/certs/ca-bundle.crt"
3636
export CURL_CA_BUNDLE="/etc/ssl/certs/ca-bundle.crt"
3737
3838
# Add to nix.conf for daemon
@@ -58,3 +58,76 @@ jobs:
5858
ls -la $(nix path-info .#default)/bin/ || echo "$out/bin not found"
5959
echo "Testing compiled binary with direct path..."
6060
$(nix path-info .#default)/bin/godon_cli --help
61+
62+
- name: Start Prism mock container
63+
run: |
64+
# Download the OpenAPI spec
65+
curl -o openapi.yml https://raw.githubusercontent.com/godon-dev/godon-images/refs/heads/main/images/godon-api/openapi.yml
66+
67+
# Start Prism container in background
68+
docker run -d --name prism -p 4010:4010 \
69+
-v $(pwd)/openapi.yml:/tmp/openapi.yml \
70+
stoplight/prism:4 \
71+
mock --host 0.0.0.0 /tmp/openapi.yml
72+
73+
# Wait for Prism to start
74+
sleep 10
75+
76+
# Verify Prism is running
77+
curl -f http://localhost:4010/health || exit 1
78+
echo "Prism container started successfully on port 4010"
79+
80+
- name: Integration tests against Prism mock
81+
run: |
82+
# Get the binary path
83+
BINARY_PATH=$(nix path-info .#default)/bin/godon_cli
84+
85+
echo "Running integration tests against Prism mock..."
86+
87+
# Test breeder list
88+
echo "Testing: breeder list"
89+
$BINARY_PATH --hostname localhost --port 4010 breeder list
90+
91+
# Test breeder create (need a sample YAML)
92+
cat > test_breeder.yml << 'EOF'
93+
name: "Test Breeder"
94+
description: "Integration test breeder"
95+
config:
96+
setting1: "value1"
97+
setting2: 42
98+
EOF
99+
100+
echo "Testing: breeder create"
101+
$BINARY_PATH --hostname localhost --port 4010 breeder create --file test_breeder.yml
102+
103+
# Test breeder show with a mock UUID
104+
echo "Testing: breeder show"
105+
$BINARY_PATH --hostname localhost --port 4010 breeder show --uuid 123e4567-e89b-12d3-a456-426614174000
106+
107+
# Test breeder update
108+
cat > test_breeder_update.yml << 'EOF'
109+
name: "Updated Test Breeder"
110+
description: "Updated integration test breeder"
111+
config:
112+
setting1: "updated_value1"
113+
setting2: 100
114+
new_setting: "new_value"
115+
EOF
116+
117+
echo "Testing: breeder update"
118+
$BINARY_PATH --hostname localhost --port 4010 breeder update --file test_breeder_update.yml
119+
120+
# Test breeder purge
121+
echo "Testing: breeder purge"
122+
$BINARY_PATH --hostname localhost --port 4010 breeder purge --uuid 123e4567-e89b-12d3-a456-426614174000
123+
124+
# Test help commands
125+
echo "Testing: help commands"
126+
$BINARY_PATH --help
127+
$BINARY_PATH breeder --help || true # May fail but tests argument parsing
128+
129+
- name: Cleanup Prism container
130+
if: always()
131+
run: |
132+
docker stop prism || true
133+
docker rm prism || true

0 commit comments

Comments
 (0)