From a1df9ff4b4db70ea871dae2a441ce71b344a60f2 Mon Sep 17 00:00:00 2001 From: Tim Hockin Date: Tue, 19 Jan 2016 21:13:39 -0800 Subject: [PATCH] Match regexes for error strings in e2e --- test/e2e/service.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/test/e2e/service.go b/test/e2e/service.go index cead6421543..8e644f459c8 100644 --- a/test/e2e/service.go +++ b/test/e2e/service.go @@ -645,9 +645,8 @@ var _ = Describe("Services", func() { if err == nil { Failf("Created service with conflicting NodePort: %v", result2) } - expectedErr := fmt.Sprintf("Service \"%s\" is invalid: spec.ports[0].nodePort: Invalid value: %d: provided port is already allocated", - serviceName2, port.NodePort) - Expect(fmt.Sprintf("%v", err)).To(Equal(expectedErr)) + expectedErr := fmt.Sprintf("%d.*port is already allocated", port.NodePort) + Expect(fmt.Sprintf("%v", err)).To(MatchRegexp(expectedErr)) By("deleting service " + serviceName1 + " to release NodePort") err = t.DeleteService(serviceName1) @@ -706,8 +705,8 @@ var _ = Describe("Services", func() { if err == nil { Failf("failed to prevent update of service with out-of-range NodePort: %v", result) } - expectedErr := fmt.Sprintf("Service \"%s\" is invalid: spec.ports[0].nodePort: Invalid value: %d: provided port is not in the valid range", serviceName, outOfRangeNodePort) - Expect(fmt.Sprintf("%v", err)).To(Equal(expectedErr)) + expectedErr := fmt.Sprintf("%d.*port is not in the valid range", outOfRangeNodePort) + Expect(fmt.Sprintf("%v", err)).To(MatchRegexp(expectedErr)) By("deleting original service " + serviceName) err = t.DeleteService(serviceName) @@ -721,7 +720,7 @@ var _ = Describe("Services", func() { if err == nil { Failf("failed to prevent create of service with out-of-range NodePort (%d): %v", outOfRangeNodePort, service) } - Expect(fmt.Sprintf("%v", err)).To(Equal(expectedErr)) + Expect(fmt.Sprintf("%v", err)).To(MatchRegexp(expectedErr)) }) It("should release NodePorts on delete", func() {