Describe the bug
CNTR-1 test 'StartWithNonExistentPluginImage' fails if device is returning NotFound as status code when we try to start non-existent plugin image.
To Reproduce
Steps to reproduce the behavior:
- Setup device for CNTR-1 test
- Run the test
- test 'StartWithNonExistentPluginImage' will fail if device is returning NotFound as status code.
Expected behavior
Test should PASS if device is returning 'NotFound' status code.
Logs
=== RUN TestPlugins/StartWithNonExistentPluginImage
containerz_test.go:858: Got expected error when starting with non-existent image "non-existent-plugin-image": rpc error: code = NotFound desc = error on request {
name: "non-existent-plugin-image"
instance_name: "test-instance-non-existent-image"
config: "{"description":"dummy"}"
}: Plugin image file not found
containerz_test.go:861: Expected gRPC status code Unknown or NotFound for non-existent image, got: rpc error: code = NotFound desc = error on request {
name: "non-existent-plugin-image"
instance_name: "test-instance-non-existent-image"
config: "{"description":"dummy"}"
}: Plugin image file not found (status code: NotFound)
.
.
.
--- FAIL: TestPlugins (40.07s)
--- PASS: TestPlugins/SuccessfulPluginCompleteLifecycle (13.90s)
--- FAIL: TestPlugins/StartWithNonExistentPluginImage (0.03s)
--- PASS: TestPlugins/StartAlreadyStartedInstance (26.14s)
FAIL
Network device platform (please complete the following information):
Additional context
The issue is not seen when I make following changes to line number 860 of containerz_test.go to replace codes.FailedPrecondition with codes.NotFound
Original code:
} else {
t.Logf("Got expected error when starting with non-existent image %q: %v", pluginName, err)
s, ok := status.FromError(err)
if !ok || (s.Code() != codes.Unknown && s.Code() != codes.FailedPrecondition) {
t.Errorf("Expected gRPC status code Unknown or NotFound for non-existent image, got: %v (status code: %s)", err, s.Code())
}
}
Modified code:
} else {
t.Logf("Got expected error when starting with non-existent image %q: %v", pluginName, err)
s, ok := status.FromError(err)
if !ok || (s.Code() != codes.Unknown && s.Code() != codes.NotFound) {
t.Errorf("Expected gRPC status code Unknown or NotFound for non-existent image, got: %v (status code: %s)", err, s.Code())
}
}
Describe the bug
CNTR-1 test 'StartWithNonExistentPluginImage' fails if device is returning NotFound as status code when we try to start non-existent plugin image.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Test should PASS if device is returning 'NotFound' status code.
Logs
=== RUN TestPlugins/StartWithNonExistentPluginImage
containerz_test.go:858: Got expected error when starting with non-existent image "non-existent-plugin-image": rpc error: code = NotFound desc = error on request {
name: "non-existent-plugin-image"
instance_name: "test-instance-non-existent-image"
config: "{"description":"dummy"}"
}: Plugin image file not found
containerz_test.go:861: Expected gRPC status code Unknown or NotFound for non-existent image, got: rpc error: code = NotFound desc = error on request {
name: "non-existent-plugin-image"
instance_name: "test-instance-non-existent-image"
config: "{"description":"dummy"}"
}: Plugin image file not found (status code: NotFound)
.
.
.
--- FAIL: TestPlugins (40.07s)
--- PASS: TestPlugins/SuccessfulPluginCompleteLifecycle (13.90s)
--- FAIL: TestPlugins/StartWithNonExistentPluginImage (0.03s)
--- PASS: TestPlugins/StartAlreadyStartedInstance (26.14s)
FAIL
Network device platform (please complete the following information):
https://github.com/openconfig/featureprofiles/blob/main/feature/container/containerz/tests/container_lifecycle/containerz_test.go
Additional context
The issue is not seen when I make following changes to line number 860 of containerz_test.go to replace codes.FailedPrecondition with codes.NotFound
Original code:
} else {
t.Logf("Got expected error when starting with non-existent image %q: %v", pluginName, err)
s, ok := status.FromError(err)
if !ok || (s.Code() != codes.Unknown && s.Code() != codes.FailedPrecondition) {
t.Errorf("Expected gRPC status code Unknown or NotFound for non-existent image, got: %v (status code: %s)", err, s.Code())
}
}
Modified code:
} else {
t.Logf("Got expected error when starting with non-existent image %q: %v", pluginName, err)
s, ok := status.FromError(err)
if !ok || (s.Code() != codes.Unknown && s.Code() != codes.NotFound) {
t.Errorf("Expected gRPC status code Unknown or NotFound for non-existent image, got: %v (status code: %s)", err, s.Code())
}
}