Skip to content

Commit

Permalink
allow tests to have custom backend configs
Browse files Browse the repository at this point in the history
  • Loading branch information
fionera committed Feb 18, 2024
1 parent 0833c29 commit 94d6979
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/testutil/haproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ backend backend
{{ .CustomBackendConfig }}
http-request return status 200 content-type "text/plain" string "Hello World!\n"
{{ .BackendConfig }}
backend e2e-spoa
mode tcp
Expand Down Expand Up @@ -71,6 +71,7 @@ type HAProxyConfig struct {
EngineConfig string
FrontendPort string
CustomFrontendConfig string
BackendConfig string
CustomBackendConfig string
}

Expand Down Expand Up @@ -103,6 +104,12 @@ func WithHAProxy(cfg HAProxyConfig, f func(t *testing.T)) func(t *testing.T) {
cfg.EngineConfig = haproxyEngineConfig
}

if cfg.BackendConfig == "" {
cfg.BackendConfig = `
http-request return status 200 content-type "text/plain" string "Hello World!\n"
`
}

engineConfigFile := TempFile(t, "e2e.cfg", cfg.EngineConfig)
tcfg.EngineConfig = engineConfigFile
defer os.Remove(engineConfigFile)
Expand Down

0 comments on commit 94d6979

Please sign in to comment.