Skip to content

Commit

Permalink
feat: add docs and entrypoint to skips
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentsenta committed Aug 21, 2023
1 parent e228e9e commit 77c35d1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
17 changes: 16 additions & 1 deletion .github/actions/test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ inputs:
description: "A comma-separated list of specs to be tested. Accepts a spec (test only this spec), a +spec (test also this immature spec), or a -spec (do not test this mature spec)."
required: false
default: ""
skips:
description: "A json array of regexp to skip tests."
required: false
default: ""
args:
description: "[DANGER] The `args` input allows you to pass custom, free-text arguments directly to the Go test command that the tool employs to execute tests."
required: false
Expand All @@ -33,19 +37,30 @@ runs:
steps:
- id: github
uses: pl-strflt/docker-container-action/.github/actions/github@v1
- id: prepare-args
shell: bash
env:
SKIPS: ${{ inputs.skips }}
run: |
SKIPS_ARGS=""
if [ -n "$SKIPS" ]; then
SKIPS_ARGS=$(echo "$SKIPS" | jq -r '.[]' | sed -e 's/^/--skip="/' -e 's/$/"/' | paste -s -d ' ' -)
fi
echo "SKIPS_ARGS=$SKIPS_ARGS" >> $GITHUB_OUTPUT
- name: Run the test
uses: pl-strflt/docker-container-action@v1
env:
URL: ${{ inputs.gateway-url }}
SUBDOMAIN: ${{ inputs.subdomain-url }}
JSON: ${{ inputs.json }}
SPECS: ${{ inputs.specs }}
SKIPS: ${{ prepare-args.outputs.SKIPS_ARGS }}
with:
repository: ${{ steps.github.outputs.action_repository }}
ref: ${{ steps.github.outputs.action_sha || steps.github.outputs.action_ref }}
dockerfile: Dockerfile
opts: --network=host
args: test --url="$URL" --json="$JSON" --specs="$SPECS" --subdomain-url="$SUBDOMAIN" -- ${{ inputs.args }}
args: test --url="$URL" --json="$JSON" --specs="$SPECS" ${SKIPS} --subdomain-url="$SUBDOMAIN" -- ${{ inputs.args }}
build-args: |
VERSION:${{ steps.github.outputs.action_ref }}
- name: Create the XML
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
### Added
- `--version` flag shows the current version
- `--skip` parameter to skip one or more tests.
- Metadata logging used to associate tests with custom data like versions, specs identifiers, etc.

## [0.3.0] - 2023-07-31
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ The `test` command is the main command of the tool. It is used to test a given I
| html | GitHub Action | The path where the one-page HTML test report should be generated. | `./report.html` |
| markdown | GitHub Action | The path where the summary Markdown test report should be generated. | `./report.md` |
| specs | Both | A comma-separated list of specs to be tested. Accepts a spec (test only this spec), a +spec (test also this immature spec), or a -spec (do not test this mature spec). | Mature specs only |
| skip | Both | Run only the those tests that do not match the regular expression. Similar to golang's skip, the expression is split by slash (/) into a sequence and each part must match the corresponding part in the test name, if any | empty |
| args | Both | [DANGER] The `args` input allows you to pass custom, free-text arguments directly to the Go test command that the tool employs to execute tests. | N/A |

##### Specs
Expand Down Expand Up @@ -79,6 +80,7 @@ A few examples:
markdown: report.md
html: report.html
args: -timeout 30m
skips: '["TestGatewaySubdomains", "TestGatewayCar/GET_response_for_application/.*/Header_Content-Length"]'
```
##### Docker
Expand Down Expand Up @@ -235,10 +237,11 @@ gateway-conformance test --specs trustless-gateway,-trustless-gateway-ipns

### Skip a specific test

Tests are skipped using Go's standard syntax:
Tests are skipped using the `--skip` parameter and Go's standard syntax:

```bash
gateway-conformance test -skip 'TestGatewayCar/GET_response_for_application/vnd.ipld.car/Header_Content-Length'
gateway-conformance test --skip 'TestGatewayCar/GET_response_for_application/vnd.ipld.car/Header_Content-Length'
gateway-conformance test --skip 'TestGatewayCar/.*/vnd.ipld.car' --skip 'TestGatewayCar/GET_response_for_application/vnd.*'
```

### Extracting the test fixtures
Expand Down

0 comments on commit 77c35d1

Please sign in to comment.