It's my first time implementing a Spring application using Spring Cloud Config framework. The application is working fine, getting configuration properties from repository through the server application. So, at the moment I must write the integration tests to test connection between client application and server and repository. To do it I mean get a value from repository over properties and check the value, also make a request to the server, or if exists, other method inside spring cloud config library to make it.
The problem now, when executing the integrationTest the application can't read the properties from remote. I've created a bootstrap.yml
on the integrationTest context but not works. So, I got the errors like: Could not resolve placeholder
.
MyIntegrationTest
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest()
@ActiveProfiles("integrationTest")
public class MyIntegrationTest {
@Value("${throttling.request.rate.minute}")
private int MAX_REQUEST_PER_MINUTE;
@Test
public void validateGetRequestRateLimitFromRepository() {
Assert.assertNotEquals(MAX_REQUEST_PER_MINUTE,1L);
}
}
bootstrap.yml
spring:
application:
name: sample-name
---
spring:
profiles: local #also tried integrationTest
cloud:
config:
enabled: true
uri: https://endpoint-uri:443
skipSslValidation: true
name: ${spring.application.name},${spring.application.name}-${spring.profiles}
Also tried:
- Set
application-integrationTest.yml
- Set
application.yml
- Set
bootstrap-integrationTest.yml
- Create a
*-integrationTest.yml
at the repo. - Set
@ActiveProfiles("local")
on integrationTest class.
Nothing works.