Skip to content

Commit

Permalink
Fixing tests. Commenting out right now "allowAllOutbound" as this sho…
Browse files Browse the repository at this point in the history
…uld be configured in the provided securityGroups
  • Loading branch information
andrew2184 committed Dec 23, 2023
1 parent c2deab3 commit 5568221
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 24 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
<dependency>
<groupId>software.amazon.awscdk</groupId>
<artifactId>aws-cdk-lib</artifactId>
<version>2.115.0</version>
<version>2.116.1</version>
</dependency>
<!-- AWS CDK ENDS -->

Expand Down
2 changes: 1 addition & 1 deletion spring-native-aws-lambda-infra/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</developers>

<properties>
<java.version>20</java.version>
<java.version>21</java.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import static com.google.common.base.Preconditions.checkArgument;
import static org.apache.commons.collections4.MapUtils.isNotEmpty;
import static org.apache.commons.lang3.StringUtils.isNoneBlank;
import static software.amazon.awscdk.services.lambda.Runtime.PROVIDED_AL2;
import static software.amazon.awscdk.services.lambda.Runtime.PROVIDED_AL2023;

import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -80,7 +80,7 @@ private CustomRuntime2Function(@NotNull final Construct scope, @NotNull final St
*/
@Override
public @NotNull Runtime getRuntime() {
return PROVIDED_AL2;
return PROVIDED_AL2023;
}

public static final class Builder implements
Expand All @@ -104,7 +104,7 @@ private Builder(final Construct scope, final String id) {
this.id = id;
this.props = new FunctionProps.Builder();

this.props.runtime(PROVIDED_AL2);
this.props.runtime(PROVIDED_AL2023);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import static org.assertj.core.api.Assertions.assertThat;
import static software.amazon.awscdk.services.ec2.Vpc.Builder.create;
import static software.amazon.awscdk.services.iam.Role.fromRoleArn;
import static software.amazon.awscdk.services.lambda.Runtime.PROVIDED_AL2;
import static software.amazon.awscdk.services.lambda.Runtime.PROVIDED_AL2023;
import static software.amazon.awscdk.services.sns.Topic.fromTopicArn;
import static software.amazon.awscdk.services.sqs.DeduplicationScope.MESSAGE_GROUP;

Expand Down Expand Up @@ -193,7 +193,7 @@ void should_create_and_return_lambda_function() {
.hasFieldOrProperty("timeout");

assertThat(actual.getRuntime())
.isEqualTo(PROVIDED_AL2);
.isEqualTo(PROVIDED_AL2023);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void should_have_lambda_function() {
.hasEnvironmentVariable("SPRING_PROFILES_ACTIVE", TEST)
.hasDescription("Lambda example with spring native")
.hasMemorySize(512)
.hasRuntime("provided.al2")
.hasRuntime("provided.al2023")
.hasTimeout(3);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
/*
* Licensed to Muhammad Hamadto
* Licensed to Muhammad Hamadto
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* See the NOTICE file distributed with this work for additional information regarding copyright ownership.
* See the NOTICE file distributed with this work for additional information regarding copyright ownership.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
*/

Expand All @@ -22,7 +18,7 @@
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static software.amazon.awscdk.services.lambda.Architecture.ARM_64;
import static software.amazon.awscdk.services.lambda.CodeSigningConfig.fromCodeSigningConfigArn;
import static software.amazon.awscdk.services.lambda.Runtime.PROVIDED_AL2;
import static software.amazon.awscdk.services.lambda.Runtime.PROVIDED_AL2023;
import static software.amazon.awscdk.services.sns.Topic.fromTopicArn;

import com.coffeebeans.springnativeawslambda.infra.TestLambdaUtils;
Expand Down Expand Up @@ -84,7 +80,7 @@ void setUp() throws IOException {
.onFailure(onFailure)
.onSuccess(onSuccess)
.retryAttempts(2)
.allowAllOutbound(true)
// .allowAllOutbound(true)
.allowPublicSubnet(false)
.architecture(ARM_64)
.codeSigningConfig(fromCodeSigningConfigArn(stack, "test-code-signing-config",
Expand Down Expand Up @@ -137,7 +133,7 @@ void should_create_and_return_function() {
.isNotNull();

assertThat(actual.getRuntime())
.isEqualTo(PROVIDED_AL2);
.isEqualTo(PROVIDED_AL2023);

assertThat(actual.getTimeout())
.isEqualTo(timeout);
Expand All @@ -154,7 +150,7 @@ void should_create_and_return_function_when_with_default_timeout() {

assertThat(actual.getTimeout()
.toSeconds()) // actual.getTimeout() won't be null Builder#timeout() has a default value of 10 seconds
.isEqualTo(DEFAULT_TIMEOUT.toSeconds());
.isEqualTo(DEFAULT_TIMEOUT.toSeconds());
}

@Test
Expand Down Expand Up @@ -270,4 +266,4 @@ void should_throw_exception_when_function_memory_size_is_larger_than_two() {
.hasFieldOrPropertyWithValue("message",
"'retryAttempts' must be between 0 and 2 (inclusive)");
}
}
}

0 comments on commit 5568221

Please sign in to comment.