Skip to content

CNTR-1 test StartWithNonExistentPluginImage fails as status code expected is not correct #5269

@prathapcv

Description

@prathapcv

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:

  1. Setup device for CNTR-1 test
  2. Run the test
  3. 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())
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions