diff --git a/test/e2e/operator_test.go b/test/e2e/operator_test.go index 72f8937fd..416aea117 100644 --- a/test/e2e/operator_test.go +++ b/test/e2e/operator_test.go @@ -2641,10 +2641,17 @@ func TestAWSELBConnectionIdleTimeout(t *testing.T) { t.Fatalf("expected %s=%s, found %s=%s", key, expected, key, v) } - // Make sure we can resolve the route's host name. It may take some - // time for the ingresscontroller's wildcard DNS record to propagate. + // Get the ELB's hostname via the wildcard DNS record + wildcardRecordName := controller.WildcardDNSRecordName(ic) + wildcardRecord := &iov1.DNSRecord{} + if err := kclient.Get(context.TODO(), wildcardRecordName, wildcardRecord); err != nil { + t.Fatalf("failed to get wildcard dnsrecord %s: %v", wildcardRecordName, err) + } + elbHostname := wildcardRecord.Spec.Targets[0] + + // Wait until we can resolve the ELB's hostname if err := wait.PollImmediate(5*time.Second, 5*time.Minute, func() (bool, error) { - _, err := net.LookupIP(route.Spec.Host) + _, err := net.LookupIP(elbHostname) if err != nil { t.Log(err) return false, nil @@ -2657,10 +2664,14 @@ func TestAWSELBConnectionIdleTimeout(t *testing.T) { // Open a connection to the route, send a request, and verify that the // connection times out after ~10 seconds. - request, err := http.NewRequest("GET", "http://"+route.Spec.Host, nil) + request, err := http.NewRequest("GET", "http://"+elbHostname, nil) if err != nil { t.Fatalf("failed to create HTTP request: %v", err) } + // Add the "Host" header to direct request to ELB to the route we are testing which bypasses the need + // for the wildcard DNS record to propagate to the CI test runner cluster's DNS servers which has gotten very slow. + // See https://issues.redhat.com/browse/OCPBUGS-13810 + request.Host = route.Spec.Host client := &http.Client{}