Skip to content

Commit 6eafd64

Browse files
committed
Add unit test
1 parent 8db8728 commit 6eafd64

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

pkg/templates/danglingservice/template_test.go

+15
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,21 @@ func (s *DanglingServiceTestSuite) TestNoDanglingServiceWithEndpoints() {
113113
})
114114
}
115115

116+
func (s *DanglingServiceTestSuite) TestDanglingServiceWithNoMatchingEndpoints() {
117+
s.AddService(service1, nil)
118+
s.AddEndpoints(service2)
119+
120+
s.Validate(s.ctx, []templates.TestCase{
121+
{
122+
Param: params.Params{},
123+
Diagnostics: map[string][]diagnostic.Diagnostic{
124+
service1: {{Message: "service has no selector specified"}},
125+
},
126+
ExpectInstantiationError: false,
127+
},
128+
})
129+
}
130+
116131
func (s *DanglingServiceTestSuite) TestOneServiceIsDangling() {
117132
s.AddDeploymentWithLabels(pod2, labelselector2)
118133
s.AddService(service1, labelselector1)

0 commit comments

Comments
 (0)