Skip to content

Commit d8427fc

Browse files
committed
Adapt nerdtest to updated tigron
- Background() signature change - command creation change Signed-off-by: apostasie <[email protected]>
1 parent b7bc2b4 commit d8427fc

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

pkg/testutil/nerdtest/command.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"os/exec"
2222
"path/filepath"
2323
"testing"
24-
"time"
2524

2625
"gotest.tools/v3/assert"
2726

@@ -78,7 +77,10 @@ func newNerdCommand(conf test.Config, t *testing.T) *nerdCommand {
7877
}
7978

8079
// Create the base command, with the right binary, t
81-
ret := &nerdCommand{}
80+
ret := &nerdCommand{
81+
GenericCommand: *(test.NewGenericCommand().(*test.GenericCommand)),
82+
}
83+
8284
ret.WithBinary(binary)
8385
// Not interested in these - and insulate us from parent environment side effects
8486
ret.WithBlacklist([]string{
@@ -113,9 +115,9 @@ func (nc *nerdCommand) Run(expect *test.Expected) {
113115
nc.GenericCommand.Run(expect)
114116
}
115117

116-
func (nc *nerdCommand) Background(timeout time.Duration) {
118+
func (nc *nerdCommand) Background() {
117119
nc.prep()
118-
nc.GenericCommand.Background(timeout)
120+
nc.GenericCommand.Background()
119121
}
120122

121123
// Run does override the generic command run, as we are testing both docker and nerdctl

pkg/testutil/nerdtest/utilities_linux.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,18 @@ func RunSigProxyContainer(signal os.Signal, exitOnSignal bool, args []string, da
4747
trap sig_msg ` + sig + `
4848
printf "` + ready + `\n"
4949
while true; do
50-
sleep 0.1
50+
printf "waiting...\n"
51+
sleep 0.5
5152
done
5253
`
5354

5455
args = append(args, "--name", data.Identifier(), testutil.CommonImage, "sh", "-c", script)
5556
args = append([]string{"run"}, args...)
5657

5758
cmd := helpers.Command(args...)
58-
cmd.Background(10 * time.Second)
59+
// NOTE: because of a test like TestStopWithStopSignal, we need to wait enough for nerdctl to terminate the container
60+
cmd.WithTimeout(20 * time.Second)
61+
cmd.Background()
5962
EnsureContainerStarted(helpers, data.Identifier())
6063

6164
for {

0 commit comments

Comments
 (0)