Skip to content
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

feat: add JUnit Pioneer as testing dependency #820

Merged
Merged
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
11 changes: 9 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<version>1.18.32</version>
<scope>provided</scope>
</dependency>

<dependency>
<!-- used so that lombok can generate suppressions for spotbugs. It needs to find it on the relevant classpath -->
<groupId>com.github.spotbugs</groupId>
Expand Down Expand Up @@ -140,6 +140,13 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit-pioneer</groupId>
<artifactId>junit-pioneer</artifactId>
<version>1.9.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
Expand Down Expand Up @@ -435,4 +442,4 @@
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import io.opentelemetry.api.OpenTelemetry;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junitpioneer.jupiter.SetEnvironmentVariable;
import org.mockito.Mockito;

import java.util.function.Function;
Expand Down Expand Up @@ -88,7 +89,7 @@ void testValueProviderForEdgeCase_invalid() {
}

@Test
@Disabled("Currently there is no defined way on how to set environment variables for tests")
@SetEnvironmentVariable(key = RESOLVER_ENV_VAR, value = RESOLVER_IN_PROCESS)
void testInProcessProviderFromEnv_noPortConfigured_defaultsToCorrectPort() {
FlagdOptions flagdOptions = FlagdOptions.builder().build();

Expand All @@ -107,7 +108,7 @@ void testInProcessProvider_noPortConfigured_defaultsToCorrectPort() {
}

@Test
@Disabled("Currently there is no defined way on how to set environment variables for tests")
@SetEnvironmentVariable(key = RESOLVER_ENV_VAR, value = RESOLVER_IN_PROCESS)
void testInProcessProviderFromEnv_portConfigured_usesConfiguredPort() {
FlagdOptions flagdOptions = FlagdOptions.builder()
.port(1000)
Expand All @@ -118,7 +119,7 @@ void testInProcessProviderFromEnv_portConfigured_usesConfiguredPort() {
}

@Test
@Disabled("Currently there is no defined way on how to set environment variables for tests")
@SetEnvironmentVariable(key = RESOLVER_ENV_VAR, value = RESOLVER_RPC)
void testRpcProviderFromEnv_noPortConfigured_defaultsToCorrectPort() {
FlagdOptions flagdOptions = FlagdOptions.builder().build();

Expand All @@ -137,7 +138,7 @@ void testRpcProvider_noPortConfigured_defaultsToCorrectPort() {
}

@Test
@Disabled("Currently there is no defined way on how to set environment variables for tests")
@SetEnvironmentVariable(key = RESOLVER_ENV_VAR, value = RESOLVER_RPC)
void testRpcProviderFromEnv_portConfigured_usesConfiguredPort() {
FlagdOptions flagdOptions = FlagdOptions.builder()
.port(1534)
Expand Down