Repository navigation
Conversation
3b9b621 to
483635d
Compare
483635d to
a4ad3db
Compare
Make the integration tests pass against a CAPI deployed on KinD. Client: - Send the "resources" field with every bits upload (v3 packages) and also as query parameter for v2 uploads without matched resources, as CAPI otherwise rejects them (CF-AppBitsUploadInvalid / missing :resources). - Add the CA certificates of the LDAP and SAML identity provider configurations. Integration tests: - Reserve the TCP ports handed out by the NameFactory on the default-tcp router group at startup, so the TCP route tests don't depend on the test order or the deployment's default range. Skipped together with the TCP routing tests (SKIP_TCP_ROUTING_TESTS).
57252f5 to
2321e47
Compare
Kehrlann
left a comment
There was a problem hiding this comment.
I think we should not make the routerGroupPorts a bean.
| // Tests allocate TCP ports from NameFactory, so the default router group has to reserve them | ||
| // regardless of the order in which the tests run (or of the deployment's default range). |
There was a problem hiding this comment.
Still a bit unsure what we're doing with this bean. Are we making sure that ports can be reserved on the default group in the first place, before we do anything else? And this is only so that the reservable range from the CF config is overridden by the config we have in our tests, correct?
This follows the established pattern, which, unfortunately, is hacky and convoluted (e.g. @Bean(initMethod = "block") Mono<...> is bad). Let's try and make it cleaner.
I don't see why the CC Cleaner depends on this though - is it only to avoid doing an initial cleanup if the routing is not possible?
If that's just it, I'm ok paying the price of the initial cleanup just for clarity:
- We can re-use the existing routing client
- We can use
ApplicationContextRunnerand make stuff less crazy
e.g.
@Bean
@ConditionalOnExpression("!'true'.equalsIgnoreCase(systemEnvironment['SKIP_TCP_ROUTING_TESTS'])")
ApplicationRunner setReservablePort(RoutingClient routingClient) {
// Ensure that the default-router-group reservable port range matches whatever our tests use.
return args -> {
var defaultGroup = routingClient
.routerGroups()
.list(ListRouterGroupsRequest.builder().build())
.flatMapIterable(ListRouterGroupsResponse::getRouterGroups)
.filter(group -> "default-tcp".equals(group.getName())).blockFirst();
if (defaultGroup == null) {
throw new RuntimeException("No default-tcp router group, TCP route tests will fail. " +
"Set SKIP_TCP_ROUTING_TESTS=true to skip TCP routing tests entirely.");
}
routingClient
.routerGroups()
.update(
UpdateRouterGroupRequest.builder()
.reservablePorts(
RandomNameFactory.PORT_RANGE)
.routerGroupId(defaultGroup.getRouterGroupId())
.build()).block();
};
}In the longer run, it'd be much, much better to move the CF cleaner to a similar pattern (but not as part of this PR)
The integration tests fail against the current CAPI deployed on KinD (see #1381). This PR fixes what broke for
5.x.x.Client
resourcesfield. CAPI otherwise rejects them (CF-AppBitsUploadInvalid/missing :resources).resourcespart is always added, as JSON, and is[]when there are no matched resources.resources=[]as a query parameter. Cloud Controller accepts it there, but only an empty list fits into a URL, so a non-empty list stays a form field only.LdapConfigurationandSamlConfigurationgot acaCertificateslist for the CA certificates of the identity provider.Integration tests
NameFactoryhands out (1025 to the maximum) on thedefault-tcprouter group. The TCP route tests no longer depend on the test order or on the default port range of the deployment. SettingSKIP_TCP_ROUTING_TESTSskips this. If there is nodefault-tcpgroup, it only logs a warning.Testing
cloudfoundry-client,cloudfoundry-client-reactorandcloudfoundry-operationspass on JDK 11async, and extended the v3 upload test to check theresourcespart.Connected PR
#1381