Skip to content

feat: Run the V2 integration tests against a dedicated CAPI version - #1409

Open
ZPascal wants to merge 2 commits into
cloudfoundry:mainfrom
ZPascal:pin-the-v2-version-main
Open

ZPascal wants to merge 2 commits into
cloudfoundry:mainfrom
ZPascal:pin-the-v2-version-main

Conversation

@ZPascal

@ZPascal ZPascal commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Newer CAPI releases disable the CC V2 API: from capi chart 1.249.1-1 on, V2 is behind cloudController.config.temporaryEnableV2 (default false), and kind-deployment main no longer enables it (cloudfoundry/k8s-deployment#540). This splits the integration tests so V3 runs against the latest CAPI while V2 keeps a dedicated version. The 5.x.x counterpart is #1408.

Changes

Workflow (integration-test.yml): the matrix is now Java × api:

v2 job v3 job
CAPI pinned to chart 1.249.0 (last chart serving V2) pinned to chart 1.252.1-1 (CAPI 1.252.0, V2 disabled)
kind-deployment v0.26.0 main @ 6b6882c (v0.26.0 can't deploy charts ≥ 1.249.1-1, their values schema changed)
Tests -Dgroups=v2 -DexcludedGroups=v2, SKIP_V2_TESTS=true
Preview / schedule stays pinned latest capi chart, resolved at runtime; other components use their latest versions

resolve-capi-version.sh is replaced by resolve-latest-capi-chart.sh (anonymous ghcr.io tag listing).

Integration tests

  • @RequiresV2Api also tags tests with JUnit tag v2 (696 of 921 tests, checked with a JUnit discovery run).
  • @IfCloudFoundryVersion compares 2.x versions with the server's V2 API version and 3.x versions with its V3 API version. Before, all gates were compared with one V2-first version, so a 3.x gate on a test method was compared with the V2 version. With V2 disabled (or /v2/info answering 404), the server counts as newer than every 2.x version, as before.
  • @IfCloudFoundryVersion on a test class is now evaluated as well. Before, the rule only looked at the test method, so the 19 class-level gates (e.g. UsersTest, AuditEventsTest, SpacesTest) were never applied. All of them are greaterThanOrEqualTo gates that current servers meet, so no test is skipped because of this. The skip reason now names the annotated element and the server versions.
  • With SKIP_V2_TESTS=true the cleaner also removes CF users (through V3) and networking policies.

Client: SUPPORTED_API_VERSION = 2.299.0 (CAPI 1.249.0), SUPPORTED_API_VERSION_V3 = 3.237.0 (CAPI 1.252.0).

Notes

  • Each run now has twice as many jobs (8 instead of 4 with the default Java matrix).
  • The v2 job runs about three quarters of the tests (~1h40m), so its timeout is 150 minutes; the v3 job (~30m) gets 60.
  • Preview and scheduled runs deploy the latest capi chart in the v3 job, so a future capi values change can break them until kind-deployment catches up. resolve-latest-capi-chart.sh currently resolves 1.252.1-1, the pinned version.
  • Tests that need V2 only indirectly (most of cloudfoundry-operations, ApplicationUtils, ServiceBrokerUtils) are @RequiresV2Api and run in the v2 job. PoliciesTest and TagsTest created their apps through V2 and now use V3.
  • With SKIP_V2_TESTS=true most resources (orgs, spaces, quotas, domains, routes, security groups, ...) are still only cleaned up through V2, so a run against a long-lived CF leaves them behind. CI uses a fresh KinD cluster per job, so this doesn't affect it.

Testing

  • ./mvnw -Pintegration-test -DskipTests spotless:check install passes.
  • CI run 44831523436: the v3 job (V2 disabled, log shows "CF API v2 is disabled") ran 225 tests without failures, the v2 job 696. Together 921 tests and 9 skips, the same as the last green main run. The one flaky test (FeatureFlagsV3Test.updateMessage) also flakes on main and is fixed in fix: Restore the feature flag in FeatureFlagsV3Test without blocking #1418.

Newer CAPI releases disable the CC V2 API, so the integration tests are split:

- V2 tests (@RequiresV2Api, now tagged "v2") run against the pinned capi chart
  1.249.0, the last one serving V2, on kind-deployment v0.26.0.
- All other tests run against the latest capi chart, resolved at runtime, on a
  newer kind-deployment with SKIP_V2_TESTS=true.
- @IfCloudFoundryVersion compares 2.x versions with the V2 and 3.x versions with
  the V3 API version of the server, so V3 gates such as PCF_4_v3 no longer get
  compared with the V2 version.
- SUPPORTED_API_VERSION is 2.299.0 (CAPI 1.249.0), SUPPORTED_API_VERSION_V3 is
  3.237.0 (CAPI 1.252.0).
@ZPascal
ZPascal force-pushed the pin-the-v2-version-main branch from 8b2cfea to a89b9eb Compare November 20, 2026 22:45
Lokowandtg
Lokowandtg previously approved these changes Nov 25, 2026

@Lokowandtg Lokowandtg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For the moment, much v3 code tranistively has a dependency to v2, so I expect failures in v3.

- Treat a 404 from /v2/info as "V2 API not available", so a CAPI that
  removes the V2 API instead of disabling it doesn't break the test context
- Name the annotated element and the server versions in the skip reason of
  @IfCloudFoundryVersion, now that class-level conditions are evaluated too
- Clean up CF users through the V3 API when the V2 tests are skipped
- Give the v2 job 150 minutes and the v3 job 60 minutes
@ZPascal

ZPascal commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

@Lokowandtg thanks! You're right that a lot of V3-looking code still uses V2 underneath: most of cloudfoundry-operations (DefaultApplications, DefaultServices, DefaultRoutes, ...) and the helpers ApplicationUtils / ServiceBrokerUtils. This PR handles that by tagging:

  • Tests that reach V2 indirectly carry @RequiresV2Api (e.g. DeploymentsTest, ProcessesTest, TasksTest "due to ApplicationUtils", the v3 OrganizationsTest and ServiceBrokersTest), which now also adds the JUnit tag v2. They run only in the v2 job, against CAPI 1.249.0 with V2 enabled.
  • The v3 job runs everything else (-DexcludedGroups=v2, SKIP_V2_TESTS=true). None of those 31 classes uses a V2 client API, those helpers or the V2-only beans. PoliciesTest and TagsTest were the two hidden V2 users (apps created via applicationsV2()); they use V3 now.
  • Run 44831523436: the v3 job ran against capi 1.252.1-1 with V2 really disabled (the log shows "calling v2 info endpoint but CF API v2 is disabled") and passed 225 tests; the v2 job passed 696. 921 tests and 9 skips in total, the same as the last green main run. The one flaky test (FeatureFlagsV3Test.updateMessage) also flakes on main and has nothing to do with V2; it's fixed in fix: Restore the feature flag in FeatureFlagsV3Test without blocking #1418.

I pushed a small follow-up commit (a33c2c1): a 404 from /v2/info now also counts as "V2 not available", the skip reason names the class or method and the server versions, the V3-only cleanup removes CF users too, and the v2 job gets 150 minutes. I also corrected the description: the v3 job is pinned to 1.252.1-1, only preview and scheduled runs use the latest chart.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants