integration/client: add tests for TaskOptions is not empty

Co-authored-by: Wei Fu <fuweid89@gmail.com>
Signed-off-by: Iceber Gu <caiwei95@hotmail.com>
This commit is contained in:
Iceber Gu
2025-03-26 15:00:08 +08:00
committed by k8s-infra-cherrypick-robot
parent 8a16a6a04a
commit 9f46e7a449
2 changed files with 142 additions and 0 deletions

View File

@@ -1090,6 +1090,19 @@ func TestContainerRuntimeOptionsv2(t *testing.T) {
if !strings.Contains(err.Error(), `"no-runc"`) {
t.Errorf("task creation should have failed because of lack of executable. Instead failed with: %v", err.Error())
}
// It doesn't matter what the NewTaskOpts function is. We are using an existing function in the client package,
// which will cause the TaskOptions in the new task request to be non-empty.
// https://github.com/containerd/containerd/issues/11568
task, err = container.NewTask(ctx, empty(), WithNoNewKeyring)
if err == nil {
t.Errorf("task creation should have failed")
task.Delete(ctx)
return
}
if !strings.Contains(err.Error(), `"no-runc"`) {
t.Errorf("task creation should have failed because of lack of executable. Instead failed with: %v", err.Error())
}
}
func TestContainerKillInitPidHost(t *testing.T) {