|
26 | 26 | description: "The target paths of test items under test." |
27 | 27 | required: true |
28 | 28 | type: string |
29 | | - http_server: |
| 29 | + setup_http_server: |
30 | 30 | description: "If it's true, it would setup and run a sample HTTP server." |
31 | 31 | type: boolean |
32 | 32 | required: false |
33 | 33 | 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." |
37 | 36 | type: string |
38 | | - docker_container_name: |
39 | | - description: "The name of docker container." |
40 | 37 | 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." |
42 | 41 | type: string |
43 | | - docker_cmd_options: |
44 | | - description: "The command options of 'docker run'." |
45 | 42 | 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." |
46 | 46 | type: string |
47 | | - docker_image_tag: |
48 | | - description: "The tag of image which be built by Dockerfile." |
49 | 47 | 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." |
51 | 51 | type: string |
52 | | - docker_context_path: |
53 | | - description: "The path where is the context path of Dockerfile." |
54 | 52 | 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 |
57 | 77 |
|
58 | 78 |
|
59 | 79 | jobs: |
@@ -123,8 +143,12 @@ jobs: |
123 | 143 | pip install -U -r ./requirements/requirements-test.txt |
124 | 144 |
|
125 | 145 | - 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" |
128 | 152 |
|
129 | 153 | - name: Run tests with pytest |
130 | 154 | run: pytest ${{ matrix.test-path }} |
|
0 commit comments