Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add github actions
Signed-off-by: christian.lutnik <[email protected]>
  • Loading branch information
chrfwow committed Nov 27, 2025
commit 362df55c344e00d4f6d095755f44a0c5f9820c4f
38 changes: 33 additions & 5 deletions src/test/java/dev/openfeature/sdk/NoBreakingChangesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashSet;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicBoolean;
Expand Down Expand Up @@ -47,7 +51,7 @@
@AfterEach
void teardown() throws InterruptedException {
try {
Thread.sleep(1000); // wait a bit for any uncaught exceptions to be reported

Check warning on line 54 in src/test/java/dev/openfeature/sdk/NoBreakingChangesTest.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this use of "Thread.sleep()".

See more on https://sonarcloud.io/project/issues?id=open-feature_java-sdk&issues=AZrEn-DFMul3jc-Pq6Xt&open=AZrEn-DFMul3jc-Pq6Xt&pullRequest=1749

isTestRunning.set(false);
threadWatcher.join(1000);
Expand All @@ -57,13 +61,37 @@
}

@Test
void noBreakingChanges() {
void noBreakingChanges() throws IOException {

var file = new File("testFlags.json");
file.mkdirs();
file.createNewFile();
file.deleteOnExit();

System.err.println("Using flag file at: " + file.getAbsolutePath());

var writer = new BufferedWriter(new FileWriter(file));
writer.write("{\n" +
" \"$schema\": \"https://flagd.dev/schema/v0/flags.json\",\n" +
" \"flags\": {\n" +
" \"basic-boolean\": {\n" +
" \"state\": \"ENABLED\",\n" +
" \"defaultVariant\": \"true\",\n" +
" \"variants\": {\n" +
" \"true\": true,\n" +
" \"false\": false\n" +
" },\n" +
" \"targeting\": {}\n" +
" }\n" +
" }\n" +
"}\n");
writer.flush();

System.err.println("written to file");

var testProvider = new FlagdProvider(FlagdOptions.builder()
.resolverType(Config.Resolver.FILE)
.offlineFlagSourcePath(NoBreakingChangesTest.class
.getResource("/testFlags.json")
.getPath()
)
.offlineFlagSourcePath(file.getAbsolutePath())
.build());
var api = new OpenFeatureAPI();
api.setProviderAndWait(testProvider);
Expand Down
Loading