aboutsummaryrefslogtreecommitdiffstats
path: root/extras/hs-test/container.go
diff options
context:
space:
mode:
Diffstat (limited to 'extras/hs-test/container.go')
-rw-r--r--extras/hs-test/container.go24
1 files changed, 18 insertions, 6 deletions
diff --git a/extras/hs-test/container.go b/extras/hs-test/container.go
index 91ca2c2b0b1..cc2d441f7ec 100644
--- a/extras/hs-test/container.go
+++ b/extras/hs-test/container.go
@@ -84,6 +84,10 @@ func NewContainer(yamlInput ContainerConfig) (*Container, error) {
return container, nil
}
+func (c *Container) Suite() *HstSuite {
+ return c.suite
+}
+
func (c *Container) getWorkDirVolume() (res Volume, exists bool) {
for _, v := range c.volumes {
if v.isDefaultWorkDir {
@@ -227,14 +231,22 @@ func (c *Container) createFile(destFileName string, content string) error {
* Executes in detached mode so that the started application can continue to run
* without blocking execution of test
*/
-func (c *Container) execServer(command string) error {
- return exechelper.Run("docker exec -d" + c.getEnvVarsAsCliOption() + " " + c.name + " " + command)
+func (c *Container) execServer(command string, arguments ...any) {
+ serverCommand := fmt.Sprintf(command, arguments...)
+ containerExecCommand := "docker exec -d" + c.getEnvVarsAsCliOption() +
+ " " + c.name + " " + serverCommand
+ c.Suite().log(containerExecCommand)
+ c.Suite().assertNil(exechelper.Run(containerExecCommand))
}
-func (c *Container) exec(command string) (string, error) {
- cliCommand := "docker exec" + c.getEnvVarsAsCliOption() + " " + c.name + " " + command
- byteOutput, err := exechelper.CombinedOutput(cliCommand)
- return string(byteOutput), err
+func (c *Container) exec(command string, arguments ...any) string {
+ cliCommand := fmt.Sprintf(command, arguments...)
+ containerExecCommand := "docker exec" + c.getEnvVarsAsCliOption() +
+ " " + c.name + " " + cliCommand
+ c.Suite().log(containerExecCommand)
+ byteOutput, err := exechelper.CombinedOutput(containerExecCommand)
+ c.Suite().assertNil(err)
+ return string(byteOutput)
}
func (c *Container) execAction(args string) (string, error) {