Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,15 @@ public void info() {
.consumeNextWith(
response -> {
Version expected = Version.valueOf(SUPPORTED_API_VERSION);
Version actual = Version.valueOf(response.getApiVersion());

Version actual;
String version = response.getApiVersion();
if (version == null || version.isEmpty()) {
assertThat("CF API v2 is disabled")
.isEqualTo(response.getSupport());
actual = Version.of(0, 0, 0);
} else {
actual = Version.valueOf(version);
}
assertThat(actual).isLessThanOrEqualTo(expected);
Comment on lines +46 to 55

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.

This file is annotated with @RequiresV2Api. Have you tried the SKIP_V2_TESTS env var? Does it not work as intended?

I'm surprised other test annotated with @RequiresV2Api passed at all.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

None of the tests pass when v2 is disabled completely. So far v2 is fully functional, but the urls are checked and v2 is refused. This refusal code is disabled locally :-)
Current plan is to remove v2 starting 2027, by then we must be done with the migration.

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.

AFAIU the whole org.cloudfoundry.client.v2 package requires CAPI v2 API.

Yes, it should be skipped when setting SKIP_V2_TESTS to true.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

SKIP_V2_TESTS works as intended, but I ususally set it to "false" and run all tests.

})
.expectComplete()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.time.Instant;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.function.Function;
import java.util.function.UnaryOperator;
import org.cloudfoundry.AbstractIntegrationTest;
Expand Down Expand Up @@ -109,7 +110,6 @@
import org.cloudfoundry.util.JobUtils;
import org.cloudfoundry.util.PaginationUtils;
import org.cloudfoundry.util.ResourceUtils;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import reactor.core.publisher.Flux;
Expand Down Expand Up @@ -1885,13 +1885,9 @@ public void listServicesFilterByLabel() {
.verify(Duration.ofMinutes(5));
}

// TODO: Await https://github.com/cloudfoundry/cloud_controller_ng/issues/856 for this test to
// work
@Disabled(
"Await https://github.com/cloudfoundry/cloud_controller_ng/issues/856 for this test to"
+ " work")

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.

Awesome!

@Test
public void listServicesFilterByServiceBrokerId() {
List<String> expectedValues = List.of(this.serviceName, this.serviceName + "-shareable");
Mono.zip(this.serviceBrokerId, this.spaceId)
.flatMapMany(
function(
Expand All @@ -1903,9 +1899,10 @@ public void listServicesFilterByServiceBrokerId() {
builder.serviceBrokerId(serviceBrokerId))))
.map(response -> response.getEntity().getLabel())
.as(StepVerifier::create)
.expectNext(this.serviceName)
.consumeNextWith(element -> assertThat(element).isIn(expectedValues))
.consumeNextWith(element -> assertThat(element).isIn(expectedValues))
.expectComplete()
.verify(Duration.ofMinutes(5));
.verify(Duration.ofMinutes(10));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import org.cloudfoundry.client.v3.organizations.ListOrganizationsRequest;
import org.cloudfoundry.client.v3.organizations.OrganizationResource;
import org.cloudfoundry.client.v3.organizations.UpdateOrganizationRequest;
import org.cloudfoundry.reactor.DefaultConnectionContext;
import org.cloudfoundry.util.JobUtils;
import org.cloudfoundry.util.PaginationUtils;
import org.junit.jupiter.api.Test;
Expand All @@ -65,6 +66,8 @@ public final class OrganizationsTest extends AbstractIntegrationTest {

@Autowired private Mono<String> organizationId;

@Autowired private DefaultConnectionContext connectionContext;

@Test
public void assignDefaultIsolationSegment() {
String isolationSegmentName = this.nameFactory.getIsolationSegmentName();
Expand Down Expand Up @@ -170,7 +173,8 @@ public void get() {
@Test
public void getDefaultDomain() {
String organizationName = this.nameFactory.getOrganizationName();

String apiHost = this.connectionContext.getApiHost();
String host = apiHost.replace("api", "");
createOrganizationId(this.cloudFoundryClient, organizationName)
.flatMap(
organizationId ->
Expand All @@ -182,8 +186,7 @@ public void getDefaultDomain() {
.build()))
.map(GetOrganizationDefaultDomainResponse::getName)
.as(StepVerifier::create)
.consumeNextWith(
name -> assertThat(name).contains("apps.", ".shepherd.tanzu.broadcom.net"))
.consumeNextWith(name -> assertThat(name).contains("apps.", host))
.expectComplete()
.verify(Duration.ofMinutes(5));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,16 @@
import org.cloudfoundry.client.v3.packages.CreatePackageRequest;
import org.cloudfoundry.client.v3.packages.GetPackageRequest;
import org.cloudfoundry.client.v3.packages.Package;
import org.cloudfoundry.client.v3.packages.PackageRelationships;
import org.cloudfoundry.client.v3.packages.PackageType;
import org.cloudfoundry.client.v3.packages.UploadPackageRequest;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import reactor.core.Exceptions;
import reactor.core.publisher.Mono;
import reactor.test.StepVerifier;

@Disabled("Until Packages are no longer experimental")

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.

Very nice!

public final class PackagesTest extends AbstractIntegrationTest {

@Autowired private CloudFoundryClient cloudFoundryClient;
Expand Down Expand Up @@ -81,6 +80,19 @@ public void upload() {
.create(
CreatePackageRequest.builder()
.type(PackageType.BITS)
.relationships(
PackageRelationships.builder()
.application(
ToOneRelationship
.builder()
.data(
Relationship
.builder()
.id(
applicationId)
.build())
.build())
.build())
.build()))
.map(Package::getId)
.flatMap(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2020,7 +2020,7 @@ private static Mono<Void> createDockerApplication(
.push(
PushApplicationRequest.builder()
.diskQuota(512)
.dockerImage("cloudfoundry/lattice-app")
.dockerImage("cloudfoundry/grace")
.healthCheckType(ApplicationHealthCheck.PORT)
.memory(64)
.name(name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,13 @@ public void getTokenByClientCredentials() {
.verify(Duration.ofMinutes(5));
}

// TODO: Ready to Implement - Await https://github.com/cloudfoundry/cf-java-client/issues/862 to
// get passcode
@Disabled(
"Ready to Implement - Await https://github.com/cloudfoundry/cf-java-client/issues/862"
+ " to get passcode")
// When implemented, will fix issue: https://github.com/cloudfoundry/cf-java-client/issues/910.
// Could be done similarly to "getTokenByAuthorizationCode".
// First user_token grant type must be implented.
// See: https://docs.cloudfoundry.org/api/uaa/index.html#user-token-grant
// Then this endpoint must be called first, to create the token.
// See: https://docs.cloudfoundry.org/api/uaa/index.html#saml2-bearer-grant
@Disabled("Ready to Implement")
@Test
public void getTokenByOneTimePasscode() {
this.uaaClient
Expand Down