Skip to content

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

Open
jorbaum wants to merge 5 commits intocloudfoundry:mainfrom
jorbaum:fix-integration-tests
Open

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

Conversation

@jorbaum
Copy link

@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
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 on lines +63 to +65
// Optional: bean requires V2 API; class is guarded by @RequiresV2Api
@Autowired(required = false)
private Mono<String> serviceBrokerId;
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't it surprising that the class pulls in the serviceBrokerId bean when it's full disabled? I would have expected that this bean is not loaded if the class doesn't execute.

}

@Test
@RequiresV2Api
Copy link
Contributor

Choose a reason for hiding this comment

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

Only the info test can execute without the V2 API, and it doesn't bring much value. Let's annotate the whole class .

Comment on lines +133 to +137
private static final boolean RUN_V2_CLEANUP = isRunV2Tests();

private static boolean isRunV2Tests() {
return !"true".equalsIgnoreCase(System.getenv("SKIP_V2_TESTS"));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider putting this in RequiresV2Api so the condition is shared.

Comment on lines +292 to +298
if (runV2Calls) {
apps =
apps.delayUntil(
application ->
removeApplicationServiceBindings(
cloudFoundryClient, application));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

That's the only v2 calls, which lists then deletes service bindings.
Can we port it to v3 instead of gating it with a boolean?


@Bean(initMethod = "block")
@DependsOn("cloudFoundryCleaner")
@ConditionalOnProperty(name = "SKIP_V2_TESTS", havingValue = "false", matchIfMissing = true)
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's centralize this property name, e.g. in RequiresV2Api.

`TEST_PROXY_USERNAME` | _(Optional)_ The username for a proxy to route all requests through
`TEST_SKIPSSLVALIDATION` | _(Optional)_ Whether to skip SSL validation when connecting to the Cloud Foundry instance. Defaults to `false`.
`UAA_API_REQUEST_LIMIT` | _(Optional)_ If your UAA server does rate limiting and returns 429 errors, set this variable to the smallest limit configured there. Whether your server limits UAA calls is shown in the log, together with the location of the configuration file on the server. Defaults to `0` (no limit).
`SKIP_BROWSER_AUTH_TESTS` | _(Optional)_ Set to `true` to skip integration tests that require browser-based authentication (e.g., SSO tests). Useful when the Cloud Foundry instance does not support browser-based authentication or when running tests in a non-interactive environment. Defaults to `false`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this really about "non-interactive" environments? Do we support interactive environments in our tests? Or is it about some UAA configuration that has browser-based auth?

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