Skip to content

Commit 3ba9671

Browse files
committed
feat: respect .imposter.yaml in pull command.
1 parent 77877ca commit 3ba9671

2 files changed

Lines changed: 83 additions & 7 deletions

File tree

.github/workflows/test-config.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Test Config File
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test-config:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Setup Imposter
16+
uses: ./setup
17+
18+
# Create test configuration files
19+
- name: Create Test Configurations
20+
run: |
21+
mkdir -p mocks
22+
23+
# Create .imposter.yaml config file
24+
cat > mocks/.imposter.yaml << EOF
25+
version: "4.5.4"
26+
EOF
27+
28+
# Create mock configuration
29+
cat > mocks/imposter-config.yaml << EOF
30+
plugin: rest
31+
resources:
32+
- path: /test
33+
response:
34+
statusCode: 200
35+
content: Hello from Imposter
36+
EOF
37+
38+
# Start mock server
39+
- name: Start Mocks
40+
id: start-mocks
41+
uses: ./start-mocks
42+
with:
43+
port: '8080'
44+
config-dir: './mocks'
45+
46+
# Assert server status and version
47+
- name: Assert Server Status
48+
run: |
49+
echo "Checking server status at ${{ steps.start-mocks.outputs.base-url }}/system/status"
50+
response=$(curl -s "${{ steps.start-mocks.outputs.base-url }}/system/status")
51+
status=$(echo "$response" | jq -r '.status')
52+
version=$(echo "$response" | jq -r '.version')
53+
54+
if [ "$status" != "ok" ]; then
55+
echo "Error: Expected status 'ok' but got '$status'"
56+
exit 1
57+
fi
58+
59+
if [ "$version" != "4.5.4" ]; then
60+
echo "Error: Expected version '4.5.4' but got '$version'"
61+
echo "Full response: $response"
62+
exit 1
63+
fi
64+
65+
echo "Server status check passed - running version $version"
66+
67+
# Stop mock server
68+
- name: Stop Mocks
69+
uses: ./stop-mocks
70+
71+
# Verify server stopped
72+
- name: Verify Server Stopped
73+
run: |
74+
if curl -s "${{ steps.start-mocks.outputs.base-url }}/system/status"; then
75+
echo "Mock server is still running"
76+
exit 1
77+
fi

start-mocks/action.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,22 @@ runs:
4646
- name: Pull Imposter engine
4747
shell: bash
4848
run: |
49+
echo "Pulling ${{ inputs.engine-type }} engine"
4950
if [ ! -z "${{ inputs.version }}" ]; then
50-
echo "Pulling ${{ inputs.engine-type }} engine version ${{ inputs.version }}"
51-
imposter engine pull -t ${{ inputs.engine-type }} -v ${{ inputs.version }}
51+
imposter engine pull --engine-type ${{ inputs.engine-type }} --version ${{ inputs.version }} --config "${{ inputs.config-dir }}/.imposter.yaml"
5252
else
53-
echo "Pulling latest ${{ inputs.engine-type }} engine"
54-
imposter engine pull -t ${{ inputs.engine-type }}
53+
imposter engine pull --engine-type ${{ inputs.engine-type }} --config "${{ inputs.config-dir }}/.imposter.yaml"
5554
fi
5655
5756
- name: Start Imposter server
5857
shell: bash
5958
run: |
6059
# Build command with optional version and engine type
61-
cmd="imposter up -p ${{ inputs.port }} -t ${{ inputs.engine-type }}"
60+
cmd="imposter up --port ${{ inputs.port }} --engine-type ${{ inputs.engine-type }}"
6261
if [ ! -z "${{ inputs.version }}" ]; then
63-
cmd="$cmd -v ${{ inputs.version }}"
62+
cmd="$cmd --version ${{ inputs.version }}"
6463
fi
65-
cmd="$cmd --recursive-config-scan=${{ inputs.recursive-config-scan }} --auto-restart=${{ inputs.auto-restart }} \"${{ inputs.config-dir }}\""
64+
cmd="$cmd --recursive-config-scan=${{ inputs.recursive-config-scan }} --auto-restart=${{ inputs.auto-restart }} --config \"${{ inputs.config-dir }}/.imposter.yaml\" \"${{ inputs.config-dir }}\""
6665
6766
# Start the server
6867
eval "$cmd" &

0 commit comments

Comments
 (0)