Skip to content

Commit

Permalink
Minor fix in TestSomething test
Browse files Browse the repository at this point in the history
Signed-off-by: Eugen Sumin <[email protected]>
  • Loading branch information
e-sumin committed Nov 29, 2024
1 parent 0a4cbd6 commit 672e66d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/kube/pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1246,13 +1246,14 @@ func (s *PodSuite) TestAddAnnotations(c *check.C) {
}
}

func (s *PodSuite) TestSomething(c *check.C) {
// TestErrkitApiErrorsWrapping verifies that apierrors wrapped with errkit.Wrap are still matchable using apierrors matchers
func (s *PodSuite) TestErrkitApiErrorsWrapping(c *check.C) {
// Create the fake client
fakeClient := fake.NewSimpleClientset()

// Add a reactor to simulate an error when trying to get a PVC
fakeClient.PrependReactor("get", "persistentvolumeclaims", func(action testing.Action) (handled bool, ret runtime.Object, err error) {
return true, nil, apierrors.NewNotFound(action.GetResource().GroupResource(), action.GetSubresource())
return true, nil, errkit.Wrap(apierrors.NewNotFound(action.GetResource().GroupResource(), action.GetSubresource()), "Some context")
})

_, err := fakeClient.CoreV1().PersistentVolumeClaims("abc").Get(context.TODO(), "def", metav1.GetOptions{})
Expand Down

0 comments on commit 672e66d

Please sign in to comment.