Skip to content

Commit

Permalink
fix order of assignment to template
Browse files Browse the repository at this point in the history
  • Loading branch information
fionera committed Feb 18, 2024
1 parent 94d6979 commit 641a517
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions pkg/testutil/haproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,6 @@ func mustExecuteTemplate(t *testing.T, text string, data any) string {

func WithHAProxy(cfg HAProxyConfig, f func(t *testing.T)) func(t *testing.T) {
return func(t *testing.T) {
type tmplCfg struct {
HAProxyConfig

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
}
Expand All @@ -110,6 +101,15 @@ http-request return status 200 content-type "text/plain" string "Hello World!\n"
`
}

type tmplCfg struct {
HAProxyConfig

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", cfg.EngineConfig)
tcfg.EngineConfig = engineConfigFile
defer os.Remove(engineConfigFile)
Expand Down

0 comments on commit 641a517

Please sign in to comment.