Skip to content

Commit

Permalink
OCPBUGS-13810: Update TestAWSELBConnectionIdleTimeout to not use wild…
Browse files Browse the repository at this point in the history
…card DNS record

TestAWSELBConnectionIdleTimeout has been very flakey due to the fact that the
CI test runner cluster is failing to resolve the newly created wildcard DNS Record
in a reasonable time. To work around this, we switch to using ELB's hostname,
which is consistently resolving and adding the "Host" header to the HTTP request

`test/e2e/operator_test.go`: Modify TestAWSELBConnectionIdleTimeout to use
ELB hostname and Host header with route hostname
  • Loading branch information
gcs278 authored and openshift-cherrypick-robot committed Jul 2, 2023
1 parent 37c11f6 commit 51cd04c
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 51cd04c

Please sign in to comment.