Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NE-1208: Gateway API E2E Testing #1023

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

candita
Copy link
Contributor

@candita candita commented Feb 1, 2024

Add three new tests and a few helper functions for testing GatewayAPI.

Currently, the FeatureGate for GatewayAPI must be enabled first.

oc patch featuregates/cluster --type=merge --patch='{"spec":{"featureSet":"CustomNoUpgrade","customNoUpgrade":{"enabled":["GatewayAPI"]}}}'

Working on a way to fake that for testing because it roll nodes and the router pods.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Feb 1, 2024
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 1, 2024
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Feb 1, 2024

@candita: This pull request references NE-1208 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.16.0" version, but no target version was set.

In response to this:

Add three new tests and a few helper functions for testing GatewayAPI.

Currently, the FeatureGate for GatewayAPI must be enabled first.

oc patch featuregates/cluster --type=merge --patch='{"spec":{"featureSet":"CustomNoUpgrade","customNoUpgrade":{"enabled":["GatewayAPI"]}}}'

Working on a way to fake that for testing because it roll nodes and the router pods.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Copy link
Contributor

openshift-ci bot commented Feb 1, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

Copy link
Contributor

openshift-ci bot commented Feb 1, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from candita. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@candita
Copy link
Contributor Author

candita commented Feb 12, 2024

/test verify
/test unit
/test images

@candita
Copy link
Contributor Author

candita commented Feb 12, 2024

/test e2e-aws-operator

@candita candita force-pushed the NE-1208-E2E-Testing-GWAPI branch 3 times, most recently from b8b5ff7 to 9deaecf Compare February 15, 2024 23:12
@candita
Copy link
Contributor Author

candita commented Feb 15, 2024

/test verify
/test unit
/test images

@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Feb 15, 2024

@candita: This pull request references NE-1208 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.16.0" version, but no target version was set.

In response to this:

Add three new tests and a few helper functions for testing GatewayAPI.

Currently, the FeatureGate for GatewayAPI must be enabled first.

oc patch featuregates/cluster --type=merge --patch='{"spec":{"featureSet":"CustomNoUpgrade","customNoUpgrade":{"enabled":["GatewayAPI"]}}}'

Working on a way to fake that for testing because it roll nodes and the router pods.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@candita
Copy link
Contributor Author

candita commented Feb 15, 2024

/test e2e-aws-operator

@candita candita marked this pull request as ready for review March 14, 2024 19:38
@openshift-ci openshift-ci bot requested review from gcs278 and rfredette March 14, 2024 19:39
@candita
Copy link
Contributor Author

candita commented Mar 19, 2024

/retest

@candita
Copy link
Contributor Author

candita commented Apr 2, 2024

/retest-required

@candita candita changed the title WIP NE-1208: Gateway API E2E Testing NE-1208: Gateway API E2E Testing Apr 2, 2024
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 2, 2024
@candita
Copy link
Contributor Author

candita commented Apr 3, 2024

/assign @rfredette
/assign @gcs278

@candita
Copy link
Contributor Author

candita commented Apr 3, 2024

Seems to be a network issue that made e2e-aws-operator test fail:

=== NAME TestAll/parallel/TestCRLUpdate/certificate-distributes-its-own-crl
client_tls_test.go:1321: Failed initial CRL check: timed out waiting for the condition

/test e2e-aws-operator

@candita
Copy link
Contributor Author

candita commented Apr 3, 2024

CI may depend on #1037

@candita
Copy link
Contributor Author

candita commented Apr 4, 2024

/retest-required

@candita
Copy link
Contributor Author

candita commented Apr 8, 2024

Maybe transient:

=== RUN TestAll/serial/TestCanaryRoute
canary_test.go:123: failed to observe the expected canary response body: timed out waiting for the condition

/test e2e-aws-operator

@candita
Copy link
Contributor Author

candita commented Apr 10, 2024

This is failing again? See if it happens repeatedly.

router_compression_test.go:177: failed to observe deployment completion: timed out waiting for deployment router-default to complete rollout: failed to observe deployment rollout complete; deployment specifies 2 replicas and has generation 14; last observed 2 updated, 1 available, 2 total replicas, with observed generation 14

/test e2e-aws-operator

Copy link
Contributor

openshift-ci bot commented Apr 11, 2024

@candita: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

Copy link
Contributor

@rfredette rfredette left a comment

Choose a reason for hiding this comment

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

I've added a few comments that are mainly nit-picks, but overall, this look good to me.

Comment on lines +86 to +88
testGatewayAPIResources(t)
testGatewayAPIObjects(t)
testGatewayAPIIstioInstallation(t)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
testGatewayAPIResources(t)
testGatewayAPIObjects(t)
testGatewayAPIIstioInstallation(t)
t.Run("testGatewayAPIResources", testGatewayAPIResources)
t.Run("testGatewayAPIObjects", testGatewayAPIObjects)
t.Run("testGatewayAPIIstioInstallation", testGatewayAPIIstioInstallation)

If testGatewayAPIResources, testGatewayAPIObjects, and testGatewayAPIIstioInstallation are intended to be treated as separate tests, using t.Run to run them as subtests would help separate their output and success/failure conditions

t.Fatalf("failed to find expected CatalogSource %s", expectedCatalogSourceName)
}
if err := assertOSSMOperator(t); err != nil {
t.Fatalf("failed to find expected Istio operator")
Copy link
Contributor

Choose a reason for hiding this comment

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

Use t.Fatal() when there are no printf-style arguments

t.Fatalf("failed to find expected Istio operator")
}
if err := assertIstiodProxy(t); err != nil {
t.Fatalf("failed to find expected Istiod proxy")
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above; use t.Fatal()

}
// TODO - In OSSM 3.x the configuration object to check will be different.
if err := assertSMCP(t); err != nil {
t.Fatalf("failed to find expected SMCP: %s", err.Error())
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
t.Fatalf("failed to find expected SMCP: %s", err.Error())
t.Fatalf("failed to find expected SMCP: %v", err)

This is a nit, but it brings it in line with the way the majority of error messages are printed in these tests.

Comment on lines +210 to +213
ok, gatewayClass := assertCanCreateGatewayClass(t, gatewayclass.OpenShiftDefaultGatewayClassName, gatewayclass.OpenShiftGatewayClassControllerName)
if !ok {
return fmt.Errorf("feature gate was enabled, but gateway class object could not be created")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
ok, gatewayClass := assertCanCreateGatewayClass(t, gatewayclass.OpenShiftDefaultGatewayClassName, gatewayclass.OpenShiftGatewayClassControllerName)
if !ok {
return fmt.Errorf("feature gate was enabled, but gateway class object could not be created")
}
gatewayClass, err := createGatewayClass(t, gatewayclass.OpenShiftDefaultGatewayClassName, gatewayclass.OpenShiftGatewayClassControllerName)
if err != nil {
return fmt.Errorf("feature gate was enabled, but gateway class object could not be created: %v", err)
}

I'm not sure the assertCanCreate... functions are useful. Wouldn't this essentially be the same?

Comment on lines +188 to +190
if err = kclient.Get(context.TODO(), name, gateway); err == nil {
return gateway, nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This returns gateway, nil if the get is successful, but if it fails (which I'm sure is very unlikely), it still ends up returning gateway, nil

Suggested change
if err = kclient.Get(context.TODO(), name, gateway); err == nil {
return gateway, nil
}
if err = kclient.Get(context.TODO(), name, gateway); err == nil {
return gateway, nil
} else {
return nil, err
}

}

// getClusterVersion returns the ClusterVersion if found. If one is not found, it returns an error.
func getClusterVersion() (*configv1.ClusterVersion, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't seem to be gateway API specific. I think it'd be great to put it in util_test.go for better visibility.

}

// assertSubscription checks if the Subscription of the given name exists and returns an error if not.
func assertSubscription(t *testing.T, namespace, subName string) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above; this could go in util_test.go

Comment on lines +223 to +226
ok, testGateway = assertCanCreateGateway(t, gatewayClass, testGatewayName, openshiftIngressNamespace, domain)
if !ok {
return fmt.Errorf("feature gate was enabled, but gateway object could not be created")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
ok, testGateway = assertCanCreateGateway(t, gatewayClass, testGatewayName, openshiftIngressNamespace, domain)
if !ok {
return fmt.Errorf("feature gate was enabled, but gateway object could not be created")
}
testGateway, err = createGateway(gatewayClass, testGatewayName, openshiftIngressNamespace, domain)
if err != nil {
return fmt.Errorf("feature gate was enabled, but gateway object could not be created: %w", err)
}

Same as above

Comment on lines +232 to +236
ok, _ = assertCanCreateHttpRoute(t, ns.Name, "test-httproute", openshiftIngressNamespace, default_routename, testGatewayName+"-"+gatewayclass.OpenShiftDefaultGatewayClassName, testGateway)
if !ok {
return fmt.Errorf("feature gate was enabled, but http route object could not be created")
// The http route is automatically deleted because its namespace is automatically deleted.
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
ok, _ = assertCanCreateHttpRoute(t, ns.Name, "test-httproute", openshiftIngressNamespace, default_routename, testGatewayName+"-"+gatewayclass.OpenShiftDefaultGatewayClassName, testGateway)
if !ok {
return fmt.Errorf("feature gate was enabled, but http route object could not be created")
// The http route is automatically deleted because its namespace is automatically deleted.
}
_, err = createHttpRoute(ns.Name, "test-httproute", openshiftIngressNamespace, default_routename, testGatewayName+"-"+gatewayclass.OpenShiftDefaultGatewayClassName, testGateway)
if err != nil {
return fmt.Errorf("feature gate was enabled, but http route object could not be created: %w", err)
// The http route is automatically deleted because its namespace is automatically deleted.
}

Same as above

@rfredette
Copy link
Contributor

It seems like this test relies on OSSM 2.5 and the Gateway API v0.6.2 CRDs in #1018. When I ran it against a cluster on the latest nightly, the tests failed waiting for test-gateway to get the Accepted status condition. With #1018 applied, that issue goes away and the test passes.

/hold until #1018 is merged.

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants