Skip to content

Commit 3d05fd6

Browse files
committed
assertHttpRouteConnection: Delete DNSRecord check
Delete the check for the DNSRecord CR in assertHttpRouteConnection. The host name is passed in as an argument to assertHttpRouteConnection, so the test has no reason to examine the DNSRecord CR, and the current logic erroneously adds a trailing "." to the domain, which causes it to fail looking for the DNSRecord. * test/e2e/util_gatewayapi_test.go (assertHttpRouteConnection): Delete call to assertDNSRecord. (assertDNSRecord): Delete function.
1 parent c7b1b97 commit 3d05fd6

File tree

1 file changed

+0
-47
lines changed

1 file changed

+0
-47
lines changed

test/e2e/util_gatewayapi_test.go

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ import (
1010
"fmt"
1111
"net"
1212
"net/http"
13-
"strings"
1413
"testing"
1514
"time"
1615

1716
sailv1 "github.com/istio-ecosystem/sail-operator/api/v1"
18-
v1 "github.com/openshift/api/operatoringress/v1"
1917
operatorcontroller "github.com/openshift/cluster-ingress-operator/pkg/operator/controller"
2018
operatorsv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
2119

@@ -513,7 +511,6 @@ func assertHttpRouteSuccessful(t *testing.T, namespace, name string, gateway *ga
513511
// and returns an error if not
514512
func assertHttpRouteConnection(t *testing.T, hostname string, gateway *gatewayapiv1.Gateway) error {
515513
t.Helper()
516-
domain := ""
517514

518515
// Create the http client to check the header.
519516
client := &http.Client{
@@ -523,23 +520,6 @@ func assertHttpRouteConnection(t *testing.T, hostname string, gateway *gatewayap
523520
},
524521
}
525522

526-
// Get gateway listener hostname to use for dnsRecord.
527-
if len(gateway.Spec.Listeners) > 0 {
528-
if gateway.Spec.Listeners[0].Hostname != nil && len(string(*gateway.Spec.Listeners[0].Hostname)) > 0 {
529-
domain = string(*gateway.Spec.Listeners[0].Hostname)
530-
if !strings.HasSuffix(domain, ".") {
531-
domain = domain + "."
532-
}
533-
}
534-
}
535-
// Obtain the standard formatting of the dnsRecord.
536-
dnsRecordName := operatorcontroller.GatewayDNSRecordName(gateway, domain)
537-
538-
// Make sure the DNSRecord is ready to use.
539-
if err := assertDNSRecord(t, dnsRecordName); err != nil {
540-
return err
541-
}
542-
543523
// Wait and check that the dns name resolves first. Takes a long time, so
544524
// if the hostname is actually an IP address, skip this.
545525
if net.ParseIP(hostname) == nil {
@@ -679,30 +659,3 @@ func deleteExistingIstio(t *testing.T) error {
679659
t.Logf("Deleted Istio %s.", nsName.Name)
680660
return nil
681661
}
682-
683-
// assertDNSRecord checks to make sure a DNSRecord exists in a ready state,
684-
// and returns an error if not.
685-
func assertDNSRecord(t *testing.T, recordName types.NamespacedName) error {
686-
t.Helper()
687-
dnsRecord := &v1.DNSRecord{}
688-
689-
err := wait.PollUntilContextTimeout(context.Background(), 1*time.Second, 1*time.Minute, false, func(context context.Context) (bool, error) {
690-
if err := kclient.Get(context, recordName, dnsRecord); err != nil {
691-
t.Logf("failed to get DNSRecord %s/%s: %v, retrying...", recordName.Namespace, recordName.Name, err)
692-
return false, nil
693-
}
694-
// Determine the current state of the DNSRecord.
695-
if len(dnsRecord.Status.Zones) > 0 {
696-
for _, zone := range dnsRecord.Status.Zones {
697-
for _, condition := range zone.Conditions {
698-
if condition.Type == v1.DNSRecordPublishedConditionType && condition.Status == string(metav1.ConditionTrue) {
699-
return true, nil
700-
}
701-
}
702-
}
703-
}
704-
t.Logf("found DNSRecord %s/%s but could not determine its readiness. Retrying...", recordName.Namespace, recordName.Name)
705-
return false, nil
706-
})
707-
return err
708-
}

0 commit comments

Comments
 (0)