Skip to content

Commit

Permalink
Setup new apps for skipper tests
Browse files Browse the repository at this point in the history
- Old manifests were using very old app version
  which don't run on jdk17 so add new
  definitions which uses latest app versions
  able to run on modern jdk's.
  • Loading branch information
jvalkeal committed Apr 8, 2024
1 parent afd208b commit 015abe1
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2022 the original author or authors.
* Copyright 2017-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -76,7 +76,7 @@ public class ReleaseControllerTests extends AbstractControllerTests {

@Test
public void deployTickTock() throws Exception {
Release release = install("ticktock", "1.0.0", "myTicker");
Release release = install("ticktock", "4.0.0", "myTicker");
assertReleaseIsDeployedSuccessfully("myTicker", 1);
assertThat(release.getVersion()).isEqualTo(1);
}
Expand All @@ -87,7 +87,7 @@ public void packageDeployRequest() throws Exception {
InstallRequest installRequest = new InstallRequest();
PackageIdentifier packageIdentifier = new PackageIdentifier();
packageIdentifier.setPackageName("log");
packageIdentifier.setPackageVersion("1.0.0");
packageIdentifier.setPackageVersion("4.0.0");
packageIdentifier.setRepositoryName("notused");
installRequest.setPackageIdentifier(packageIdentifier);
InstallProperties installProperties = createInstallProperties(releaseName);
Expand All @@ -103,7 +103,7 @@ public void checkDeployStatus() throws Exception {

// Deploy
String releaseName = "test1";
Release release = install("log", "1.0.0", releaseName);
Release release = install("log", "4.0.0", releaseName);
assertThat(release.getVersion()).isEqualTo(1);

// Undeploy
Expand All @@ -117,7 +117,7 @@ public void checkDeployStatus() throws Exception {
public void getReleaseLogs() throws Exception {
// Deploy
String releaseName = "testLogs";
install("log", "1.0.0", releaseName);
install("log", "4.0.0", releaseName);
MvcResult result = mockMvc.perform(get("/api/release/logs/" + releaseName)).andDo(print())
.andExpect(status().isOk()).andReturn();
assertThat(result.getResponse().getContentAsString()).isNotEmpty();
Expand All @@ -134,27 +134,27 @@ public void checkDeleteReleaseWithPackage() throws Exception {

// Deploy
String releaseNameOne = "test1";
Release release = install("log", "1.0.0", releaseNameOne);
Release release = install("log", "4.0.0", releaseNameOne);
assertThat(release.getVersion()).isEqualTo(1);

String releaseNameTwo = "test2";
Release release2 = install("log", "1.0.0", releaseNameTwo);
Release release2 = install("log", "4.0.0", releaseNameTwo);
assertThat(release2.getVersion()).isEqualTo(1);

// Undeploy
MvcResult result = mockMvc.perform(delete("/api/release/" + releaseNameOne + "/package"))
.andDo(print()).andExpect(status().isConflict()).andReturn();

assertThat(result.getResolvedException().getMessage())
.contains("Can not delete Package Metadata [log:1.0.0] in Repository [test]. Not all releases of " +
.contains("Can not delete Package Metadata [log:4.0.0] in Repository [test]. Not all releases of " +
"this package have the status DELETED. Active Releases [test2]");

assertThat(this.packageMetadataRepository.findByName("log").size()).isEqualTo(3);
assertThat(this.packageMetadataRepository.findByName("log").size()).isEqualTo(5);

// Delete the 'release2' only not the package.
mockMvc.perform(delete("/api/release/" + releaseNameTwo))
.andDo(print()).andExpect(status().isOk()).andReturn();
assertThat(this.packageMetadataRepository.findByName("log").size()).isEqualTo(3);
assertThat(this.packageMetadataRepository.findByName("log").size()).isEqualTo(5);

// Second attempt to delete 'release1' along with its package 'log'.
mockMvc.perform(delete("/api/release/" + releaseNameOne + "/package"))
Expand All @@ -168,7 +168,7 @@ public void releaseRollbackAndUndeploy() throws Exception {

// Deploy
String releaseName = "test2";
Release release = install("log", "1.0.0", releaseName);
Release release = install("log", "3.2.1", releaseName);
assertThat(release.getVersion()).isEqualTo(1);

// Check manifest
Expand All @@ -178,7 +178,7 @@ public void releaseRollbackAndUndeploy() throws Exception {

// Upgrade
String releaseVersion = "2";
release = upgrade("log", "1.1.0", releaseName);
release = upgrade("log", "4.0.0", releaseName);
assertThat(release.getVersion()).isEqualTo(2);

// Check manifest
Expand Down Expand Up @@ -210,11 +210,11 @@ public void releaseRollbackAndUndeploy() throws Exception {
@Test
public void packageDeployAndUpgrade() throws Exception {
String releaseName = "myLog";
Release release = install("log", "1.0.0", releaseName);
Release release = install("log", "3.2.1", releaseName);
assertThat(release.getVersion()).isEqualTo(1);

// Upgrade
release = upgrade("log", "1.1.0", releaseName);
release = upgrade("log", "4.0.0", releaseName);

assertThat(release.getVersion()).isEqualTo(2);
}
Expand All @@ -227,11 +227,11 @@ public void cancelNonExistingRelease() throws Exception {
@Test
public void packageDeployAndUpgradeAndCancel() throws Exception {
String releaseName = "myTestapp";
Release release = install("testapp", "1.0.0", releaseName);
Release release = install("testapp", "2.9.0", releaseName);
assertThat(release.getVersion()).isEqualTo(1);

// Upgrade
release = upgrade("testapp", "1.1.0", releaseName, false);
release = upgrade("testapp", "2.9.1", releaseName, false);
assertThat(release.getVersion()).isEqualTo(2);

// Cancel
Expand All @@ -254,7 +254,7 @@ public void testStatusReportsErrorForMissingRelease() throws Exception {
public void packageUpgradeWithNoDifference() throws Exception {
String releaseName = "myPackage";
String packageName = "log";
String packageVersion = "1.0.0";
String packageVersion = "3.2.1";
Release release = install(packageName, packageVersion, releaseName);
assertThat(release.getVersion()).isEqualTo(1);

Expand Down Expand Up @@ -318,7 +318,7 @@ public Map<String, String> getAttributes() {

@Test
public void getFromAndPostToActuator() throws Exception {
install("ticktock", "1.0.0", "myTicker");
install("ticktock", "4.0.0", "myTicker");
assertReleaseIsDeployedSuccessfully("myTicker", 1);

mockMvc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ logging:
# The following INFO is to log the generated password when using basic security
org.springframework.boot.autoconfigure.security: 'INFO'
org.springframework.cloud.deployer: 'DEBUG'
org.springframework.statemachine: 'DEBUG'
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,30 @@ tags: logging, sink
maintainer: https://github.com/sobychacko
description: The log sink uses the application logger to output the data for inspection.

---
apiVersion: skipper.spring.io/v1
kind: SkipperPackageMetadata
origin: samples-package-repository
name: log
version: 3.2.1
packageSourceUrl: https://github.com/spring-cloud-stream-app-starters/log/tree/v4.0.0
packageHomeUrl: https://cloud.spring.io/spring-cloud-stream-app-starters/
tags: logging, sink
maintainer: https://github.com/sobychacko
description: The log sink uses the application logger to output the data for inspection.

---
apiVersion: skipper.spring.io/v1
kind: SkipperPackageMetadata
origin: samples-package-repository
name: log
version: 4.0.0
packageSourceUrl: https://github.com/spring-cloud-stream-app-starters/log/tree/v4.0.0
packageHomeUrl: https://cloud.spring.io/spring-cloud-stream-app-starters/
tags: logging, sink
maintainer: https://github.com/sobychacko
description: The log sink uses the application logger to output the data for inspection.

---
apiVersion: skipper.spring.io/v1
kind: SkipperPackageMetadata
Expand All @@ -59,6 +83,18 @@ tags: stream, time, log
maintainer: https://github.com/markpollack
description: The ticktock stream sends a time stamp and logs the value.

---
apiVersion: skipper.spring.io/v1
kind: SkipperPackageMetadata
origin: samples-package-repository
name: ticktock
version: 4.0.0
packageSourceUrl: https://example.com/dataflow/ticktock
packageHomeUrl: https://example.com/dataflow/ticktock
tags: stream, time, log
maintainer: https://github.com/markpollack
description: The ticktock stream sends a time stamp and logs the value.

---
apiVersion: skipper.spring.io/v1
kind: SkipperPackageMetadata
Expand Down Expand Up @@ -130,3 +166,27 @@ packageHomeUrl: https://cloud.spring.io/spring-cloud-dataflow/
tags: logging, sink
maintainer: https://github.com/jvalkeal
description: The testapp up starts and conditionally fails.

---
apiVersion: skipper.spring.io/v1
kind: SkipperPackageMetadata
origin: samples-package-repository
name: testapp
version: 2.9.0
packageSourceUrl: https://github.com/spring-cloud/spring-cloud-deployer
packageHomeUrl: https://cloud.spring.io/spring-cloud-dataflow/
tags: logging, sink
maintainer: https://github.com/jvalkeal
description: The testapp up starts and conditionally fails.

---
apiVersion: skipper.spring.io/v1
kind: SkipperPackageMetadata
origin: samples-package-repository
name: testapp
version: 2.9.1
packageSourceUrl: https://github.com/spring-cloud/spring-cloud-deployer
packageHomeUrl: https://cloud.spring.io/spring-cloud-dataflow/
tags: logging, sink
maintainer: https://github.com/jvalkeal
description: The testapp up starts and conditionally fails.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 015abe1

Please sign in to comment.