Skip to content

Commit f230cb5

Browse files
committed
fix
1 parent 3e34eb3 commit f230cb5

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

javaagent-tooling/src/testConfigFile/java/io/opentelemetry/javaagent/tooling/config/ConfigurationFileTest.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,19 @@
1717
import org.junit.jupiter.api.Test;
1818
import org.junit.jupiter.api.extension.ExtendWith;
1919
import org.junit.jupiter.api.io.TempDir;
20-
import org.junitpioneer.jupiter.ClearSystemProperty;
2120
import uk.org.webcompere.systemstubs.environment.EnvironmentVariables;
2221
import uk.org.webcompere.systemstubs.jupiter.SystemStub;
2322
import uk.org.webcompere.systemstubs.jupiter.SystemStubsExtension;
23+
import uk.org.webcompere.systemstubs.properties.SystemProperties;
2424

2525
@ExtendWith(SystemStubsExtension.class)
26-
@ClearSystemProperty(key = "otel.javaagent.configuration-file")
2726
class ConfigurationFileTest {
2827

2928
@TempDir File tmpDir;
3029

3130
@SystemStub private EnvironmentVariables environmentVariables;
3231

33-
// @SystemStub private SystemProperties systemProperties;
32+
@SystemStub private SystemProperties systemProperties;
3433

3534
@Test
3635
void shouldUseEnvVar() throws IOException {
@@ -45,7 +44,7 @@ void shouldUseEnvVar() throws IOException {
4544
@Test
4645
void shouldUseSystemProperty() throws IOException {
4746
String path = createFile("config", "property1=val-sys");
48-
System.setProperty("otel.javaagent.configuration-file", path);
47+
systemProperties.set("otel.javaagent.configuration-file", path);
4948

5049
Map<String, String> properties = ConfigurationFile.loadConfigFile();
5150

@@ -56,7 +55,7 @@ void shouldUseSystemProperty() throws IOException {
5655
void shouldUseSystemPropertyOverEnvVar() throws IOException {
5756
String pathEnv = createFile("configEnv", "property1=val-env");
5857
String path = createFile("config", "property1=val-sys");
59-
System.setProperty("otel.javaagent.configuration-file", path);
58+
systemProperties.set("otel.javaagent.configuration-file", path);
6059
environmentVariables.set("OTEL_JAVAAGENT_CONFIGURATION_FILE", pathEnv);
6160

6261
Map<String, String> properties = ConfigurationFile.loadConfigFile();
@@ -66,7 +65,7 @@ void shouldUseSystemPropertyOverEnvVar() throws IOException {
6665

6766
@Test
6867
void shouldReturnEmptyPropertiesIfFileDoesNotExist() {
69-
System.setProperty("otel.javaagent.configuration-file", "somePath");
68+
systemProperties.set("otel.javaagent.configuration-file", "somePath");
7069

7170
Map<String, String> properties = ConfigurationFile.loadConfigFile();
7271

0 commit comments

Comments
 (0)