generated from actions/container-action
-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (118 loc) · 4.22 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
---
name: Test
on: push # yamllint disable-line rule:truthy
env:
ASSERT_VERSION: "| grep -q $HOVERFLY_VERSION"
ASSERT_HOVERFLY_NOT_INSTALLED: "! hoverfly -version"
ASSERT_HOVERCTL_NOT_INSTALLED: "! hoverctl version"
ASSERT_ERROR: "!"
EXAMPLE_HTTPS_PROXY_REQUEST: "curl --proxy localhost:8500 https://example.com"
jobs:
install_latest_version_by_default:
name: Install latest version by default
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Hoverfly
uses: ./
with:
runner_github_workspace_path: ${{ github.workspace }}
- name: Assert latest version installed
env:
HOVERFLY_VERSION: "v1.3.0"
run: |
hoverfly -version ${{ env.ASSERT_VERSION }}
hoverctl version ${{ env.ASSERT_VERSION }}
install_specific_version:
name: Install specific version
runs-on: ubuntu-latest
env:
HOVERFLY_VERSION: v1.2.0
steps:
- uses: actions/checkout@v2
- name: Install Hoverfly
uses: ./
with:
version: ${{ env.HOVERFLY_VERSION }}
runner_github_workspace_path: ${{ github.workspace }}
- name: Assert latest version installed
run: |
hoverfly -version ${{ env.ASSERT_VERSION }}
hoverctl version ${{ env.ASSERT_VERSION }}
install_fails_if_version_does_not_begin_with_v:
name: Install fails if version does not begin with v
runs-on: ubuntu-latest
env:
HOVERFLY_VERSION: "1.2.0"
steps:
- uses: actions/checkout@v2
- name: Install Hoverfly
uses: ./
with:
version: ${{ env.HOVERFLY_VERSION }}
runner_github_workspace_path: ${{ github.workspace }}
- name: Assert Hoverfly not installed
run: |
${{ env.ASSERT_HOVERFLY_NOT_INSTALLED }}
${{ env.ASSERT_HOVERCTL_NOT_INSTALLED }}
install_fails_if_no_runner_github_workspace_path:
name: Install fails when no runner GitHub workspace path provided
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Hoverfly
uses: ./
- name: Assert Hoverfly not installed
run: |
${{ env.ASSERT_HOVERFLY_NOT_INSTALLED }}
${{ env.ASSERT_HOVERCTL_NOT_INSTALLED }}
install_fails_if_incorrect_runner_github_workspace_path:
name: Install fails when incorrect runner GitHub workspace path provided
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Hoverfly
uses: ./
with: # Invalid runner_github_workspace_path (must be <dollarsign>{{ github.workspace}})
runner_github_workspace_path: /tmp
- name: Assert Hoverfly not installed
run: |
${{ env.ASSERT_HOVERFLY_NOT_INSTALLED }}
${{ env.ASSERT_HOVERCTL_NOT_INSTALLED }}
use_script_to_enable_https_simulations:
name: Enable https simulations
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Hoverfly
uses: ./
with:
runner_github_workspace_path: ${{ github.workspace }}
- name: Enable https calls to be simulated by Hoverfly
run: install-and-trust-hoverfly-default-cert.sh
- name: Verify that https calls can be simulated
run: |
hoverctl start
hoverctl mode capture
${{ env.EXAMPLE_HTTPS_PROXY_REQUEST }}
hoverctl mode simulate
${{ env.EXAMPLE_HTTPS_PROXY_REQUEST }}
hoverctl stop
https_simulations_do_not_work_without_https_script:
name: Verify https simulations will not work without script
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Hoverfly
uses: ./
with:
runner_github_workspace_path: ${{ github.workspace }}
# Commenting out the script, to verify https simulations fail without it
# - name: Enable https calls to be simulated by Hoverfly
# run: install-and-trust-hoverfly-default-cert.sh
- name: Verify that https calls cannot be simulated
run: |
hoverctl start
hoverctl mode capture
${{env.ASSERT_ERROR env.EXAMPLE_HTTPS_PROXY_REQUEST }}
hoverctl stop