Skip to content

Commit

Permalink
test: fix missing ipc-file tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kpetremann committed Jul 8, 2023
1 parent 7146756 commit 6cffd35
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions cmd/salt-exporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/google/go-cmp/cmp"
"github.com/kpetremann/salt-exporter/internal/metrics"
"github.com/kpetremann/salt-exporter/pkg/listener"
"github.com/spf13/viper"
)

Expand All @@ -26,6 +27,7 @@ func TestReadConfigFlagOnly(t *testing.T) {
LogLevel: defaultLogLevel,
ListenAddress: "127.0.0.1",
ListenPort: 8080,
IPCFile: listener.DefaultIPCFilepath,
TLS: struct {
Enabled bool
Key string
Expand Down Expand Up @@ -102,6 +104,7 @@ func TestReadConfigFlagOnly(t *testing.T) {
flags: []string{
"-host=127.0.0.1",
"-port=8080",
"-ipc-file=/dev/null",
"-health-minions=false",
"-health-functions-filter=test.sls",
"-health-states-filter=nop",
Expand All @@ -115,6 +118,7 @@ func TestReadConfigFlagOnly(t *testing.T) {
LogLevel: defaultLogLevel,
ListenAddress: "127.0.0.1",
ListenPort: 8080,
IPCFile: "/dev/null",
TLS: struct {
Enabled bool
Key string
Expand Down Expand Up @@ -223,6 +227,7 @@ func TestConfigFileOnly(t *testing.T) {
LogLevel: "info",
ListenAddress: "127.0.0.1",
ListenPort: 2113,
IPCFile: "/dev/null",
TLS: struct {
Enabled bool
Key string
Expand Down Expand Up @@ -320,6 +325,7 @@ func TestConfigFileWithFlags(t *testing.T) {
"-health-functions-filter=test.sls",
"-health-states-filter=nop",
"-ignore-mock",
"-ipc-file=/somewhere",
}

os.Args = append([]string{name}, flags...)
Expand All @@ -331,6 +337,7 @@ func TestConfigFileWithFlags(t *testing.T) {
LogLevel: "info",
ListenAddress: "127.0.0.1",
ListenPort: 8080,
IPCFile: "/somewhere",
TLS: struct {
Enabled bool
Key string
Expand Down
3 changes: 2 additions & 1 deletion cmd/salt-exporter/config_test.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
listen-address: "127.0.0.1"
listen-port: 2113

ipc-file: /dev/null

log-level: "info"
tls:
enabled: true
key: "/path/to/key"
certificate: "/path/to/certificate"


metrics:
global:
filters:
Expand Down

0 comments on commit 6cffd35

Please sign in to comment.