Skip to content
Open
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
slow down snippet tests
  • Loading branch information
denismakogon committed Oct 23, 2023
commit 765cfd2bfae012a4ba8604e17156591a58bd4f60
26 changes: 15 additions & 11 deletions .github/tools/src/test/java/dev/playground/SnippetTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import dev.playground.tools.IndexJson;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;

import java.io.IOException;
import java.net.URI;
Expand Down Expand Up @@ -74,19 +72,25 @@ String executeSnippet(String snippet) throws Exception{
.build();
var response = client.send(request, HttpResponse.BodyHandlers.ofByteArray());
var responseBody = new String(response.body());
assertEquals(200, response.statusCode(), responseBody);

assertTrue(responseBody.contains("VALID"), responseBody);

var responseDetails = String.format("Headers: %s | Body: %s", response.headers().map(), responseBody);
assertEquals(200, response.statusCode(), responseDetails);
assertTrue(responseBody.contains("VALID"), responseDetails);

return responseBody;
}

@ParameterizedTest
@MethodSource(value = "getData")
public void testCompile(String snippet) throws Exception {
System.out.printf("[SnippetTest::testCompile] Running validation test for snippet:\n%s\n", snippet);
executeSnippet(snippet);
@Test
public void testCompile() throws Exception {
var snippets = getData();
snippets.forEach(snippet -> {
try {
System.out.printf("[SnippetTest::testCompile] Running validation test for snippet:\n%s\n", snippet);
executeSnippet(snippet);
Thread.sleep(Duration.ofSeconds(4));
} catch (Exception e) {
fail(e);
}
});
}

@Test
Expand Down