Skip to content

Commit b1a641d

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 b1a641d

1 file changed

Lines changed: 70 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 70 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,72 @@ 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+
# Create test YAML files using echo
92+
echo 'name: "Test Breeder"' > test_breeder.yml
93+
echo 'description: "Integration test breeder"' >> test_breeder.yml
94+
echo 'config:' >> test_breeder.yml
95+
echo ' setting1: "value1"' >> test_breeder.yml
96+
echo ' setting2: 42' >> test_breeder.yml
97+
98+
echo "Testing: breeder create"
99+
$BINARY_PATH --hostname localhost --port 4010 breeder create --file test_breeder.yml
100+
101+
# Test breeder show with a mock UUID
102+
echo "Testing: breeder show"
103+
$BINARY_PATH --hostname localhost --port 4010 breeder show --uuid 123e4567-e89b-12d3-a456-426614174000
104+
105+
# Create update test file
106+
echo 'name: "Updated Test Breeder"' > test_breeder_update.yml
107+
echo 'description: "Updated integration test breeder"' >> test_breeder_update.yml
108+
echo 'config:' >> test_breeder_update.yml
109+
echo ' setting1: "updated_value1"' >> test_breeder_update.yml
110+
echo ' setting2: 100' >> test_breeder_update.yml
111+
echo ' new_setting: "new_value"' >> test_breeder_update.yml
112+
113+
echo "Testing: breeder update"
114+
$BINARY_PATH --hostname localhost --port 4010 breeder update --file test_breeder_update.yml
115+
116+
# Test breeder purge
117+
echo "Testing: breeder purge"
118+
$BINARY_PATH --hostname localhost --port 4010 breeder purge --uuid 123e4567-e89b-12d3-a456-426614174000
119+
120+
# Test help commands
121+
echo "Testing: help commands"
122+
$BINARY_PATH --help
123+
$BINARY_PATH breeder --help || true # May fail but tests argument parsing
124+
125+
- name: Cleanup Prism container
126+
if: always()
127+
run: |
128+
docker stop prism || true
129+
docker rm prism || true

0 commit comments

Comments
 (0)