Skip to content

Commit 41ac2cb

Browse files
committed
patch: Added CI against spring 5.1 and 5.2. Updated unit tests to skip SpringBoot tests when running against Spring 5.2 since SpringBoot 1.5 is deprecated and newer breaking changes are not supported
1 parent dce832e commit 41ac2cb

File tree

5 files changed

+50
-1
lines changed

5 files changed

+50
-1
lines changed

.github/workflows/continuous-integration-workflow.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ jobs:
5050
run: ./gha_build.sh spring false false -Dspring.version=4.3.25.RELEASE -Dspring-security.version=4.2.13.RELEASE
5151
- name: Build Spring 5.0
5252
run: ./gha_build.sh spring false false -Dspring.version=5.0.15.RELEASE -Dspring-security.version=5.0.13.RELEASE
53+
- name: Build Spring 5.1
54+
run: ./gha_build.sh spring false false -Dspring.version=5.1.14.RELEASE -Dspring-security.version=5.1.8.RELEASE
55+
- name: Build Spring 5.2
56+
# we reduce the minCoverage for this run because it will skip the SpringBoot 1.5 tests since they are no longer compatible with
57+
# Spring core 5.2 and above. SpringBoot 1.5 is deprecated
58+
run: ./gha_build.sh spring false false -Dspring.version=5.2.5.RELEASE -Dspring-security.version=5.2.2.RELEASE -Djacoco.minCoverage=0.4
5359

5460
build_springboot2:
5561
name: Build and test SpringBoot 2

aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/SlowAppTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@
1111
import com.amazonaws.serverless.proxy.spring.springslowapp.SlowAppConfig;
1212
import org.junit.Assert;
1313
import org.junit.Test;
14+
import org.springframework.core.SpringVersion;
1415

1516
import java.time.Instant;
17+
import java.util.Objects;
1618

1719
import static org.junit.Assert.*;
20+
import static org.junit.Assume.assumeFalse;
1821

1922
public class SlowAppTest {
2023

@@ -40,6 +43,11 @@ public void springSlowApp_continuesInBackgroundThread_returnsCorrect() {
4043

4144
@Test
4245
public void springBootSlowApp_continuesInBackgroundThread_returnsCorrect() {
46+
// We skip the tests if we are running against Spring 5.2.x - SpringBoot 1.5 is deprecated and no longer
47+
// breaking changes in the latest Spring releases have not been supported in it.
48+
// TODO: Update the check to verify any Spring version above 5.2
49+
assumeFalse(Objects.requireNonNull(SpringVersion.getVersion()).startsWith("5.2"));
50+
4351
SBLambdaHandler slowApp = null;
4452
try {
4553
slowApp = new SBLambdaHandler();

aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/SpringBootAppTest.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,34 @@
1212
import com.amazonaws.serverless.proxy.spring.springbootapp.LambdaHandler;
1313
import com.amazonaws.serverless.proxy.spring.springbootapp.TestController;
1414

15-
import com.fasterxml.jackson.core.JsonProcessingException;
1615
import com.fasterxml.jackson.databind.ObjectMapper;
16+
import org.junit.BeforeClass;
1717
import org.junit.Test;
18+
import org.springframework.core.SpringVersion;
1819

1920
import javax.ws.rs.core.HttpHeaders;
2021
import java.io.IOException;
22+
import java.util.Objects;
2123

2224
import static com.amazonaws.serverless.proxy.spring.springbootapp.TestController.CUSTOM_HEADER_NAME;
2325
import static com.amazonaws.serverless.proxy.spring.springbootapp.TestController.CUSTOM_QS_NAME;
2426
import static org.junit.Assert.*;
27+
import static org.junit.Assume.assumeFalse;
2528

2629

2730
public class SpringBootAppTest {
2831
private LambdaHandler handler = new LambdaHandler();
2932
private MockLambdaContext context = new MockLambdaContext();
3033
private ObjectMapper mapper = new ObjectMapper();
3134

35+
@BeforeClass
36+
public static void before() {
37+
// We skip the tests if we are running against Spring 5.2.x - SpringBoot 1.5 is deprecated and no longer
38+
// breaking changes in the latest Spring releases have not been supported in it.
39+
// TODO: Update the check to verify any Spring version above 5.2
40+
assumeFalse(Objects.requireNonNull(SpringVersion.getVersion()).startsWith("5.2"));
41+
}
42+
3243
@Test
3344
public void testMethod_springSecurity_doesNotThrowException() {
3445
AwsProxyRequest req = new AwsProxyRequestBuilder("/test", "GET").build();

aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/SpringBootSecurityTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,32 @@
1212
import com.fasterxml.jackson.core.JsonProcessingException;
1313
import com.fasterxml.jackson.databind.ObjectMapper;
1414
import com.fasterxml.jackson.databind.SerializationFeature;
15+
import org.junit.BeforeClass;
1516
import org.junit.Test;
17+
import org.springframework.core.SpringVersion;
1618

1719
import javax.ws.rs.core.HttpHeaders;
1820
import java.io.IOException;
1921
import java.util.Base64;
22+
import java.util.Objects;
2023

2124
import static org.junit.Assert.*;
25+
import static org.junit.Assume.assumeFalse;
2226

2327

2428
public class SpringBootSecurityTest {
2529
private LambdaHandler handler = new LambdaHandler();
2630
private MockLambdaContext context = new MockLambdaContext();
2731
private ObjectMapper mapper = new ObjectMapper();
2832

33+
@BeforeClass
34+
public static void before() {
35+
// We skip the tests if we are running against Spring 5.2.x - SpringBoot 1.5 is deprecated and no longer
36+
// breaking changes in the latest Spring releases have not been supported in it.
37+
// TODO: Update the check to verify any Spring version above 5.2
38+
assumeFalse(Objects.requireNonNull(SpringVersion.getVersion()).startsWith("5.2"));
39+
}
40+
2941
@Test
3042
public void correctUser_springSecurityBasicAuth_requestSucceeds() throws JsonProcessingException {
3143
String authValue = Base64.getMimeEncoder().encodeToString((TestSecurityConfig.USERNAME + ":" + TestSecurityConfig.PASSWORD).getBytes());

aws-serverless-java-container-spring/src/test/java/com/amazonaws/serverless/proxy/spring/embedded/ServerlessServletEmbeddedServerFactoryTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,30 @@
33
import com.amazonaws.serverless.exceptions.ContainerInitializationException;
44
import com.amazonaws.serverless.proxy.spring.SpringBootLambdaContainerHandler;
55
import com.amazonaws.serverless.proxy.spring.springbootapp.TestApplication;
6+
import org.junit.BeforeClass;
67
import org.junit.Test;
78
import org.springframework.boot.context.embedded.EmbeddedServletContainer;
89
import org.springframework.boot.context.embedded.EmbeddedServletContainerException;
910
import org.springframework.boot.web.servlet.ServletContextInitializer;
11+
import org.springframework.core.SpringVersion;
1012

1113
import javax.servlet.*;
1214
import java.io.IOException;
15+
import java.util.Objects;
1316

1417
import static org.junit.Assert.*;
18+
import static org.junit.Assume.assumeFalse;
1519

1620
public class ServerlessServletEmbeddedServerFactoryTest {
1721

22+
@BeforeClass
23+
public static void before() {
24+
// We skip the tests if we are running against Spring 5.2.x - SpringBoot 1.5 is deprecated and no longer
25+
// breaking changes in the latest Spring releases have not been supported in it.
26+
// TODO: Update the check to verify any Spring version above 5.2
27+
assumeFalse(Objects.requireNonNull(SpringVersion.getVersion()).startsWith("5.2"));
28+
}
29+
1830
// initialize a container handler to that the embedded factory can grab its instnace
1931
private SpringBootLambdaContainerHandler h = SpringBootLambdaContainerHandler.getAwsProxyHandler(TestApplication.class);
2032

0 commit comments

Comments
 (0)