-
Notifications
You must be signed in to change notification settings - Fork 705
Can't override properties from bootstrap.yml in profile specific bootstrap file #156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The current workaround for this is to use a static block like this: @RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@AutoConfigureStubRunner(ids = {"com.ryanjbaxter.spring.cloud:ocr-participants:+:stubs"}, workOffline = true)
@DirtiesContext
@ActiveProfiles("test")
public class OcrRacesApplicationTestsBase {
@Autowired
protected ParticipantsService participantsService;
private List<Participant> participants = new ArrayList<>();
//Hack to work around https://github.com/spring-cloud/spring-cloud-commons/issues/156
static {
System.setProperty("eureka.client.enabled", "false");
System.setProperty("spring.cloud.config.failFast", "false");
}
@Before
public void setup() {
this.participants = new ArrayList<>();
this.participants.add(new Participant("Ryan", "Baxter", "MA", "S", Arrays.asList("123", "456")));
this.participants.add(new Participant("Stephanie", "Baxter", "MA", "S", Arrays.asList("456")));
}
@After
public void tearDown() {
this.participants = new ArrayList<>();
}
@Test
public void contextLoads() {
List<Participant> participantList = participantsService.getAllParticipants();
assertEquals(participants, participantList);
}
} |
This works in general, so I wonder if it is specific to tests and |
hmm, I wrote a test that uses |
The workaround specified by Marcin works fine, but if a test fails, the failure reason does not offer any indication on what the problem is, but it points to Hystrix. |
While using the following versions:
the static block is not needed anymore while having the following configuration in bootstrap.yml:
|
So we can close it since it got fixed in Dalston. |
Having
bootstrap.yml
in the main sourcesand having the
bootstrap-ci.yml
and@ActiveProfiles("ci")
in the testsDoesn't lead to overriding the values from
bootstrap.yml
. In other words the app is always trying to connect to Consul.Related issues:
spring-cloud/spring-cloud-contract#174
spring-cloud/spring-cloud-contract#141
The text was updated successfully, but these errors were encountered: