Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions test/e2e/dns_ingressdegrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
configv1 "github.com/openshift/api/config/v1"
operatorclient "github.com/openshift/cluster-ingress-operator/pkg/operator/client"

"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/config"

"k8s.io/apimachinery/pkg/types"
Expand Down Expand Up @@ -39,6 +40,23 @@ func TestIngressStatus(t *testing.T) {
t.Fatalf("failed to get DNS config: %v", err)
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to remove the Get(..., ..., &dnsConfig) above since TestMain initializes dnsConfig, but we can keep it if you prefer to keep the test logic self-contained.

For that matter, we should use kclient that TestMain also initializes, but that can be left as a follow-up clean-up.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try doing it here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll follow-up with a PR to address both comments. That'll help me to iterate at the same time on my other PR for LB.
Thanks

// Run DNS Config update tests on private and public zones when
// they are defined in the DNS config (which depends on the platform).
if dnsConfig.Spec.PrivateZone != nil {
t.Log("Testing private zone")
testUpdateDNSConfig(t, kubeClient)
}
if dnsConfig.Spec.PublicZone != nil {
t.Log("Testing public zone")
testUpdateDNSConfig(t, kubeClient)
}
}

func testUpdateDNSConfig(t *testing.T, kubeClient client.Client) {
if err := kubeClient.Get(context.TODO(), types.NamespacedName{Name: "cluster"}, &dnsConfig); err != nil {
Comment on lines +55 to +56
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest adding t.Helper(), but maybe that would obfuscate that testUpdateDNSConfig really contains the test. Really, the correct thing might be for TestIngressStatus to use t.Run(..., testUpdateDNSConfig), but I don't think it really matters that much.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm in favor of doing it as a follow-up with your help maybe. I've tried myself and I suspect I didn't get it right.

t.Fatalf("failed to get DNS config: %v", err)
}

// step 1
expected := []configv1.ClusterOperatorStatusCondition{
{Type: configv1.OperatorAvailable, Status: configv1.ConditionTrue},
Expand Down