Skip to content

Commit

Permalink
Fix app relationship on package upload
Browse files Browse the repository at this point in the history
We need to revisit this test as the cloud controller on Toolsmith environments doesn't cache resources smaller than 4k.
  • Loading branch information
mheath committed Feb 17, 2023
1 parent 0029512 commit e6d6e83
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@
import org.cloudfoundry.client.v3.packages.GetPackageRequest;
import org.cloudfoundry.client.v3.packages.GetPackageResponse;
import org.cloudfoundry.client.v3.packages.Package;
import org.cloudfoundry.client.v3.packages.PackageRelationships;
import org.cloudfoundry.client.v3.packages.PackageState;
import org.cloudfoundry.client.v3.packages.PackageType;
import org.cloudfoundry.client.v3.packages.UploadPackageRequest;
import org.cloudfoundry.util.DelayTimeoutException;
import org.cloudfoundry.util.ExceptionUtils;
import org.cloudfoundry.util.ResourceMatchingUtilsV3;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
Expand All @@ -55,9 +57,9 @@ public class ResourceMatchTest extends AbstractIntegrationTest {
@Autowired
private Mono<String> spaceId;

//TODO how to check if resource matching is enabled on this CF instance?
@IfCloudFoundryVersion(greaterThanOrEqualTo = CloudFoundryVersion.UNSPECIFIED) //TODO how to select this version?
@IfCloudFoundryVersion(greaterThanOrEqualTo = CloudFoundryVersion.PCF_2_9)
@Test
@Ignore("Cloud Controller is configured not to cache resource smaller than 4k - Find a better way to test this")
public void upload() throws IOException {
createAndUploadPackage()
.flatMap(this::waitForReady)
Expand Down Expand Up @@ -87,6 +89,13 @@ private Mono<String> createAndUploadPackage() {
.flatMap(applicationId -> this.cloudFoundryClient.packages()
.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(packageId -> {
Expand Down

0 comments on commit e6d6e83

Please sign in to comment.