Repository navigation
feat: json-logic++ (precompilation), improve e2e #1968
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,11 +69,12 @@ | |
| --add-opens java.base/java.util=ALL-UNNAMED | ||
| --add-opens java.base/java.lang=ALL-UNNAMED | ||
| </surefireArgLine> | ||
| <skip.tests>false</skip.tests> | ||
| <!-- whether the `tck` profile fails on a failing conformance scenario; a provider overrides it --> | ||
| <tck.testFailureIgnore>false</tck.testFailureIgnore> | ||
| <!-- this will throw an error if we use APIs not available in the specified version --> | ||
| <maven.compiler.release>11</maven.compiler.release> | ||
| <!-- lombok; JDK 23+ disables annotation processing by default --> | ||
| <maven.compiler.proc>full</maven.compiler.proc> | ||
| </properties> | ||
|
|
||
| <dependencyManagement> | ||
|
|
@@ -333,9 +334,6 @@ | |
| <activation> | ||
| <activeByDefault>true</activeByDefault> | ||
| </activation> | ||
| <properties> | ||
| <maven.compiler.proc>full</maven.compiler.proc> | ||
| </properties> | ||
| <build> | ||
| <plugins> | ||
|
|
||
|
|
@@ -466,9 +464,6 @@ | |
| <activation> | ||
| <activeByDefault>true</activeByDefault> | ||
| </activation> | ||
| <properties> | ||
| <maven.compiler.proc>full</maven.compiler.proc> | ||
| </properties> | ||
| <build> | ||
| <plugins> | ||
| <!-- CODE QUALITY TOOLS --> | ||
|
|
@@ -614,7 +609,6 @@ | |
| <!--<modules><module></module></modules>--> | ||
| <properties> | ||
| <toolchain.jdk.version>[11,)</toolchain.jdk.version> | ||
| <skip.tests>true</skip.tests> | ||
| </properties> | ||
|
|
||
| <build> | ||
|
|
@@ -631,34 +625,17 @@ | |
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-surefire-plugin</artifactId> | ||
| <version>3.6.0</version> | ||
| <configuration> | ||
| <skipTests>${skip.tests}</skipTests> | ||
| </configuration> | ||
| </plugin> | ||
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-compiler-plugin</artifactId> | ||
| <version>3.16.0</version> | ||
| <executions> | ||
| <execution> | ||
| <id>default-testCompile</id> | ||
| <phase>test-compile</phase> | ||
| <goals> | ||
| <goal>testCompile</goal> | ||
| </goals> | ||
| <configuration> | ||
| <skip>true</skip> | ||
| </configuration> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
| </profile> | ||
| <!-- runs only tests in e2e packages, e.g. `mvn -Pe2e,e2e-only verify` --> | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. e2e test profile, which we can run in more places now for coverage of various JREs/JDKs - linting/unit-testing only runs in JDK25 |
||
| <profile> | ||
| <id>e2e-only</id> | ||
| <properties> | ||
| <test>**/e2e/**</test> | ||
| <surefire.failIfNoSpecifiedTests>false</surefire.failIfNoSpecifiedTests> | ||
| </properties> | ||
| </profile> | ||
| <!-- | ||
| Runs every provider's Provider TCK adoption (the classes in its `tck` test package), | ||
| and nothing else: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,5 @@ | ||
| package dev.openfeature.contrib.providers.flagd.e2e.steps; | ||
|
|
||
| import static io.restassured.RestAssured.when; | ||
| import static org.assertj.core.api.Assertions.assertThat; | ||
|
|
||
| import dev.openfeature.contrib.providers.flagd.Config; | ||
|
|
@@ -21,6 +20,12 @@ | |
| import io.cucumber.java.en.Then; | ||
| import io.cucumber.java.en.When; | ||
| import java.io.File; | ||
| import java.io.IOException; | ||
| import java.io.UncheckedIOException; | ||
| import java.net.URI; | ||
| import java.net.http.HttpClient; | ||
| import java.net.http.HttpRequest; | ||
| import java.net.http.HttpResponse; | ||
| import lombok.extern.slf4j.Slf4j; | ||
| import org.apache.commons.lang3.StringUtils; | ||
| import org.testcontainers.containers.ComposeContainer; | ||
|
|
@@ -29,6 +34,7 @@ | |
| public class ProviderSteps extends AbstractSteps { | ||
|
|
||
| public static final int UNAVAILABLE_PORT = 9999; | ||
| private static final HttpClient HTTP_CLIENT = HttpClient.newHttpClient(); | ||
|
|
||
| public ProviderSteps(State state) { | ||
| super(state); | ||
|
|
@@ -48,9 +54,7 @@ public static void afterAll() { | |
| public void tearDown() { | ||
| if (state.containerEntry != null) { | ||
| if (state.client != null) { | ||
| when().post("http://" + ContainerUtil.getLaunchpadUrl(state.containerEntry.container) + "/stop") | ||
| .then() | ||
| .statusCode(200); | ||
| launchpad(state.containerEntry.container, "/stop"); | ||
| } | ||
| ContainerPool.release(state.containerEntry); | ||
| state.containerEntry = null; | ||
|
|
@@ -154,9 +158,7 @@ public void setupProvider(String providerType) throws InterruptedException { | |
| state.builder.port(UNAVAILABLE_PORT); | ||
| } | ||
|
|
||
| when().post("http://" + ContainerUtil.getLaunchpadUrl(container) + "/start?config={config}", flagdConfig) | ||
| .then() | ||
| .statusCode(200); | ||
| launchpad(container, "/start?config=" + flagdConfig); | ||
|
|
||
| Thread.sleep(50); | ||
|
|
||
|
|
@@ -177,30 +179,37 @@ public void setupProvider(String providerType) throws InterruptedException { | |
|
|
||
| @When("the connection is lost") | ||
| public void the_connection_is_lost() { | ||
| when().post("http://" + ContainerUtil.getLaunchpadUrl(state.containerEntry.container) + "/stop") | ||
| .then() | ||
| .statusCode(200); | ||
| launchpad(state.containerEntry.container, "/stop"); | ||
| } | ||
|
|
||
| @When("the connection is lost for {int}s") | ||
| public void the_connection_is_lost_for(int seconds) { | ||
| when().post( | ||
| "http://" + ContainerUtil.getLaunchpadUrl(state.containerEntry.container) | ||
| + "/restart?seconds={seconds}", | ||
| seconds) | ||
| .then() | ||
| .statusCode(200); | ||
| launchpad(state.containerEntry.container, "/restart?seconds=" + seconds); | ||
| } | ||
|
|
||
| @When("the flag was modified") | ||
| public void the_flag_was_modded() { | ||
| when().post("http://" + ContainerUtil.getLaunchpadUrl(state.containerEntry.container) + "/change") | ||
| .then() | ||
| .statusCode(200); | ||
| launchpad(state.containerEntry.container, "/change"); | ||
| } | ||
|
|
||
| @Then("the client should be in {} state") | ||
| public void the_client_should_be_in_fatal_state(String clientState) { | ||
| assertThat(state.client.getProviderState()).isEqualTo(ProviderState.valueOf(clientState.toUpperCase())); | ||
| } | ||
|
|
||
| private static void launchpad(ComposeContainer container, String path) { | ||
| HttpRequest request = HttpRequest.newBuilder( | ||
| URI.create("http://" + ContainerUtil.getLaunchpadUrl(container) + path)) | ||
| .POST(HttpRequest.BodyPublishers.noBody()) | ||
| .build(); | ||
| try { | ||
| HttpResponse<String> response = HTTP_CLIENT.send(request, HttpResponse.BodyHandlers.ofString()); | ||
| assertThat(response.statusCode()).as("launchpad %s", path).isEqualTo(200); | ||
| } catch (IOException e) { | ||
| throw new UncheckedIOException(e); | ||
| } catch (InterruptedException e) { | ||
| Thread.currentThread().interrupt(); | ||
| throw new IllegalStateException(e); | ||
| } | ||
| } | ||
|
Comment on lines
+200
to
+214
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,41 +18,39 @@ | |
| /** | ||
| * Represents configuration options for the HTTP connector. | ||
| */ | ||
| @SuppressFBWarnings( | ||
| value = {"EI_EXPOSE_REP", "CT_CONSTRUCTOR_THROW"}, | ||
| justification = "builder validations") | ||
| @SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "builder validations") | ||
| @Slf4j | ||
| @Getter | ||
| public class HttpConnectorOptions { | ||
|
|
||
| @Builder.Default | ||
|
Check warning on line 26 in tools/flagd-http-connector/src/main/java/dev/openfeature/contrib/tools/flagd/resolver/process/storage/connector/sync/http/HttpConnectorOptions.java
|
||
| private Integer pollIntervalSeconds = 60; | ||
|
|
||
| @Builder.Default | ||
|
Check warning on line 29 in tools/flagd-http-connector/src/main/java/dev/openfeature/contrib/tools/flagd/resolver/process/storage/connector/sync/http/HttpConnectorOptions.java
|
||
| private Integer connectTimeoutSeconds = 10; | ||
|
|
||
| @Builder.Default | ||
|
Check warning on line 32 in tools/flagd-http-connector/src/main/java/dev/openfeature/contrib/tools/flagd/resolver/process/storage/connector/sync/http/HttpConnectorOptions.java
|
||
| private Integer requestTimeoutSeconds = 10; | ||
|
|
||
| @Builder.Default | ||
|
Check warning on line 35 in tools/flagd-http-connector/src/main/java/dev/openfeature/contrib/tools/flagd/resolver/process/storage/connector/sync/http/HttpConnectorOptions.java
|
||
| private Integer linkedBlockingQueueCapacity = 100; | ||
|
|
||
| @Builder.Default | ||
|
Check warning on line 38 in tools/flagd-http-connector/src/main/java/dev/openfeature/contrib/tools/flagd/resolver/process/storage/connector/sync/http/HttpConnectorOptions.java
|
||
| private Integer scheduledThreadPoolSize = 2; | ||
|
|
||
| @Builder.Default | ||
|
Check warning on line 41 in tools/flagd-http-connector/src/main/java/dev/openfeature/contrib/tools/flagd/resolver/process/storage/connector/sync/http/HttpConnectorOptions.java
|
||
| private Map<String, String> headers = new HashMap<>(); | ||
|
|
||
| @Builder.Default | ||
|
Check warning on line 44 in tools/flagd-http-connector/src/main/java/dev/openfeature/contrib/tools/flagd/resolver/process/storage/connector/sync/http/HttpConnectorOptions.java
|
||
| private ExecutorService httpClientExecutor = Executors.newFixedThreadPool(1); | ||
|
|
||
| @Builder.Default | ||
|
Check warning on line 47 in tools/flagd-http-connector/src/main/java/dev/openfeature/contrib/tools/flagd/resolver/process/storage/connector/sync/http/HttpConnectorOptions.java
|
||
| private String proxyHost; | ||
|
|
||
| @Builder.Default | ||
|
Check warning on line 50 in tools/flagd-http-connector/src/main/java/dev/openfeature/contrib/tools/flagd/resolver/process/storage/connector/sync/http/HttpConnectorOptions.java
|
||
| private Integer proxyPort; | ||
|
|
||
| @Builder.Default | ||
|
Check warning on line 53 in tools/flagd-http-connector/src/main/java/dev/openfeature/contrib/tools/flagd/resolver/process/storage/connector/sync/http/HttpConnectorOptions.java
|
||
| private PayloadCacheOptions payloadCacheOptions; | ||
|
|
||
| @Builder.Default | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This turned off tests in Java 11 - which we aren't doing anymore.