Skip to content

Commit

Permalink
allow tests to have custom spop engine configs
Browse files Browse the repository at this point in the history
  • Loading branch information
fionera committed Feb 17, 2024
1 parent ac05ebd commit cc133ff
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/testutil/haproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ spoe-message e2e-res

type HAProxyConfig struct {
EngineAddr string
EngineConfig string
FrontendPort string
CustomFrontendConfig string
CustomBackendConfig string
Expand All @@ -92,13 +93,16 @@ func WithHAProxy(cfg HAProxyConfig, f func(t *testing.T)) func(t *testing.T) {
type tmplCfg struct {
HAProxyConfig

EngineConfig string
StatsSocket string
StatsSocket string
}
var tcfg tmplCfg
tcfg.HAProxyConfig = cfg
tcfg.StatsSocket = fmt.Sprintf("%s/stats%s.sock", os.TempDir(), tcfg.FrontendPort)

if cfg.EngineConfig == "" {
cfg.EngineConfig = haproxyEngineConfig
}

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

0 comments on commit cc133ff

Please sign in to comment.