-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Pradeep <pradeepbbl@gmail.com>
- Loading branch information
1 parent
cce43cd
commit 8d7cee6
Showing
6 changed files
with
154 additions
and
6 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
27 changes: 27 additions & 0 deletions
27
.../java/dev/openfeature/contrib/providers/flagd/e2e/RunFlagdInProcessEnvoyCucumberTest.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,27 @@ | ||
package dev.openfeature.contrib.providers.flagd.e2e; | ||
|
||
import org.junit.jupiter.api.Order; | ||
import org.junit.platform.suite.api.ConfigurationParameter; | ||
import org.junit.platform.suite.api.IncludeEngines; | ||
import org.junit.platform.suite.api.SelectClasspathResource; | ||
import org.junit.platform.suite.api.Suite; | ||
import org.testcontainers.junit.jupiter.Testcontainers; | ||
|
||
import static io.cucumber.junit.platform.engine.Constants.GLUE_PROPERTY_NAME; | ||
import static io.cucumber.junit.platform.engine.Constants.PLUGIN_PROPERTY_NAME; | ||
|
||
/** | ||
* Class for running the tests associated with "stable" e2e tests (no fake disconnection) for the in-process provider | ||
*/ | ||
@Order(value = Integer.MAX_VALUE) | ||
@Suite | ||
@IncludeEngines("cucumber") | ||
@SelectClasspathResource("features/evaluation.feature") | ||
@SelectClasspathResource("features/flagd-json-evaluator.feature") | ||
@SelectClasspathResource("features/flagd.feature") | ||
@ConfigurationParameter(key = PLUGIN_PROPERTY_NAME, value = "pretty") | ||
@ConfigurationParameter(key = GLUE_PROPERTY_NAME, value = "dev.openfeature.contrib.providers.flagd.e2e.process.envoy,dev.openfeature.contrib.providers.flagd.e2e.steps") | ||
@Testcontainers | ||
public class RunFlagdInProcessEnvoyCucumberTest { | ||
|
||
} |
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
45 changes: 45 additions & 0 deletions
45
...t/java/dev/openfeature/contrib/providers/flagd/e2e/process/envoy/FlagdInProcessSetup.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,45 @@ | ||
package dev.openfeature.contrib.providers.flagd.e2e.process.envoy; | ||
|
||
import dev.openfeature.contrib.providers.flagd.Config; | ||
import dev.openfeature.contrib.providers.flagd.FlagdOptions; | ||
import dev.openfeature.contrib.providers.flagd.FlagdProvider; | ||
import dev.openfeature.contrib.providers.flagd.e2e.ContainerConfig; | ||
import dev.openfeature.contrib.providers.flagd.e2e.steps.StepDefinitions; | ||
import dev.openfeature.sdk.FeatureProvider; | ||
import io.cucumber.java.AfterAll; | ||
import io.cucumber.java.BeforeAll; | ||
import org.junit.jupiter.api.Order; | ||
import org.junit.jupiter.api.parallel.Isolated; | ||
import org.testcontainers.containers.GenericContainer; | ||
|
||
@Isolated() | ||
@Order(value = Integer.MAX_VALUE) | ||
public class FlagdInProcessSetup { | ||
|
||
private static FeatureProvider provider; | ||
|
||
private static final GenericContainer flagdContainer = ContainerConfig.sync(false, true); | ||
private static final GenericContainer envoyContainer = ContainerConfig.envoy(); | ||
|
||
@BeforeAll() | ||
public static void setup() throws InterruptedException { | ||
flagdContainer.start(); | ||
envoyContainer.start(); | ||
final String targetUri = String.format("envoy://localhost:%s/flagd-sync.service", | ||
envoyContainer.getFirstMappedPort()); | ||
|
||
FlagdInProcessSetup.provider = new FlagdProvider(FlagdOptions.builder() | ||
.resolverType(Config.Resolver.IN_PROCESS) | ||
// set a generous deadline, to prevent timeouts in actions | ||
.deadline(3000) | ||
.targetUri(targetUri) | ||
.build()); | ||
StepDefinitions.setProvider(provider); | ||
} | ||
|
||
@AfterAll | ||
public static void tearDown() { | ||
flagdContainer.stop(); | ||
envoyContainer.stop(); | ||
} | ||
} |
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
49 changes: 49 additions & 0 deletions
49
providers/flagd/src/test/resources/envoy-config/envoy-custom.yaml
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,49 @@ | ||
static_resources: | ||
listeners: | ||
- name: local-envoy | ||
address: | ||
socket_address: | ||
address: 0.0.0.0 | ||
port_value: 9211 | ||
filter_chains: | ||
- filters: | ||
- name: envoy.filters.network.http_connection_manager | ||
typed_config: | ||
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager | ||
stat_prefix: ingress_http | ||
access_log: | ||
- name: envoy.access_loggers.stdout | ||
typed_config: | ||
"@type": type.googleapis.com/envoy.extensions.access_loggers.stream.v3.StdoutAccessLog | ||
http_filters: | ||
- name: envoy.filters.http.router | ||
typed_config: | ||
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router | ||
route_config: | ||
name: local_route | ||
virtual_hosts: | ||
- name: local_service | ||
domains: | ||
- "flagd-sync.service" | ||
routes: | ||
- match: | ||
prefix: "/" | ||
grpc: {} | ||
route: | ||
cluster: local-sync-service | ||
|
||
clusters: | ||
- name: local-sync-service | ||
type: LOGICAL_DNS | ||
# Comment out the following line to test on v6 networks | ||
dns_lookup_family: V4_ONLY | ||
http2_protocol_options: {} | ||
load_assignment: | ||
cluster_name: local-sync-service | ||
endpoints: | ||
- lb_endpoints: | ||
- endpoint: | ||
address: | ||
socket_address: | ||
address: sync-service | ||
port_value: 9090 |