diff --git a/providers/flagd/pom.xml b/providers/flagd/pom.xml index 5c7808528..138adc430 100644 --- a/providers/flagd/pom.xml +++ b/providers/flagd/pom.xml @@ -90,7 +90,7 @@ com.networknt json-schema-validator - 1.5.4 + 1.5.5 org.apache.commons @@ -155,12 +155,15 @@ 1.20.4 test + + diff --git a/providers/flagd/src/main/java/dev/openfeature/contrib/providers/flagd/FlagdProvider.java b/providers/flagd/src/main/java/dev/openfeature/contrib/providers/flagd/FlagdProvider.java index b0e1defb4..d662900e0 100644 --- a/providers/flagd/src/main/java/dev/openfeature/contrib/providers/flagd/FlagdProvider.java +++ b/providers/flagd/src/main/java/dev/openfeature/contrib/providers/flagd/FlagdProvider.java @@ -111,7 +111,8 @@ public synchronized void initialize(EvaluationContext evaluationContext) throws this.flagResolver.init(); // block till ready - this works with deadline fine for rpc, but with in_process we also need to take parsing // into the equation - Util.busyWaitAndCheck(this.deadline + 1000, () -> initialized); + // TODO: evaluate where we are losing time, so we can remove this magic number - follow up + Util.busyWaitAndCheck(this.deadline + 200, () -> initialized); } @Override @@ -184,6 +185,7 @@ EvaluationContext getEnrichedContext() { return enrichedContext; } + @SuppressWarnings("checkstyle:fallthrough") private void onProviderEvent(FlagdProviderEvent flagdProviderEvent) { syncMetadata = flagdProviderEvent.getSyncMetadata(); @@ -211,6 +213,8 @@ private void onProviderEvent(FlagdProviderEvent flagdProviderEvent) { } previousEvent = ProviderEvent.PROVIDER_ERROR; break; + default: + log.info("Unknown event {}", flagdProviderEvent.getEvent()); } } diff --git a/providers/flagd/src/test/java/dev/openfeature/contrib/providers/flagd/e2e/RunRpcTest.java b/providers/flagd/src/test/java/dev/openfeature/contrib/providers/flagd/e2e/RunRpcTest.java index a950aa351..bcf6d016a 100644 --- a/providers/flagd/src/test/java/dev/openfeature/contrib/providers/flagd/e2e/RunRpcTest.java +++ b/providers/flagd/src/test/java/dev/openfeature/contrib/providers/flagd/e2e/RunRpcTest.java @@ -27,7 +27,7 @@ @ConfigurationParameter(key = GLUE_PROPERTY_NAME, value = "dev.openfeature.contrib.providers.flagd.e2e.steps") @ConfigurationParameter(key = OBJECT_FACTORY_PROPERTY_NAME, value = "io.cucumber.picocontainer.PicoFactory") @IncludeTags({"rpc"}) -@ExcludeTags({"targetURI"}) +@ExcludeTags({"targetURI", "unixsocket"}) @Testcontainers public class RunRpcTest { diff --git a/providers/flagd/src/test/java/dev/openfeature/contrib/providers/flagd/e2e/steps/ProviderSteps.java b/providers/flagd/src/test/java/dev/openfeature/contrib/providers/flagd/e2e/steps/ProviderSteps.java index 241f58927..13a8fd70e 100644 --- a/providers/flagd/src/test/java/dev/openfeature/contrib/providers/flagd/e2e/steps/ProviderSteps.java +++ b/providers/flagd/src/test/java/dev/openfeature/contrib/providers/flagd/e2e/steps/ProviderSteps.java @@ -38,7 +38,6 @@ public class ProviderSteps extends AbstractSteps { public static final int UNAVAILABLE_PORT = 9999; static Map containers = new HashMap<>(); - static Map> proxyports = new HashMap<>(); public static Network network = Network.newNetwork(); public static ToxiproxyContainer toxiproxy = new ToxiproxyContainer("ghcr.io/shopify/toxiproxy:2.5.0").withNetwork(network); @@ -46,17 +45,6 @@ public class ProviderSteps extends AbstractSteps { static Path sharedTempDir; - static { - try { - sharedTempDir = Files.createDirectories( - Paths.get("tmp/" + RandomStringUtils.randomAlphanumeric(8).toLowerCase() + "/")); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - private Timer restartTimer; - public ProviderSteps(State state) { super(state); } @@ -83,6 +71,8 @@ public static void beforeAll() throws IOException { ProviderType.DEFAULT, new FlagdContainer().withNetwork(network).withNetworkAliases("default")); containers.put( ProviderType.SSL, new FlagdContainer("ssl").withNetwork(network).withNetworkAliases("ssl")); + sharedTempDir = Files.createDirectories( + Paths.get("tmp/" + RandomStringUtils.randomAlphanumeric(8).toLowerCase() + "/")); containers.put( ProviderType.SOCKET, new FlagdContainer("socket") @@ -209,7 +199,7 @@ public void run() { } } }; - restartTimer = new Timer("Timer" + randomizer); + Timer restartTimer = new Timer("Timer" + randomizer); restartTimer.schedule(task, seconds * 1000L); } diff --git a/providers/flagd/src/test/resources/simplelogger.properties b/providers/flagd/src/test/resources/simplelogger.properties deleted file mode 100644 index 32c1f1a08..000000000 --- a/providers/flagd/src/test/resources/simplelogger.properties +++ /dev/null @@ -1,2 +0,0 @@ -org.slf4j.simpleLogger.defaultLogLevel=info -org.slf4j.simpleLogger.logFile=System.out