How to deploy Spring Boot Integration Testing in the Pipeline

Viewed 117

I have a microservice which has 2 modules

my-microservice-app

my-microservice-it

(gonna refer them as "app" and "it")

Right now I am writing integration tests for graphql and here is how I run this on my local.

1- I added "app" as a dependency to the "it" (to pom.xml)

2- Import my main class from "app" module to one of the configuration classes of "it" module

@Configuration
@Import(CaseManagementApplication.class)
public class Application {

3- Set my configuration class in SpringBootTest annotation

@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Application.class)
@ActiveProfiles("test")
public class GraphQLIT extends AbstractTestNGSpringContextTests {

Only thing I override in the application-test.yml file is postgre db because I don't want any crud operations in my prod db every time this integration tests run.

I will have a postgre db instance in the pipeline but I can't figure out how I am supposed to create an environment to run this integration test module in GitLab pipeline.

0 Answers
Related