-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(tests): refactor testscript tests
- Loading branch information
Showing
86 changed files
with
249 additions
and
185 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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,12 @@ | ||
# Passing --debug enables Gin debug mode | ||
|
||
exec sh -ex ./test.sh & | ||
karma.bin-should-work --pid-file=karma.pid --log.format=text --log.config=false --debug --alertmanager.uri=http://localhost --listen.address=127.0.0.1 --listen.port=8035 | ||
stdout '\[GIN-debug\] \[WARNING\] Running in "debug" mode. Switch to "release" mode in production.' | ||
|
||
-- test.sh -- | ||
#!/bin/sh | ||
|
||
while [ ! -f karma.pid ]; do sleep 1 ; done | ||
sleep 1 | ||
cat karma.pid | xargs kill |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...t/invalid_config_alertmanager_timeout.txt → ...2_invalid_config_alertmanager_timeout.txt
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
59 changes: 59 additions & 0 deletions
59
cmd/karma/tests/testscript/061_log_full_config_file_invalid_values.txt
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,59 @@ | ||
# Print out and compare logged config set via config file that includes invalid values | ||
karma.bin-should-fail-no-timestamp --config.file=karma.yaml --check-config | ||
! stdout . | ||
stderr 'Failed to unmarshal configuration: 12 error\(s\) decoding:' | ||
|
||
-- karma.yaml -- | ||
alertmanager: | ||
interval: jjs88 | ||
servers: | ||
- name: ha1 | ||
uri: "http://localhost:9093" | ||
timeout: bbb | ||
proxy: YEs | ||
cors: | ||
credentials: foo | ||
- name: ha2 | ||
uri: "http://localhost:9094" | ||
timeout: 11 | ||
readonly: 1 | ||
- name: local | ||
uri: http://localhost:9095 | ||
timeout: z | ||
proxy: true | ||
readonly: 0 | ||
headers: | ||
- X-Auth-Test=some-token-or-other-string | ||
- name: client-auth | ||
uri: https://localhost:9096 | ||
timeout: 10s | ||
tls: | ||
ca: ca.pem | ||
cert: cert.pem | ||
key: key.pem | ||
alertAcknowledgement: | ||
enabled: zzz | ||
duration: 7m0s | ||
author: karma | ||
commentPrefix: ACK! | ||
annotations: | ||
default: | ||
hidden: z | ||
hidden: {} | ||
visible: | ||
- visible | ||
filters: | ||
default: [] | ||
karma: | ||
name: karma-demo | ||
log: | ||
level: 123 | ||
format: foo | ||
ui: | ||
refresh: 10sm | ||
hideFiltersWhenIdle: z | ||
colorTitlebar: yum | ||
theme: x | ||
minimalGroupWidth: abc4 | ||
alertsPerGroup: 5a | ||
collapseGroups: collapsedOanMobile |
File renamed without changes.
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,4 @@ | ||
# Errors when config.file points to missing file | ||
karma.bin-should-fail --config.file=404.yaml | ||
! stdout . | ||
stderr 'msg="Failed to load configuration file \\"404.yaml\\": open 404.yaml: no such file or directory' |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,23 @@ | ||
# Configures sentry when enabled | ||
|
||
exec sh -ex ./test.sh & | ||
karma.bin-should-work --pid-file=karma.pid --log.format=text --log.config=true --config.file=karma.yaml --listen.address=127.0.0.1 --listen.port=8068 | ||
! stdout . | ||
stderr 'msg=" private: secret"' | ||
stderr 'msg=" public: \\"123456789\\""' | ||
|
||
-- karma.yaml -- | ||
alertmanager: | ||
servers: | ||
- name: default | ||
uri: http://localhost:9093 | ||
sentry: | ||
private: secret | ||
public: 123456789 | ||
|
||
-- test.sh -- | ||
#!/bin/sh | ||
|
||
while [ ! -f karma.pid ]; do sleep 1 ; done | ||
sleep 1 | ||
cat karma.pid | xargs kill |
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,13 @@ | ||
# Works in simple mode when single --alertmanager.uri flag is passed | ||
|
||
exec sh -ex ./test.sh & | ||
karma.bin-should-work --pid-file=karma.pid --log.format=text --log.config=false --alertmanager.uri=http://localhost --listen.address=127.0.0.1 --listen.port=8069 | ||
! stdout . | ||
stderr 'msg="\[default\] Configured Alertmanager source at http://localhost \(proxied: false\, readonly: false\)"' | ||
|
||
-- test.sh -- | ||
#!/bin/sh | ||
|
||
while [ ! -f karma.pid ]; do sleep 1 ; done | ||
sleep 1 | ||
cat karma.pid | xargs kill |
File renamed without changes.
File renamed without changes.
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,5 @@ | ||
# Fails is we cannot write a PID file | ||
|
||
karma.bin-should-fail --pid-file=/foo/bar/karma.pid --log.format=text --log.config=false --alertmanager.uri=http://localhost | ||
! stdout . | ||
stderr 'msg="Failed to write a PID 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,15 @@ | ||
# Fails is we cannot remove a PID file | ||
|
||
exec sh -ex ./test.sh & | ||
karma.bin-should-fail --pid-file=karma.pid --log.format=text --log.config=false --alertmanager.uri=http://localhost --listen.address=127.0.0.1 --listen.port=8073 | ||
! stdout . | ||
stderr 'msg="Failed to remove PID file:' | ||
|
||
-- test.sh -- | ||
#!/bin/sh | ||
|
||
while [ ! -f karma.pid ]; do sleep 1 ; done | ||
sleep 1 | ||
PID=$(cat karma.pid) | ||
rm karma.pid | ||
kill $PID |
This file was deleted.
Oops, something went wrong.
67 changes: 0 additions & 67 deletions
67
cmd/karma/tests/testscript/log_full_config_file_invalid_values.txt
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.