Skip to content

Commit

Permalink
endpointmanager: check expose errors in test
Browse files Browse the repository at this point in the history
For some reason, lots of calls to expose didn't check the error
returned. Specifically in the test context, this is not great, as it
makes debugging test failures more difficult than necessary.

Signed-off-by: David Bimmler <david.bimmler@isovalent.com>
  • Loading branch information
bimmlerd committed Mar 19, 2024
1 parent 660cbba commit 6e7f160
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions pkg/endpointmanager/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ func (s *EndpointManagerSuite) TestLookupCiliumID(c *C) {
name: "existing cilium ID",
preTestRun: func() {
ep.ID = 1
mgr.expose(ep)
c.Assert(mgr.expose(ep), IsNil)
},
setupArgs: func() args {
return args{
Expand Down Expand Up @@ -517,7 +517,7 @@ func (s *EndpointManagerSuite) TestLookupCNIAttachmentID(c *C) {
ContainerInterfaceName: "bar",
})
c.Assert(err, IsNil)
mgr.expose(ep)
c.Assert(mgr.expose(ep), IsNil)

good := mgr.LookupCNIAttachmentID("foo:bar")
c.Assert(good, checker.DeepEquals, ep)
Expand Down Expand Up @@ -549,7 +549,7 @@ func (s *EndpointManagerSuite) TestLookupIPv4(c *C) {
name: "existing LookupIPv4",
preTestRun: func() {
ep.IPv4 = netip.MustParseAddr("127.0.0.1")
mgr.expose(ep)
c.Assert(mgr.expose(ep), IsNil)
},
setupArgs: func() args {
return args{
Expand Down Expand Up @@ -617,7 +617,7 @@ func (s *EndpointManagerSuite) TestLookupCEPName(c *C) {
K8sPodName: "foo",
},
preTestRun: func(ep *endpoint.Endpoint) {
mgr.expose(ep)
c.Assert(mgr.expose(ep), IsNil)
},
setupArgs: func() args {
return args{
Expand All @@ -642,7 +642,7 @@ func (s *EndpointManagerSuite) TestLookupCEPName(c *C) {
DisableLegacyIdentifiers: true,
},
preTestRun: func(ep *endpoint.Endpoint) {
mgr.expose(ep)
c.Assert(mgr.expose(ep), IsNil)
},
setupArgs: func() args {
return args{
Expand Down Expand Up @@ -767,7 +767,7 @@ func (s *EndpointManagerSuite) TestRemove(c *C) {
name: "Updating all references",
preTestRun: func() {
ep.ID = 1
mgr.expose(ep)
c.Assert(mgr.expose(ep), IsNil)
},
setupArgs: func() args {
return args{}
Expand Down Expand Up @@ -806,7 +806,7 @@ func (s *EndpointManagerSuite) TestHasGlobalCT(c *C) {
preTestRun: func() {
ep.ID = 1
ep.Options = option.NewIntOptions(&endpoint.EndpointMutableOptionLibrary)
mgr.expose(ep)
c.Assert(mgr.expose(ep), IsNil)
},
setupWant: func() want {
return want{
Expand All @@ -826,7 +826,7 @@ func (s *EndpointManagerSuite) TestHasGlobalCT(c *C) {
ep.ID = 1
ep.Options = option.NewIntOptions(&endpoint.EndpointMutableOptionLibrary)
ep.Options.SetIfUnset(option.ConntrackLocal, option.OptionEnabled)
mgr.expose(ep)
c.Assert(mgr.expose(ep), IsNil)
},
setupWant: func() want {
return want{
Expand Down Expand Up @@ -874,7 +874,7 @@ func (s *EndpointManagerSuite) TestWaitForEndpointsAtPolicyRev(c *C) {
preTestRun: func() {
ep.ID = 1
ep.SetPolicyRevision(5)
mgr.expose(ep)
c.Assert(mgr.expose(ep), IsNil)
},
setupArgs: func() args {
return args{
Expand All @@ -898,7 +898,7 @@ func (s *EndpointManagerSuite) TestWaitForEndpointsAtPolicyRev(c *C) {
preTestRun: func() {
ep.ID = 1
ep.SetPolicyRevision(5)
mgr.expose(ep)
c.Assert(mgr.expose(ep), IsNil)
},
setupArgs: func() args {
ctx, cancel := context.WithTimeout(context.Background(), 0)
Expand All @@ -924,7 +924,7 @@ func (s *EndpointManagerSuite) TestWaitForEndpointsAtPolicyRev(c *C) {
preTestRun: func() {
ep.ID = 1
ep.SetPolicyRevision(4)
mgr.expose(ep)
c.Assert(mgr.expose(ep), IsNil)
},
setupArgs: func() args {
ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond)
Expand Down

0 comments on commit 6e7f160

Please sign in to comment.