Skip to content

Commit

Permalink
Add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
marcmognol committed Mar 16, 2024
1 parent 8db8728 commit 6eafd64
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/templates/danglingservice/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,21 @@ func (s *DanglingServiceTestSuite) TestNoDanglingServiceWithEndpoints() {
})
}

func (s *DanglingServiceTestSuite) TestDanglingServiceWithNoMatchingEndpoints() {
s.AddService(service1, nil)
s.AddEndpoints(service2)

s.Validate(s.ctx, []templates.TestCase{
{
Param: params.Params{},
Diagnostics: map[string][]diagnostic.Diagnostic{
service1: {{Message: "service has no selector specified"}},
},
ExpectInstantiationError: false,
},
})
}

func (s *DanglingServiceTestSuite) TestOneServiceIsDangling() {
s.AddDeploymentWithLabels(pod2, labelselector2)
s.AddService(service1, labelselector1)
Expand Down

0 comments on commit 6eafd64

Please sign in to comment.