Skip to content

Commit

Permalink
Merge pull request #959 from openshift-cherrypick-robot/cherry-pick-9…
Browse files Browse the repository at this point in the history
…55-to-release-4.12

[release-4.12] OCPBUGS-15644: Update TestAWSELBConnectionIdleTimeout to not use wildcard DNS record
  • Loading branch information
openshift-merge-robot authored Jul 21, 2023
2 parents 37c11f6 + 51cd04c commit 7a507e4
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions test/e2e/operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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{}

Expand Down

0 comments on commit 7a507e4

Please sign in to comment.