-
Notifications
You must be signed in to change notification settings - Fork 24
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
Thomas Anagrius
committed
Sep 25, 2020
1 parent
e48c9f0
commit f4cda85
Showing
5 changed files
with
102 additions
and
14 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 @@ | ||
eyJhbGciOiJFUzI1NiJ9.eyJhdWQiOiJIdW1pby1saWNlbnNlLWNoZWNrIiwic3ViIjoiT25QcmVtIEV4cGlyZWQgTGljZW5zZSAoREVWKSIsInVpZCI6InA0aTNXQzBsckR6ZSIsIm1heFVzZXJzIjoxMCwiYWxsb3dTQUFTIjpmYWxzZSwibWF4Q29yZXMiOjUxMiwidmFsaWRVbnRpbCI6MTYwMDk4MjQ5MiwiZXhwIjoxNjk1Njc2ODkzLCJpYXQiOjE1OTMyOTI4OTIsIm1heEluZ2VzdEdiUGVyRGF5Ijo1fQ.MEUCIQCSUfwUPEQ6wvcmTh1L3ImnPkj3i6o43UP3-eDFSF5wJgIgHqK3m0eSMq49Lep4mLbQr0zbuX6AkjCDwcRmkzGfKA8 |
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 @@ | ||
eyJhb2ciOiJFUzI1NiJ9.eyJhdWQiOiJIdW1pby1saWNlbnNlLWNoZWNrIiwic3ViIjoiT25QcmVtIEV4cGlyZWQgTGljZW5zZSAoREVWKSIsInxpZCI6InA0aTNXQzBsckR6ZSIsIm1heFVzZXJzIjoxMCwiYWxsb3dTQUFTIjpmYWxzZSwibWF4Q29yZXMiOjUxMiwidmFsaWRVbnRpbCI6MTYwMDk4MjQ5MiwiZXhwIjoxNjk1Njc2ODkzLCJpYXQiOjE1OTMyOTI4OTIsIm1heEluZ2VzdEdiUGVyRGF5Ijo1fQ.MEUCIQCSUfwUPEQ6wvcmTh1L3ImnPkj3i6o43UP3-eDFSF5wJgIgHqK3m0eSMq49Lep4mLbQr0zbuX6AkjCDwcRmkzzfKA8 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -2,32 +2,35 @@ | |
|
||
humioctl="$BATS_TEST_DIRNAME/../bin/humioctl --address=http://localhost:8081/" | ||
|
||
load './node_modules/bats-support/load' | ||
load './node_modules/bats-assert/load' | ||
|
||
## Health Commands | ||
|
||
@test "health" { | ||
$humioctl health | ||
run $humioctl health | ||
} | ||
|
||
## Cluster Commands | ||
|
||
@test "cluster nodes list" { | ||
run $humioctl cluster nodes list | ||
grep "localhost:8080" <<< "$output" | ||
assert_output -p "localhost:8080" | ||
} | ||
|
||
@test "cluster nodes show" { | ||
run $humioctl cluster nodes show 1 | ||
[[ "$status" -eq 0 ]] | ||
grep "UUID" <<< "$output" | ||
assert_success | ||
assert_output -p "UUID" | ||
} | ||
|
||
## View Commands | ||
|
||
@test "views list" { | ||
run $humioctl views list | ||
[[ "$status" -eq 0 ]] | ||
grep "humio-audit" <<< "$output" | ||
grep "sandbox" <<< "$output" | ||
assert_success | ||
assert_output -p "humio-audit" | ||
assert_output -p "sandbox" | ||
} | ||
|
||
@test "views show" { | ||
|
@@ -36,15 +39,15 @@ humioctl="$BATS_TEST_DIRNAME/../bin/humioctl --address=http://localhost:8081/" | |
|
||
@test "views show <unknown>" { | ||
run $humioctl views show foo | ||
[[ "$status" -eq 1 ]] | ||
assert_failure 1 | ||
} | ||
|
||
## User Commands | ||
|
||
@test "users show" { | ||
run $humioctl users list | ||
[[ "$status" -eq 0 ]] | ||
grep "developer" <<< "$output" | ||
run $humioctl users show developer | ||
assert_success | ||
assert_output -p "developer" | ||
} | ||
|
||
@test "users add" { | ||
|
@@ -53,8 +56,85 @@ humioctl="$BATS_TEST_DIRNAME/../bin/humioctl --address=http://localhost:8081/" | |
|
||
@test "users add <already exists>" { | ||
run $humioctl users add --email "[email protected]" --root true --name "Peter" peter | ||
[[ "$status" -eq 0 ]] | ||
assert_success | ||
|
||
run $humioctl users add --email "[email protected]" --root true --name "Peter" peter | ||
[[ "$status" -eq 1 ]] | ||
} | ||
assert_failure 1 | ||
} | ||
|
||
@test "users list" { | ||
run $humioctl users add --email "[email protected]" --root false --name "Jens" jens | ||
assert_success | ||
|
||
run $humioctl users list | ||
assert_success | ||
assert_output -p "Jens" | ||
} | ||
|
||
@test "users update" { | ||
$humioctl users add --email "[email protected]" --name "Odin" odin | ||
$humioctl users update --name 'Othello' odin | ||
|
||
run $humioctl users show odin | ||
|
||
assert_success | ||
assert_output -p 'Othello' | ||
} | ||
|
||
# Status Commands | ||
|
||
@test "status" { | ||
run $humioctl status | ||
assert_success | ||
assert_output -p 'Version' | ||
} | ||
|
||
# License Commands | ||
|
||
@test "license install" { | ||
skip # TODO: This fails in the test build susseeds with manual tests. | ||
# we keep getting 'error installing license: Invalid input' in the test. | ||
# Why is that? | ||
|
||
# Humio will accept an expired license, but limit usage. | ||
run $humioctl license install "$BATS_TEST_DIRNAME/licenses/expired.pem" | ||
assert_success | ||
assert_output "OK" | ||
} | ||
|
||
@test "license install <invalid license>" { | ||
run $humioctl license install "$BATS_TEST_DIRNAME/licenses/invalid.pem" | ||
assert_failure | ||
} | ||
|
||
@test "license show" { | ||
$humioctl license show | ||
} | ||
|
||
# Alerts | ||
|
||
@test "alerts list" { | ||
$humioctl alerts list humio | ||
} | ||
|
||
# Notifiers | ||
|
||
@test "notifiers list" { | ||
$humioctl alerts list humio | ||
} | ||
|
||
# Ingest Token Commands | ||
|
||
@test "ingest-tokens add" { | ||
run $humioctl ingest-tokens add humio "test123" --parser "kv" | ||
assert_success | ||
assert_output -p "test123" | ||
assert_output -p "kv" | ||
} | ||
|
||
@test "ingest-tokens list" { | ||
$humioctl ingest-tokens add humio "foo" | ||
run $humioctl ingest-tokens list humio | ||
assert_success | ||
assert_output -p "Assigned Parser" | ||
} |