Merge pull request #1369 from prymitive/scriptests

fix(tests): more test coverage for main()
This commit is contained in:
Łukasz Mierzwa
2020-01-23 22:06:42 +00:00
committed by GitHub
4 changed files with 33 additions and 0 deletions

3
cmd/karma/testdata/debug.txt vendored Normal file
View File

@@ -0,0 +1,3 @@
# Passing --debug enables Gin debug mode
karma.bin-should-work --log.format=text --log.config=false --debug --alertmanager.uri=http://localhost
stdout '\[GIN-debug\] \[WARNING\] Running in "debug" mode. Switch to "release" mode in production.'

View File

@@ -0,0 +1,11 @@
# Raises an error if proxy config is invalid
karma.bin-should-fail --log.format=text --log.config=false --log.level=error --config.file=karma.yaml
! stdout .
stderr 'msg="Failed to create Alertmanager ''proxied'' with URI ''httpz://localhost'': unsupported URI scheme ''httpz'' in ''httpz://localhost''"'
-- karma.yaml --
alertmanager:
servers:
- name: proxied
uri: httpz://localhost
proxy: true

14
cmd/karma/testdata/sentry.txt vendored Normal file
View File

@@ -0,0 +1,14 @@
# Configures sentry when enabled
karma.bin-should-work --log.format=text --log.config=true --config.file=karma.yaml
! stdout .
stderr 'msg=" private: secret"'
stderr 'msg=" public: \\"123456789\\""'
-- karma.yaml --
alertmanager:
servers:
- name: default
uri: http://localhost:9093
sentry:
private: secret
public: 123456789

5
cmd/karma/testdata/simple_config.txt vendored Normal file
View File

@@ -0,0 +1,5 @@
# Works in simple mode when single --alertmanager.uri flag is passed
karma.bin-should-work --log.format=text --log.config=false --alertmanager.uri=http://localhost
! stdout .
stderr 'msg="Using simple config with a single Alertmanager server"'
stderr 'msg="\[default\] Configured Alertmanager source at http://localhost \(proxied: false\)"'