Skip to content

Commit b48ddc0

Browse files
committed
chore: add integration tests
Signed-off-by: Todd Baert <[email protected]>
1 parent 7e38e54 commit b48ddc0

File tree

8 files changed

+415
-8
lines changed

8 files changed

+415
-8
lines changed

.github/workflows/pullrequest.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ permissions:
99
jobs:
1010
build:
1111
runs-on: ubuntu-latest
12+
services:
13+
flagd:
14+
image: ghcr.io/open-feature/flagd-testbed:latest
15+
ports:
16+
- 8013:8013
17+
1218
steps:
1319
- name: Check out the code
1420
uses: actions/checkout@v3
@@ -28,7 +34,7 @@ jobs:
2834
${{ runner.os }}-maven-
2935
3036
- name: Build with Maven
31-
run: mvn --batch-mode --update-snapshots verify
37+
run: mvn --batch-mode --update-snapshots verify -P integration-test
3238

3339
- name: Upload coverage to Codecov
3440
uses: codecov/codecov-action@v2

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "test-harness"]
2+
path = test-harness
3+
url = https://github.com/open-feature/test-harness

pom.xml

+105-7
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
<maven.compiler.source>1.8</maven.compiler.source>
1212
<maven.compiler.target>${maven.compiler.source}</maven.compiler.target>
1313
<junit.jupiter.version>5.8.1</junit.jupiter.version>
14+
<!-- exclusion expression for integration tests -->
15+
<testExclusions>**/integration/*.java</testExclusions>
1416
</properties>
1517

1618
<name>OpenFeature Java SDK</name>
@@ -46,15 +48,13 @@
4648
<scope>provided</scope>
4749
</dependency>
4850

49-
5051
<dependency>
5152
<!-- used so that lombok can generate suppressions for spotbugs. It needs to find it on the relevant classpath -->
5253
<groupId>com.github.spotbugs</groupId>
5354
<artifactId>spotbugs</artifactId>
5455
<version>4.7.1</version>
5556
<scope>compile</scope>
5657
</dependency>
57-
5858
<dependency>
5959
<groupId>org.slf4j</groupId>
6060
<artifactId>slf4j-api</artifactId>
@@ -68,28 +68,24 @@
6868
<version>4.6.1</version>
6969
<scope>test</scope>
7070
</dependency>
71-
7271
<dependency>
7372
<groupId>uk.org.lidalia</groupId>
7473
<artifactId>slf4j-test</artifactId>
7574
<version>1.2.0</version>
7675
<scope>test</scope>
7776
</dependency>
78-
7977
<dependency>
8078
<groupId>org.assertj</groupId>
8179
<artifactId>assertj-core</artifactId>
8280
<version>3.23.1</version>
8381
<scope>test</scope>
8482
</dependency>
85-
8683
<dependency>
8784
<groupId>org.junit.jupiter</groupId>
8885
<artifactId>junit-jupiter</artifactId>
8986
<version>${junit.jupiter.version}</version>
9087
<scope>test</scope>
9188
</dependency>
92-
9389
<dependency>
9490
<groupId>org.junit.jupiter</groupId>
9591
<artifactId>junit-jupiter-engine</artifactId>
@@ -111,11 +107,51 @@
111107
<dependency>
112108
<groupId>org.junit.platform</groupId>
113109
<artifactId>junit-platform-suite</artifactId>
114-
<version>1.8.1</version>
110+
<version>1.9.0</version>
111+
<scope>test</scope>
112+
</dependency>
113+
<dependency>
114+
<groupId>io.cucumber</groupId>
115+
<artifactId>cucumber-java</artifactId>
116+
<scope>test</scope>
117+
</dependency>
118+
<dependency>
119+
<groupId>io.cucumber</groupId>
120+
<artifactId>cucumber-junit-platform-engine</artifactId>
121+
<scope>test</scope>
122+
</dependency>
123+
<dependency>
124+
<groupId>com.google.guava</groupId>
125+
<artifactId>guava</artifactId>
126+
<version>31.1-jre</version>
127+
<scope>test</scope>
128+
</dependency>
129+
<dependency>
130+
<groupId>dev.openfeature.contrib.providers</groupId>
131+
<artifactId>flagd</artifactId>
132+
<version>0.3.2</version>
115133
<scope>test</scope>
116134
</dependency>
117135
</dependencies>
118136

137+
<dependencyManagement>
138+
<dependencies>
139+
<dependency>
140+
<groupId>io.cucumber</groupId>
141+
<artifactId>cucumber-bom</artifactId>
142+
<version>7.5.0</version>
143+
<type>pom</type>
144+
<scope>import</scope>
145+
</dependency>
146+
<dependency>
147+
<groupId>org.junit</groupId>
148+
<artifactId>junit-bom</artifactId>
149+
<version>5.9.0</version>
150+
<type>pom</type>
151+
<scope>import</scope>
152+
</dependency>
153+
</dependencies>
154+
</dependencyManagement>
119155

120156
<build>
121157
<plugins>
@@ -137,6 +173,9 @@
137173
<ignoredUnusedDeclaredDependency>org.junit*</ignoredUnusedDeclaredDependency>
138174
</ignoredUnusedDeclaredDependencies>
139175
<ignoredDependencies>
176+
<ignoredDependency>com.google.guava*</ignoredDependency>
177+
<ignoredDependency>io.cucumber*</ignoredDependency>
178+
<ignoredDependency>org.junit*</ignoredDependency>
140179
<ignoredDependency>com.google.code.findbugs*</ignoredDependency>
141180
<ignoredDependency>com.github.spotbugs*</ignoredDependency>
142181
<ignoredDependency>uk.org.lidalia:lidalia-slf4j-ext:*</ignoredDependency>
@@ -155,6 +194,10 @@
155194
<argLine>
156195
${surefireArgLine}
157196
</argLine>
197+
<excludes>
198+
<!-- tests to exclude -->
199+
<exclude>${testExclusions}</exclude>
200+
</excludes>
158201
</configuration>
159202
</plugin>
160203

@@ -372,6 +415,61 @@
372415
</plugins>
373416
</build>
374417

418+
<profiles>
419+
<profile>
420+
<!-- this profile handles running the flagd integration tests -->
421+
<id>integration-test</id>
422+
<properties>
423+
<!-- run the integration tests by clearing the exclusions -->
424+
<testExclusions></testExclusions>
425+
</properties>
426+
<build>
427+
<plugins>
428+
<!-- pull the gherkin tests as a git submodule -->
429+
<plugin>
430+
<groupId>org.codehaus.mojo</groupId>
431+
<artifactId>exec-maven-plugin</artifactId>
432+
<version>3.1.0</version>
433+
<executions>
434+
<execution>
435+
<id>update-test-harness-submodule</id>
436+
<phase>validate</phase>
437+
<goals>
438+
<goal>exec</goal>
439+
</goals>
440+
<configuration>
441+
<!-- run: git submodule update \-\-init \-\-recursive -->
442+
<executable>git</executable>
443+
<arguments>
444+
<argument>submodule</argument>
445+
<argument>update</argument>
446+
<argument>--init</argument>
447+
<argument>--recursive</argument>
448+
</arguments>
449+
</configuration>
450+
</execution>
451+
<execution>
452+
<id>copy-gherkin-tests</id>
453+
<phase>validate</phase>
454+
<goals>
455+
<goal>exec</goal>
456+
</goals>
457+
<configuration>
458+
<!-- run: cp test-harness/features/evaluation.feature src/test/resources/features/ -->
459+
<executable>cp</executable>
460+
<arguments>
461+
<argument>test-harness/features/evaluation.feature</argument>
462+
<argument>src/test/resources/features/</argument>
463+
</arguments>
464+
</configuration>
465+
</execution>
466+
</executions>
467+
</plugin>
468+
</plugins>
469+
</build>
470+
</profile>
471+
</profiles>
472+
375473
<distributionManagement>
376474
<snapshotRepository>
377475
<id>ossrh</id>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package dev.openfeature.javasdk.integration;
2+
3+
import org.junit.platform.suite.api.ConfigurationParameter;
4+
import org.junit.platform.suite.api.IncludeEngines;
5+
import org.junit.platform.suite.api.SelectClasspathResource;
6+
import org.junit.platform.suite.api.Suite;
7+
8+
import static io.cucumber.junit.platform.engine.Constants.PLUGIN_PROPERTY_NAME;
9+
10+
@Suite
11+
@IncludeEngines("cucumber")
12+
@SelectClasspathResource("features")
13+
@ConfigurationParameter(key = PLUGIN_PROPERTY_NAME, value = "pretty")
14+
public class RunCucumberTest {
15+
16+
}

0 commit comments

Comments
 (0)