-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: enable travis-ci with bats (#108)
- add .travis.yml. - move bats fixtures to .bats extension, since it allows detection of test files automatically by file extension. - use BATS_TEST_DIRNAME variable to compute location of COMMAND. - IMPORTANT: use `echo "$output">&2` before final check so that we can debug the test cases by their output Ref #2. Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
- Loading branch information
Showing
3 changed files
with
12 additions
and
2 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,8 @@ | ||
before_install: | ||
- sudo add-apt-repository ppa:duggan/bats --yes | ||
- sudo apt-get update -qq | ||
- sudo apt-get install -qq bats | ||
- sudo curl -fsSL -o /usr/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v1.13.1/bin/linux/amd64/kubectl | ||
- sudo chmod +x /usr/bin/kubectl | ||
script: | ||
- bats test/ |
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 |
---|---|---|
@@ -1,13 +1,15 @@ | ||
#!/usr/bin/env bats | ||
|
||
COMMAND=../kubens | ||
COMMAND="${BATS_TEST_DIRNAME}/../kubens" | ||
|
||
@test "--help should not fail" { | ||
run ${COMMAND} --help | ||
echo "$output">&2 | ||
[ "$status" -eq 0 ] | ||
} | ||
|
||
@test "-h should not fail" { | ||
run ${COMMAND} -h | ||
echo "$output">&2 | ||
[ "$status" -eq 0 ] | ||
} |