Skip to content

Commit

Permalink
feat: temporarily remove handing exception
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadilipkolli committed Nov 22, 2023
1 parent e337061 commit eccc258
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
3 changes: 2 additions & 1 deletion aws-lambda-project/.localstack/01_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ awslocal lambda create-function \
--handler org.springframework.cloud.function.adapter.aws.FunctionInvoker::handleRequest \
--role "$IAM_ROLE_ARN" \
--zip-file "fileb://$JAR_FILE" \
--environment "$ENV_VARS"
--environment "$ENV_VARS" \
--description "Spring Cloud Function AWS Adapter Example"

echo -e "Lambda function created successfully!\n"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.learning.awslambda.services;

import com.learning.awslambda.entities.Actor;
import com.learning.awslambda.exception.ActorNotFoundException;
import com.learning.awslambda.mapper.ActorMapper;
import com.learning.awslambda.model.response.ActorResponse;
import com.learning.awslambda.repositories.ActorRepository;
Expand All @@ -28,10 +27,6 @@ public ActorService(ActorRepository actorRepository, ActorMapper actorMapper) {
public List<ActorResponse> findActorByName(String name) {
LOGGER.info("Finding Actors By Name :{}", name);
List<Actor> actorList = actorRepository.findByNameLike(name);
if (actorList.isEmpty()) {
throw new ActorNotFoundException(name);
} else {
return actorMapper.toResponseList(actorList);
}
return actorMapper.toResponseList(actorList);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ spring.jmx.enabled=false
spring.mvc.problemdetails.enabled=true

################ Actuator #####################
management.endpoints.web.exposure.include=configprops,env,health,info,logfile,loggers,metrics,prometheus
management.endpoints.web.exposure.include=configprops,env,health,info,logfile,loggers,metrics,prometheus,functions
management.endpoint.health.show-details=always

################ Database #####################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ class ApplicationIntegrationTest {
@Container
static PostgreSQLContainer<?> postgres = new PostgreSQLContainer<>("postgres:16.1-alpine")
.withNetwork(network)
.withNetworkAliases("postgres");
.withNetworkAliases("postgres")
.withReuse(true);

@Container
static LocalStackContainer localstack = new LocalStackContainer(
Expand All @@ -69,7 +70,8 @@ class ApplicationIntegrationTest {
.withEnv("LAMBDA_DOCKER_NETWORK", ((Network.NetworkImpl) network).getName())
.withEnv("LAMBDA_RUNTIME_ENVIRONMENT_TIMEOUT", "30")
.withNetworkAliases("localstack")
.withEnv("LAMBDA_DOCKER_FLAGS", testContainersLabels());
.withEnv("LAMBDA_DOCKER_FLAGS", testContainersLabels())
.withReuse(true);

private static String testContainersLabels() {
return Stream.of(
Expand Down Expand Up @@ -103,6 +105,7 @@ void contextLoads() throws IOException {
.timeout(10)
.handler("org.springframework.cloud.function.adapter.aws.FunctionInvoker::handleRequest")
.environment(Environment.builder().variables(envVars).build())
.description("Spring Cloud Function AWS Adapter Example")
.build();

LambdaClient lambdaClient = LambdaClient.builder()
Expand Down Expand Up @@ -140,7 +143,7 @@ void contextLoads() throws IOException {
.andReturn()
.body();
assertThat(responseBody.asString())
.isEqualTo(
.isEqualToIgnoringWhitespace(
"""
[{"id":1,"name":"profile-1"},{"id":2,"name":"profile-2"},{"id":3,"name":"profile-3"},{"id":4,"name":"profile-4"}]
""");
Expand Down

0 comments on commit eccc258

Please sign in to comment.