Skip to content

Commit 507360f

Browse files
committed
[New Feature + Test] (config) Add more reusable workflow input parameters about setup HTTP server.
1 parent d6b183b commit 507360f

File tree

1 file changed

+42
-18
lines changed

1 file changed

+42
-18
lines changed

.github/workflows/run_test_items_via_pytest.yaml

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,34 +26,54 @@ on:
2626
description: "The target paths of test items under test."
2727
required: true
2828
type: string
29-
http_server:
29+
setup_http_server:
3030
description: "If it's true, it would setup and run a sample HTTP server."
3131
type: boolean
3232
required: false
3333
default: false
34-
dockerfile:
35-
description: "The file path of Dockerfile."
36-
required: false
34+
http_server_host:
35+
description: "If it's true, it would setup and run a sample HTTP server."
3736
type: string
38-
docker_container_name:
39-
description: "The name of docker container."
4037
required: false
41-
default: gh_ci_container
38+
default: 0.0.0.0
39+
http_server_port:
40+
description: "If it's true, it would setup and run a sample HTTP server."
4241
type: string
43-
docker_cmd_options:
44-
description: "The command options of 'docker run'."
4542
required: false
43+
default: 12345
44+
http_server_app_module:
45+
description: "If it's true, it would setup and run a sample HTTP server."
4646
type: string
47-
docker_image_tag:
48-
description: "The tag of image which be built by Dockerfile."
4947
required: false
50-
default: gh_ci_container:v0
48+
default: app
49+
http_server_enter_point:
50+
description: "If it's true, it would setup and run a sample HTTP server."
5151
type: string
52-
docker_context_path:
53-
description: "The path where is the context path of Dockerfile."
5452
required: false
55-
default: ./
56-
type: string
53+
default: app
54+
# dockerfile:
55+
# description: "The file path of Dockerfile."
56+
# required: false
57+
# type: string
58+
# docker_container_name:
59+
# description: "The name of docker container."
60+
# required: false
61+
# default: gh_ci_container
62+
# type: string
63+
# docker_cmd_options:
64+
# description: "The command options of 'docker run'."
65+
# required: false
66+
# type: string
67+
# docker_image_tag:
68+
# description: "The tag of image which be built by Dockerfile."
69+
# required: false
70+
# default: gh_ci_container:v0
71+
# type: string
72+
# docker_context_path:
73+
# description: "The path where is the context path of Dockerfile."
74+
# required: false
75+
# default: ./
76+
# type: string
5777

5878

5979
jobs:
@@ -123,8 +143,12 @@ jobs:
123143
pip install -U -r ./requirements/requirements-test.txt
124144
125145
- name: Setup and run HTTP server for testing
126-
if: ${{ inputs.http_server == true }}
127-
run: gunicorn --bind 0.0.0.0:12345 'test._http_server.app:app'
146+
if: ${{ inputs.setup_http_server == true }}
147+
run: gunicorn --bind ${{ inputs.http_server_host }}:${{ inputs.http_server_port }} '${{ inputs.http_server_app_module }}:${{ inputs.http_server_enter_point }}'--daemon
148+
149+
- name: Test to send HTTP request to sample HTTP server
150+
if: ${{ inputs.setup_http_server == true }}
151+
run: curl "http://${{ inputs.http_server_host }}:${{ inputs.http_server_port }}/exchangeReport/STOCK_DAY?response=json&date=20170101&stockNo=2331"
128152

129153
- name: Run tests with pytest
130154
run: pytest ${{ matrix.test-path }}

0 commit comments

Comments
 (0)