Skip to content

Support skipping integration tests for unavailable CF features via environment variables#1346

Open
jorbaum wants to merge 11 commits intocloudfoundry:5.x.xfrom
jorbaum:fix-integration-tests
Open

Support skipping integration tests for unavailable CF features via environment variables#1346
jorbaum wants to merge 11 commits intocloudfoundry:5.x.xfrom
jorbaum:fix-integration-tests

Conversation

@jorbaum
Copy link
Copy Markdown

@jorbaum jorbaum commented Mar 23, 2026

On my CF test environment quite a few integration tests needed features that my environment did not support.

I added a bunch of environment variables so those tests can be disabled at a global level.

I am not sure about this approach yet. Especially regarding disabling V2 CAPI as it touches quite a lot of places. Any feedback welcome!

AI tools used: Claude Code and GitHub Copilot (Opus 4.6) assisted me during development. I reviewed the result.

@jorbaum jorbaum changed the title Fix integration tests Support skipping integration tests for unavailable CF features via environment variables Mar 23, 2026
@jorbaum jorbaum force-pushed the fix-integration-tests branch from 0c5a424 to 5ad1072 Compare March 23, 2026 16:13
Copy link
Copy Markdown
Contributor

@Kehrlann Kehrlann left a comment

Choose a reason for hiding this comment

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

  • Really clear annotations for execution conditions, I like the approach.
  • A few questions and remarks throughout the PR.
  • Please target 5.x.x

My biggest issue is that half of the classes in the v3 package are annotated with @RequiresV2Api. It seems v2 is required because we push applications (service broker, most notably) in the config with the v2 API, and those tests needs application pushed.
Could you please consider updating the core integration test config to use v3 apis for pushing apps instead?
To have examples of this, look at the ApplicationsTest in the v3 package.

Comment thread integration-test/src/test/java/org/cloudfoundry/logcache/v1/LogCacheTest.java Outdated
Comment thread integration-test/src/test/java/org/cloudfoundry/CloudFoundryCleaner.java Outdated
Comment thread integration-test/src/test/java/org/cloudfoundry/CloudFoundryCleaner.java Outdated
Comment thread integration-test/src/test/java/org/cloudfoundry/IntegrationTestConfiguration.java Outdated
Comment thread README.md Outdated
@jorbaum
Copy link
Copy Markdown
Author

jorbaum commented Mar 26, 2026

One big reason for why I wanted to create a draf PR initially (which, apparently I did not :P ) is that I only tested the new annotations in the following combination:

SKIP_V2_TESTS=false \
SKIP_TCP_ROUTING_TESTS=true \
SKIP_BROWSER_AUTH_TESTS=true \
SKIP_METRIC_REGISTRAR_TESTS=true

and

SKIP_V2_TESTS=true \
SKIP_TCP_ROUTING_TESTS=true \
SKIP_BROWSER_AUTH_TESTS=true \
SKIP_METRIC_REGISTRAR_TESTS=true

This is because my test environment does not support tcp routing, browser-based auth or cf marketplace. Do you think this is fine?

@Kehrlann
Copy link
Copy Markdown
Contributor

Kehrlann commented Mar 27, 2026

I think it's fine. I'll test locally before merging, with and without the flags.

please also target 5.x.x, we'll merge this back into main later.

jorbaum added 11 commits April 17, 2026 14:58
TODO: I am unsure about this one. Needs more exploration

# Conflicts:
#	README.md
#	integration-test/src/test/java/org/cloudfoundry/operations/StacksTest.java
Some UAA do not return a Location header.
Prevent the serviceBrokerId bean from being created when SKIP_V2_TESTS=true,
rather than relying on @Autowired(required=false) in each test class. This
avoids the bean's initMethod="block" eagerly calling the V2 API at context
startup even when all V2 tests are disabled.
Extract the "SKIP_V2_TESTS" string literal into a public constant
RequiresV2Api.SKIP_V2_TESTS_ENV and reference it from
IntegrationTestConfiguration and CloudFoundryCleaner.
The info() test alone doesn't bring enough value to justify keeping the
class partially enabled without V2.
Replace V2 applicationsV2().listServiceBindings / removeServiceBinding
calls with V3 serviceBindingsV3().list / delete in the cleaner's
application cleanup path, eliminating the runV2Calls boolean parameter.
Reword to explain the env var is for when UAA doesn't have browser-based
auth configured, rather than referencing "non-interactive environments".
Move the SKIP_V2_TESTS check into a reusable static method in
V2ApiCondition.
@jorbaum jorbaum force-pushed the fix-integration-tests branch from 5ad1072 to 25cb827 Compare April 17, 2026 14:53
@jorbaum jorbaum changed the base branch from main to 5.x.x April 17, 2026 14:55
@jorbaum
Copy link
Copy Markdown
Author

jorbaum commented Apr 17, 2026

Could you please consider updating the core integration test config to use v3 apis for pushing apps instead?

I have now addressed all of the comments except for this one. Moving the test config to use v3 seems like a bigger endeavor. I did not try to tackle it so far.

Also I did not manage to rerun the integration tests again. Feel free to take a look at my changes already though.

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