Skip to content

Test

Test #789

Workflow file for this run

---
name: Test
on: # yamllint disable-line rule:truthy
pull_request:
types:
- opened
- edited
- reopened
- synchronize
push:
# Run the tests at 3am every night
schedule:
- cron: '0 3 * * *' # * is a special character in YAML so you have to quote this string
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/[email protected]
- name: Install Hoverfly
uses: ./
with:
runner_github_workspace_path: ${{ github.workspace }}
- name: Assert latest version installed
env:
HOVERFLY_VERSION: "v1.11.3"
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/[email protected]
- 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/[email protected]
- 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/[email protected]
- 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/[email protected]
- 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/[email protected]
- 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/[email protected]
- 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