-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
568 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -30,3 +30,5 @@ jobs: | |
fail_ci_if_error: true | ||
- name: Build | ||
run: make build | ||
- name: Test CLI | ||
run: make test-cli |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# CLI tests | ||
|
||
This suite of tests is not intended to do complex integration tests, but simple | ||
unit-test like tests of the CLI flags. Testing allowed inputs, flag-combinations, etc. | ||
|
||
## Running all tests | ||
Using the `Makefile`; | ||
``` | ||
make test-cli | ||
``` | ||
or directly; | ||
``` | ||
tests/cli/test.sh --suite "decK-cli test suite" | ||
``` | ||
|
||
## Running a single file | ||
``` | ||
tests/cli/mytestfile.test.sh | ||
``` | ||
## Create a new test-file | ||
To create a new testfile run: | ||
|
||
```shell | ||
tests/cli/test.sh --create tests/cli/mytestfile "decK-cli test suite" | ||
``` | ||
|
||
instructions will be in the generated file. |
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,41 @@ | ||
--- | ||
openapi: 3.1.0 | ||
|
||
info: | ||
description: Mock service for a popular song in the 90s | ||
version: 0.0.1 | ||
title: Mock-a-rena | ||
contact: | ||
name: Los del Rio | ||
|
||
servers: | ||
- url: https://mockbin.org/requests | ||
description: Mock-a-rena service | ||
|
||
tags: | ||
- name: mock | ||
description: Hey.... mock-a-rena! | ||
- name: a-rena | ||
description: tag-arena | ||
|
||
paths: | ||
"/mock": | ||
get: | ||
summary: Mock, mock, mock, mock-a-rena | ||
description: yeah yeah | ||
operationId: mock | ||
tags: | ||
- mock | ||
responses: | ||
'200': | ||
description: Success | ||
"/a-rena": | ||
get: | ||
summary: hey hey | ||
description: a-rena-description | ||
operationId: a-rena | ||
tags: | ||
- marena | ||
responses: | ||
'200': | ||
description: success |
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,42 @@ | ||
#!/usr/bin/env bash | ||
|
||
|
||
function run_test { | ||
# the suite name below will only be used when running this file directly, when | ||
# running through "test.sh" it must be provided using the "--suite" option. | ||
tinitialize "decK-cli test suite" "${BASH_SOURCE[0]}" | ||
|
||
tchapter "deck file openapi2kong" | ||
|
||
ttest "accepts format 'json'" | ||
./deck file openapi2kong --format json > /dev/null < tests/cli/fixtures/mock-a-rena-oas.yml | ||
if [ $? -ne 0 ]; then | ||
tfailure "--format=json was not accepted" | ||
else | ||
tsuccess | ||
fi | ||
|
||
ttest "accepts format 'yaml'" | ||
./deck file openapi2kong --format yaml > /dev/null < tests/cli/fixtures/mock-a-rena-oas.yml | ||
if [ $? -ne 0 ]; then | ||
tfailure "--format=yaml was not accepted" | ||
else | ||
tsuccess | ||
fi | ||
|
||
ttest "--format has a default value" | ||
./deck file openapi2kong > /dev/null < tests/cli/fixtures/mock-a-rena-oas.yml | ||
if [ $? -ne 0 ]; then | ||
tfailure "unspecified --format was not accepted" | ||
else | ||
tsuccess | ||
fi | ||
|
||
tfinish | ||
} | ||
|
||
# No need to modify anything below this comment | ||
|
||
# shellcheck disable=SC1090 # do not follow source | ||
[[ "$T_PROJECT_NAME" == "" ]] && set -e && if [[ -f "${1:-$(dirname "$(realpath "$0")")/test.sh}" ]]; then source "${1:-$(dirname "$(realpath "$0")")/test.sh}"; else source "${1:-$(dirname "$(realpath "$0")")/run.sh}"; fi && set +e | ||
run_test |
Oops, something went wrong.