mirror of
https://github.com/ahmetb/kubectx.git
synced 2025-09-01 00:27:47 +00:00
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>
This commit is contained in:
8
.travis.yml
Normal file
8
.travis.yml
Normal file
@@ -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/
|
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bats
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
COMMAND=../kubectx
|
COMMAND="$BATS_TEST_DIRNAME/../kubectx"
|
||||||
|
|
||||||
@test "--help should not fail" {
|
@test "--help should not fail" {
|
||||||
run ${COMMAND} --help
|
run ${COMMAND} --help
|
@@ -1,13 +1,15 @@
|
|||||||
#!/usr/bin/env bats
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
COMMAND=../kubens
|
COMMAND="${BATS_TEST_DIRNAME}/../kubens"
|
||||||
|
|
||||||
@test "--help should not fail" {
|
@test "--help should not fail" {
|
||||||
run ${COMMAND} --help
|
run ${COMMAND} --help
|
||||||
|
echo "$output">&2
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "-h should not fail" {
|
@test "-h should not fail" {
|
||||||
run ${COMMAND} -h
|
run ${COMMAND} -h
|
||||||
|
echo "$output">&2
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
}
|
}
|
Reference in New Issue
Block a user