Merge pull request #19851 from thockin/fix-19723-test-strings

Match regexes for error strings in e2e
This commit is contained in:
Alex Mohr 2016-01-21 14:31:47 -08:00
commit a5dddfcb32

View File

@ -646,9 +646,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)
@ -707,8 +706,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)
@ -722,7 +721,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() {