mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-30 02:43:05 +00:00
tests(dsic): use string builder for cmd args
This commit is contained in:
parent
b3beb73f3f
commit
4f294c243c
1 changed files with 9 additions and 8 deletions
|
@ -135,14 +135,15 @@ func New(
|
||||||
opt(dsic)
|
opt(dsic)
|
||||||
}
|
}
|
||||||
|
|
||||||
cmdArgs := "--hostname=" + hostname
|
var cmdArgs strings.Builder
|
||||||
cmdArgs += " --certmode=manual"
|
fmt.Fprintf(&cmdArgs, "--hostname=%s", hostname)
|
||||||
cmdArgs += " --certdir=" + DERPerCertRoot
|
fmt.Fprintf(&cmdArgs, " --certmode=manual")
|
||||||
cmdArgs += " --a=:" + strconv.Itoa(dsic.derpPort)
|
fmt.Fprintf(&cmdArgs, " --certdir=%s", DERPerCertRoot)
|
||||||
cmdArgs += " --stun=true"
|
fmt.Fprintf(&cmdArgs, " --a=:%d", dsic.derpPort)
|
||||||
cmdArgs += " --stun-port=" + strconv.Itoa(dsic.stunPort)
|
fmt.Fprintf(&cmdArgs, " --stun=true")
|
||||||
|
fmt.Fprintf(&cmdArgs, " --stun-port=%d", dsic.stunPort)
|
||||||
if dsic.withVerifyClientURL != "" {
|
if dsic.withVerifyClientURL != "" {
|
||||||
cmdArgs += " --verify-client-url=" + dsic.withVerifyClientURL
|
fmt.Fprintf(&cmdArgs, " --verify-client-url=%s", dsic.withVerifyClientURL)
|
||||||
}
|
}
|
||||||
|
|
||||||
runOptions := &dockertest.RunOptions{
|
runOptions := &dockertest.RunOptions{
|
||||||
|
@ -150,7 +151,7 @@ func New(
|
||||||
Networks: []*dockertest.Network{dsic.network},
|
Networks: []*dockertest.Network{dsic.network},
|
||||||
ExtraHosts: dsic.withExtraHosts,
|
ExtraHosts: dsic.withExtraHosts,
|
||||||
// we currently need to give us some time to inject the certificate further down.
|
// we currently need to give us some time to inject the certificate further down.
|
||||||
Entrypoint: []string{"/bin/sh", "-c", "/bin/sleep 3 ; update-ca-certificates ; derper " + cmdArgs},
|
Entrypoint: []string{"/bin/sh", "-c", "/bin/sleep 3 ; update-ca-certificates ; derper " + cmdArgs.String()},
|
||||||
ExposedPorts: []string{
|
ExposedPorts: []string{
|
||||||
"80/tcp",
|
"80/tcp",
|
||||||
fmt.Sprintf("%d/tcp", dsic.derpPort),
|
fmt.Sprintf("%d/tcp", dsic.derpPort),
|
||||||
|
|
Loading…
Reference in a new issue