diff --git a/integration/control.go b/integration/control.go index 58a4661f..33a687c0 100644 --- a/integration/control.go +++ b/integration/control.go @@ -6,6 +6,7 @@ import ( type ControlServer interface { Shutdown() error + Execute(command []string) (string, error) GetHealthEndpoint() string GetEndpoint() string WaitForReady() error diff --git a/integration/hsic/hsic.go b/integration/hsic/hsic.go index a6372a5a..7db8233a 100644 --- a/integration/hsic/hsic.go +++ b/integration/hsic/hsic.go @@ -103,6 +103,29 @@ func (t *HeadscaleInContainer) Shutdown() error { return t.pool.Purge(t.container) } +func (t *HeadscaleInContainer) Execute( + command []string, +) (string, error) { + log.Println("command", command) + log.Printf("running command for %s\n", t.hostname) + stdout, stderr, err := dockertestutil.ExecuteCommand( + t.container, + command, + []string{}, + ) + if err != nil { + log.Printf("command stderr: %s\n", stderr) + + return "", err + } + + if stdout != "" { + log.Printf("command stdout: %s\n", stdout) + } + + return stdout, nil +} + func (t *HeadscaleInContainer) GetIP() string { return t.container.GetIPInNetwork(t.network) }