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 0833c29
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 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,14 +93,17 @@ 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)

engineConfigFile := TempFile(t, "e2e.cfg", haproxyEngineConfig)
if cfg.EngineConfig == "" {
cfg.EngineConfig = haproxyEngineConfig
}

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

Expand Down

0 comments on commit 0833c29

Please sign in to comment.