Skip to content

Update smoke tests to avoid conflicts with NAME environment variable #31267

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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");
* you may not use this file except in compliance with the License.
Expand All @@ -22,7 +22,7 @@
@Component
public class HelloWorldService {

@Value("${name:World}")
@Value("${test.name:World}")
private String name;

public String getHelloMessage() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
name: Phil
test.name: Phil
Original file line number Diff line number Diff line change
@@ -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");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -60,7 +60,7 @@ void testDefaultSettings(CapturedOutput output) {

@Test
void testCommandLineOverrides(CapturedOutput output) {
SampleAopApplication.main(new String[] { "--name=Gordon" });
SampleAopApplication.main(new String[] { "--test.name=Gordon" });
assertThat(output).contains("Hello Gordon");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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");
* you may not use this file except in compliance with the License.
Expand All @@ -22,7 +22,7 @@
@Component
public class HelloWorldService {

@Value("${name:World}")
@Value("${test.name:World}")
private String name;

public String getHelloMessage() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
hello: Bonjour
test.hello: Bonjour
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class SampleProfileApplication implements CommandLineRunner {

// Simple example shows how a command line spring application can execute an
// 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
private MessageService helloWorldService;
Expand Down
Original file line number Diff line number Diff line change
@@ -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");
* you may not use this file except in compliance with the License.
Expand All @@ -24,10 +24,10 @@
@Profile({ "generic" })
public class GenericService implements MessageService {

@Value("${hello:Hello}")
@Value("${test.hello:Hello}")
private String hello;

@Value("${name:World}")
@Value("${test.name:World}")
private String name;

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -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");
* you may not use this file except in compliance with the License.
Expand All @@ -24,7 +24,7 @@
@Profile("goodbye")
public class GoodbyeWorldService implements MessageService {

@Value("${name:World}")
@Value("${test.name:World}")
private String name;

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -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");
* you may not use this file except in compliance with the License.
Expand All @@ -24,7 +24,7 @@
@Profile({ "hello", "default" })
public class HelloWorldService implements MessageService {

@Value("${name:World}")
@Value("${test.name:World}")
private String name;

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Phil
test.name: Phil

---

spring.config.activate.on-profile: goodbye | dev
name: Everyone
test.name: Everyone
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void testGenericProfile(CapturedOutput output) {
* 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
* partial overrides, and the default application.yml should still supply the
* "name" property.
* "test.name" property.
*/
System.setProperty("spring.profiles.active", "generic");
SampleProfileApplication.main();
Expand Down
Original file line number Diff line number Diff line change
@@ -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");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -30,7 +30,7 @@ public class SampleSimpleApplication implements CommandLineRunner {

// Simple example shows how a command line spring application can execute an
// 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
private HelloWorldService helloWorldService;
Expand Down
Original file line number Diff line number Diff line change
@@ -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");
* you may not use this file except in compliance with the License.
Expand All @@ -24,10 +24,10 @@
@Component
public class HelloWorldService {

@Value("${name:World}")
@Value("${test.name:World}")
private String name;

@Value("${duration:10s}")
@Value("${test.duration:10s}")
private Duration duration;

public String getHelloMessage() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name=Phil
test.name=Phil
sample.name=Andy

spring.banner.image.bitdepth=8
Original file line number Diff line number Diff line change
@@ -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");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -60,7 +60,7 @@ void testDefaultSettings(CapturedOutput output) {

@Test
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");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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");
* you may not use this file except in compliance with the License.
Expand All @@ -22,7 +22,7 @@
@Component
public class HelloWorldService {

@Value("${name:World}")
@Value("${test.name:World}")
private String name;

public String getHelloMessage() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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");
* you may not use this file except in compliance with the License.
Expand All @@ -22,7 +22,7 @@
@Component
public class HelloWorldService {

@Value("${name:World}")
@Value("${test.name:World}")
private String name;

public String getHelloMessage() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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");
* you may not use this file except in compliance with the License.
Expand All @@ -22,7 +22,7 @@
@Component
public class HelloWorldService {

@Value("${name:World}")
@Value("${test.name:World}")
private String name;

public String getHelloMessage() {
Expand Down