-
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
33 changed files
with
648 additions
and
1,333 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
100 changes: 0 additions & 100 deletions
100
...ders/flagd/src/test/java/dev/openfeature/contrib/providers/flagd/e2e/ContainerConfig.java
This file was deleted.
Oops, something went wrong.
89 changes: 89 additions & 0 deletions
89
...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,89 @@ | ||
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); | ||
} | ||
} | ||
|
||
private String feature; | ||
|
||
public FlagdContainer() { | ||
this(""); | ||
} | ||
|
||
public FlagdContainer(String feature) { | ||
super(generateContainerName(feature)); | ||
this.withReuse(true); | ||
this.feature = feature; | ||
if (!"socket".equals(this.feature)) | ||
this.addExposedPorts(8013, 8014, 8015, 8016); | ||
} | ||
|
||
@Override | ||
public void start() { | ||
if (!"socket".equals(this.feature)) | ||
this.addExposedPorts(8013, 8014, 8015, 8016); | ||
super.start(); | ||
waitUntilContainerStarted(); | ||
} | ||
|
||
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; | ||
} | ||
} |
29 changes: 0 additions & 29 deletions
29
.../test/java/dev/openfeature/contrib/providers/flagd/e2e/RunFlagdInProcessCucumberTest.java
This file was deleted.
Oops, something went wrong.
29 changes: 0 additions & 29 deletions
29
.../java/dev/openfeature/contrib/providers/flagd/e2e/RunFlagdInProcessEnvoyCucumberTest.java
This file was deleted.
Oops, something went wrong.
24 changes: 0 additions & 24 deletions
24
...a/dev/openfeature/contrib/providers/flagd/e2e/RunFlagdInProcessReconnectCucumberTest.java
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
...st/java/dev/openfeature/contrib/providers/flagd/e2e/RunFlagdInProcessSSLCucumberTest.java
This file was deleted.
Oops, something went wrong.
29 changes: 0 additions & 29 deletions
29
...gd/src/test/java/dev/openfeature/contrib/providers/flagd/e2e/RunFlagdRpcCucumberTest.java
This file was deleted.
Oops, something went wrong.
24 changes: 0 additions & 24 deletions
24
...st/java/dev/openfeature/contrib/providers/flagd/e2e/RunFlagdRpcReconnectCucumberTest.java
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
...src/test/java/dev/openfeature/contrib/providers/flagd/e2e/RunFlagdRpcSSLCucumberTest.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.