Merge branch 'master' into postgres-pod-clusterrole

This commit is contained in:
Felix Kunde 2020-02-18 16:48:15 +01:00
commit 91475ab918
1 changed files with 5 additions and 4 deletions

View File

@ -20,7 +20,7 @@ func newsService(ann map[string]string, svcT v1.ServiceType, lbSr []string) *v1.
return svc return svc
} }
func TestServiceAnnotations(t *testing.T) { func TestSameService(t *testing.T) {
tests := []struct { tests := []struct {
about string about string
current *v1.Service current *v1.Service
@ -268,7 +268,8 @@ func TestServiceAnnotations(t *testing.T) {
v1.ServiceTypeLoadBalancer, v1.ServiceTypeLoadBalancer,
[]string{"128.141.0.0/16", "137.138.0.0/16"}), []string{"128.141.0.0/16", "137.138.0.0/16"}),
match: false, match: false,
reason: `new service's annotations doesn't match the current one: Removed 'foo'. Added 'bar' with value 'foo'. 'zalan' changed from 'do' to 'do.com'`, // Test just the prefix to avoid flakiness and map sorting
reason: `new service's annotations doesn't match the current one: Removed 'foo'.`,
}, },
{ {
about: "service add annotations", about: "service add annotations",
@ -301,7 +302,7 @@ func TestServiceAnnotations(t *testing.T) {
} }
if !match && !tt.match { if !match && !tt.match {
if !strings.HasPrefix(reason, tt.reason) { if !strings.HasPrefix(reason, tt.reason) {
t.Errorf("expected reason '%s', found '%s'", tt.reason, reason) t.Errorf("expected reason prefix '%s', found '%s'", tt.reason, reason)
return return
} }
} }