generated from actions/container-action
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add end-to-end tests The tests run the actual GitHub Action and then verify that Hoverfly and Hoverctl have been successfully installed, or not. This provides great end-to-end black box testing[1] coverage :-) GitHub Actions cannot be run locally[2], so that means that these tests cannot be run locally either. Instead, they run automatically as a GitHub Action themselves[3], triggered on every push. There is no need for a separate language for the tests - as we are running the actual GitHub Action we are able use the GitHub Action workflow syntax[4], which gives us what we need (e.g. expressions)[5] to write clean tests. [1] http://softwaretestingfundamentals.com/black-box-testing [2] https://github.community/t/can-i-run-github-actions-on-my-laptop/17019/2 [3] https://github.com/agilepathway/hoverfly-github-action/actions?query=workflow%3ATest [4] https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions [5] https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#about-contexts-and-expressions * Allow yaml lines of any length Lines of more than 80 characters were being flagged as an error. Sometimes longer lines are necessary (e.g. long URLs), so bumped the limit up to 120 characters and downgraded the alerts from error to warning.
- Loading branch information
Showing
4 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
--- | ||
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" | ||
|
||
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
extends: default | ||
|
||
rules: | ||
# 120 chars should be enough, but don't fail if a line is longer | ||
line-length: | ||
max: 120 | ||
level: warning |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters