Modernize Crossplane conformance suite#31
Conversation
…onformance testing Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
|
oh wow, off to a pretty poor start for the CI in https://github.com/crossplane/conformance/actions/runs/11259504031/job/31308621246?pr=31 🙄 |
Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
- this is to avoid the conflict with xpkg-action's and crossplane's install.sh download of the crank binary to a file called crossplane Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
|
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
Signed-off-by: Jared Watts <jbw976@gmail.com>
- install a function and verify it becomes installed and healthy - create a composition that uses pipeline mode to compose resources with functions Signed-off-by: Jared Watts <jbw976@gmail.com>
|
@negz I've moved this PR out of draft after getting it to state I'm feeling decent about. I'll continue some more clean up work, but the bulk of what I wanted to accomplish here is now completed. Let me know if you'd like a sync session to walk through these changes effectively together, or how I can help make your review easier. Thank you! 🙇 |
Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
- create set of legacy tests that verify legacy XRDs and XRs - create new v2 tests that verify cluster and namespaced scoped XRs - update provider/function tests Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
Signed-off-by: Jared Watts <jbw976@gmail.com>
negz
left a comment
There was a problem hiding this comment.
LGTM overall. None of my comments are blocking - I think this is worth merging to modernize these ancient tests.
port the tests to use the same sigs.k8s.io/e2e-framework that crossplane uses for consistency and maintainability sake
I think we should consider deduping these conformance tests with the E2E tests. I could imagine keeping both under c/c test/e2e directory. I suspect we could use labels such that conformance tests only ran a subset of the E2E tests (plus some conformance specific tests)?
The conformance test for distros of Crossplane would then become "must pass the c/c E2E suite with --label type=conformance. I suspect this'd reduce duplication and ongoing maintenance burden.
| // verify the XRD becomes established | ||
| testXRDIsEstablished(ctx, t, kube, xrd) | ||
|
|
||
| t.Run("CRDIsCreatedForXR", func(t *testing.T) { |
There was a problem hiding this comment.
I wonder if we should test that you can't do legacy stuff (e.g. use claims) when using v2 style XRs. e.g. Test hat only LegacyCluster XRs make claim CRDs.
There was a problem hiding this comment.
good idea! i'll include a test case for this as well, to ensure that modern XRDs do not produce claim CRDs.
tests/apiextensions_legacy_test.go
Outdated
| }) | ||
| } | ||
|
|
||
| // TestCompositeResourcePipelineModLegacy tests the creation of a legacy XRD and |
There was a problem hiding this comment.
Nit: This doesn't match the actual test name.
| continue | ||
| } | ||
|
|
||
| // TODO(negz): Just cmp.Diff the entire CRD spec? |
There was a problem hiding this comment.
This particular test does seem a little low value without actually doing this. 🤔
The CRD could be completely different schematically, as long as it was e.g. cluster scoped and in the right categories.
There was a problem hiding this comment.
That's a fair point - I do like though that it is at least verifying the entire expected API surface area. This test will fail if a distribution doesn't have all the required APIs, which has some value in testing.
this sounds like a good idea for long term maintenance. We would lose (i think) the current UX that is standard for Kubernetes conformance too where folks basically just have to execute I'm not sure exactly what the experience would be for running conformance if it was part of e2e tests, but it probably has a slightly higher burden, like maybe checking out the c/c repo and then an edit: ah, we have a tracking issue already with #15 |
Signed-off-by: Jared Watts <jbw976@gmail.com>
|
I pushed another commit to add a new verification that modern XRDs do not create claim CRDs. I've incoporated/responded to all the feedback here, so I'll go ahead and merge now if CI is green 🙏 Thanks for the review @negz! |
Description of your changes
This PR updates the Crossplane conformance test suite and build logic to be aligned and compliant with Crossplane v2.0 The tests are all now compliant with a Crossplane v2.0 control plane. The current builds in this repo were last verified to work with Crossplane v1.2, so there were a number of updates to incorporate from those ~20 intermediary minor releases and 1 major release 😇
Major changes to call out:
crossplane-runtime:v2.0.01.23.2,ubuntu-24.04runners, etc.codeqlandtrivy-scan-fsCreateNamespaceandTestResourceRefsTest case high level areas of coverage:
TestCompositeResourceDefinitionNamespace: Creates and validates a namespaced XRD andverifies it generates conformant CRDs for composite resources
TestCompositeResourceDefinitionCluster: Creates and validates a cluster-scoped XRD andverifies it generates conformant CRDs for composite resources
TestCompositeResourceNamespace: Tests end-to-end namespaced composite resourcefunctionality with a function pipeline
TestCompositeResourceCluster: Tests end-to-end cluster-scoped composite resourcefunctionality with a function pipeline
TestCompositeResourceDefinitionLegacy: Validates legacy XRDs create conformant CRDs forboth composite resources and claims
TestCompositeResourceLegacy: Tests end-to-end legacy composite resource and claimfunctionality using a function pipeline
TestConfiguration: Validates Configuration package installation, health status, and expected resourcesTestProvider: Validates Provider package installation, health status, expected resources (CRDs via MRDs)TestFunction: Validates Function package installation, health status, and expected resourcesTestCustomResourceDefinitions: Verifies all core Crossplane CRDs exist with properstructure and categorization
TestUsageProtectionNamespaced: Validates namespaced Usage objects properly protectresources from deletion while in use
TestUsageProtectionCluster: Validates ClusterUsage objects properly protect cluster-scopedresources from deletion while in use
TestUsageLegacy: Validates legacy Usage objects properly protect cluster-scoped resources from deletionTestOperation: Validates Operation execution and verifies applied resource referencesTestWatchOperation: Tests WatchOperation functionality to detect resource changes andtrigger operation pipelines
TestCronOperation: Tests CronOperation functionality to schedule and execute operationpipelines on a cron schedule
I have:
make reviewable testto ensure this PR is ready for review.How has this code been tested
I have run all tests locally against a v2.0 Crossplane control plane with the following command:
I have also built the plugin and executed it against a v2.0 control plane with
sonobouy:Everything passes with the exception of
TestConfiguration, which will not pass until we updateindex.docker.io/crossplane/conformance-testdata-configuration:latestafter merging the CI changes included in the PR. I have gotten that test case to pass locally though by temporarily usingxpkg.upbound.io/jaredorg/conformance-testdata-configuration:v0.0.1, which is essentially the same thing.Future improvements to consider
Some improvements that are not included in this PR, but could be considered as follow-ups: