-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(flagd): rework e2e tests to new format
Signed-off-by: Simon Schrottner <[email protected]>
- Loading branch information
Showing
36 changed files
with
557 additions
and
1,446 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 0 additions & 97 deletions
97
...ders/flagd/src/test/java/dev/openfeature/contrib/providers/flagd/e2e/ContainerConfig.java
This file was deleted.
Oops, something went wrong.
76 changes: 76 additions & 0 deletions
76
...iders/flagd/src/test/java/dev/openfeature/contrib/providers/flagd/e2e/FlagdContainer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package dev.openfeature.contrib.providers.flagd.e2e; | ||
|
||
import dev.openfeature.contrib.providers.flagd.Config; | ||
import org.apache.logging.log4j.util.Strings; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.testcontainers.containers.GenericContainer; | ||
import org.testcontainers.containers.Network; | ||
import org.testcontainers.containers.wait.strategy.Wait; | ||
import org.testcontainers.containers.wait.strategy.WaitStrategy; | ||
import org.testcontainers.utility.DockerImageName; | ||
import org.testcontainers.utility.MountableFile; | ||
|
||
import java.io.File; | ||
import java.nio.file.Files; | ||
import java.util.List; | ||
|
||
public class FlagdContainer extends GenericContainer<FlagdContainer> { | ||
private static final String version; | ||
private static final Network network = Network.newNetwork(); | ||
|
||
static { | ||
String path = "test-harness/version.txt"; | ||
File file = new File(path); | ||
try { | ||
List<String> lines = Files.readAllLines(file.toPath()); | ||
version = lines.get(0); | ||
} catch (Exception e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
public FlagdContainer() { | ||
this(""); | ||
} | ||
|
||
public FlagdContainer(String feature) { | ||
super(generateContainerName(feature)); | ||
this.addExposedPorts(8013, 8014, 8015, 8016); | ||
} | ||
|
||
public int getPort(Config.Resolver resolver) { | ||
waitUntilContainerStarted(); | ||
switch (resolver) { | ||
case RPC: | ||
return this.getMappedPort(8013); | ||
case IN_PROCESS: | ||
return this.getMappedPort(8015); | ||
default: | ||
throw new IllegalArgumentException("Unsupported resolver: " + resolver); | ||
} | ||
} | ||
|
||
|
||
/** | ||
* @return a {@link org.testcontainers.containers.GenericContainer} instance of envoy container using | ||
* flagd sync service as backend expose on port 9211 | ||
*/ | ||
public static GenericContainer envoy() { | ||
final String container = "envoyproxy/envoy:v1.31.0"; | ||
return new GenericContainer(DockerImageName.parse(container)) | ||
.withCopyFileToContainer(MountableFile.forClasspathResource("/envoy-config/envoy-custom.yaml"), | ||
"/etc/envoy/envoy.yaml") | ||
.withExposedPorts(9211) | ||
.withNetwork(network) | ||
.withNetworkAliases("envoy"); | ||
} | ||
|
||
public static @NotNull String generateContainerName(String feature) { | ||
String container = "ghcr.io/open-feature/flagd-testbed"; | ||
if (!Strings.isBlank(feature)) { | ||
container += "-" + feature; | ||
} | ||
container += ":v" + version; | ||
return container; | ||
} | ||
} |
24 changes: 0 additions & 24 deletions
24
...lagd/src/test/java/dev/openfeature/contrib/providers/flagd/e2e/RunConfigCucumberTest.java
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
.../test/java/dev/openfeature/contrib/providers/flagd/e2e/RunFlagdInProcessCucumberTest.java
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
.../java/dev/openfeature/contrib/providers/flagd/e2e/RunFlagdInProcessEnvoyCucumberTest.java
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
...a/dev/openfeature/contrib/providers/flagd/e2e/RunFlagdInProcessReconnectCucumberTest.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.