Update smoke tests to avoid conflicts with NAME environment variable

This commit updates several smoke tests in order to avoid conflicts
with NAME environment variable that is present in WSL and causes
project build to fail. Previous attempt to fix this in 7da42d71 was
incomplete.

See gh-31267
This commit is contained in:
Vedran Pavic 2022-06-07 14:37:12 +02:00 committed by Andy Wilkinson
parent bbb5966bca
commit 95e0d6c0f7
18 changed files with 33 additions and 33 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2022 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -22,7 +22,7 @@ import org.springframework.stereotype.Component;
@Component @Component
public class HelloWorldService { public class HelloWorldService {
@Value("${name:World}") @Value("${test.name:World}")
private String name; private String name;
public String getHelloMessage() { public String getHelloMessage() {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2021 the original author or authors. * Copyright 2012-2022 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -60,7 +60,7 @@ class SampleAopApplicationTests {
@Test @Test
void testCommandLineOverrides(CapturedOutput output) { void testCommandLineOverrides(CapturedOutput output) {
SampleAopApplication.main(new String[] { "--name=Gordon" }); SampleAopApplication.main(new String[] { "--test.name=Gordon" });
assertThat(output).contains("Hello Gordon"); assertThat(output).contains("Hello Gordon");
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2022 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -22,7 +22,7 @@ import org.springframework.stereotype.Component;
@Component @Component
public class HelloWorldService { public class HelloWorldService {
@Value("${name:World}") @Value("${test.name:World}")
private String name; private String name;
public String getHelloMessage() { public String getHelloMessage() {

View File

@ -1 +1 @@
hello: Bonjour test.hello: Bonjour

View File

@ -30,7 +30,7 @@ public class SampleProfileApplication implements CommandLineRunner {
// Simple example shows how a command line spring application can execute an // Simple example shows how a command line spring application can execute an
// injected bean service. Also demonstrates how you can use @Value to inject // injected bean service. Also demonstrates how you can use @Value to inject
// command line args ('--name=whatever') or application properties // command line args ('--test.name=whatever') or application properties
@Autowired @Autowired
private MessageService helloWorldService; private MessageService helloWorldService;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2022 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -24,10 +24,10 @@ import org.springframework.stereotype.Component;
@Profile({ "generic" }) @Profile({ "generic" })
public class GenericService implements MessageService { public class GenericService implements MessageService {
@Value("${hello:Hello}") @Value("${test.hello:Hello}")
private String hello; private String hello;
@Value("${name:World}") @Value("${test.name:World}")
private String name; private String name;
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2022 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -24,7 +24,7 @@ import org.springframework.stereotype.Component;
@Profile("goodbye") @Profile("goodbye")
public class GoodbyeWorldService implements MessageService { public class GoodbyeWorldService implements MessageService {
@Value("${name:World}") @Value("${test.name:World}")
private String name; private String name;
@Override @Override

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2022 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -24,7 +24,7 @@ import org.springframework.stereotype.Component;
@Profile({ "hello", "default" }) @Profile({ "hello", "default" })
public class HelloWorldService implements MessageService { public class HelloWorldService implements MessageService {
@Value("${name:World}") @Value("${test.name:World}")
private String name; private String name;
@Override @Override

View File

@ -1,6 +1,6 @@
name: Phil test.name: Phil
--- ---
spring.config.activate.on-profile: goodbye | dev spring.config.activate.on-profile: goodbye | dev
name: Everyone test.name: Everyone

View File

@ -65,7 +65,7 @@ class SampleProfileApplicationTests {
* This is a profile that requires a new environment property, and one which is * This is a profile that requires a new environment property, and one which is
* only overridden in the current working directory. That file also only contains * only overridden in the current working directory. That file also only contains
* partial overrides, and the default application.yml should still supply the * partial overrides, and the default application.yml should still supply the
* "name" property. * "test.name" property.
*/ */
System.setProperty("spring.profiles.active", "generic"); System.setProperty("spring.profiles.active", "generic");
SampleProfileApplication.main(); SampleProfileApplication.main();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2020 the original author or authors. * Copyright 2012-2022 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -30,7 +30,7 @@ public class SampleSimpleApplication implements CommandLineRunner {
// Simple example shows how a command line spring application can execute an // Simple example shows how a command line spring application can execute an
// injected bean service. Also demonstrates how you can use @Value to inject // injected bean service. Also demonstrates how you can use @Value to inject
// command line args ('--name=whatever') or application properties // command line args ('--test.name=whatever') or application properties
@Autowired @Autowired
private HelloWorldService helloWorldService; private HelloWorldService helloWorldService;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2022 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -24,10 +24,10 @@ import org.springframework.stereotype.Component;
@Component @Component
public class HelloWorldService { public class HelloWorldService {
@Value("${name:World}") @Value("${test.name:World}")
private String name; private String name;
@Value("${duration:10s}") @Value("${test.duration:10s}")
private Duration duration; private Duration duration;
public String getHelloMessage() { public String getHelloMessage() {

View File

@ -1,4 +1,4 @@
name=Phil test.name=Phil
sample.name=Andy sample.name=Andy
spring.banner.image.bitdepth=8 spring.banner.image.bitdepth=8

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2022 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -60,7 +60,7 @@ class SampleSimpleApplicationTests {
@Test @Test
void testCommandLineOverrides(CapturedOutput output) { void testCommandLineOverrides(CapturedOutput output) {
SampleSimpleApplication.main(new String[] { "--name=Gordon", "--duration=1m" }); SampleSimpleApplication.main(new String[] { "--test.name=Gordon", "--test.duration=1m" });
assertThat(output).contains("Hello Gordon for 60 seconds"); assertThat(output).contains("Hello Gordon for 60 seconds");
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2022 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -22,7 +22,7 @@ import org.springframework.stereotype.Component;
@Component @Component
public class HelloWorldService { public class HelloWorldService {
@Value("${name:World}") @Value("${test.name:World}")
private String name; private String name;
public String getHelloMessage() { public String getHelloMessage() {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2022 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -22,7 +22,7 @@ import org.springframework.stereotype.Component;
@Component @Component
public class HelloWorldService { public class HelloWorldService {
@Value("${name:World}") @Value("${test.name:World}")
private String name; private String name;
public String getHelloMessage() { public String getHelloMessage() {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2022 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -22,7 +22,7 @@ import org.springframework.stereotype.Component;
@Component @Component
public class HelloWorldService { public class HelloWorldService {
@Value("${name:World}") @Value("${test.name:World}")
private String name; private String name;
public String getHelloMessage() { public String getHelloMessage() {