diff --git a/concourse/pipeline.yml b/concourse/pipeline.yml index 727a76e2..6c908fc5 100644 --- a/concourse/pipeline.yml +++ b/concourse/pipeline.yml @@ -86,7 +86,7 @@ resources: - name: dev-tests-trigger type: time source: - interval: 6h + interval: 24h jobs: - name: set-self diff --git a/concourse/scripts/perf.sh b/concourse/scripts/perf.sh index c52affb4..c545ff3b 100755 --- a/concourse/scripts/perf.sh +++ b/concourse/scripts/perf.sh @@ -8,7 +8,7 @@ export LOG_UNIQUE=$(date +%s%3N) # Install fauna-shell apt update -qq apt install -y -qq npm -npm install --silent -g fauna-shell@^2.0.0 +npm install --silent -g fauna-shell@^3.0.0 cd repo.git diff --git a/perf-test-setup b/perf-test-setup index bce440cb..c4833503 160000 --- a/perf-test-setup +++ b/perf-test-setup @@ -1 +1 @@ -Subproject commit bce440cb2ac36ea16422e861885718c6a8d96c08 +Subproject commit c48335031728054c6547ff1f4d419613aca07511 diff --git a/src/test/java/com/fauna/e2e/E2EFeedsTest.java b/src/test/java/com/fauna/e2e/E2EFeedsTest.java index f30c9704..3614cf25 100644 --- a/src/test/java/com/fauna/e2e/E2EFeedsTest.java +++ b/src/test/java/com/fauna/e2e/E2EFeedsTest.java @@ -12,7 +12,9 @@ import com.fauna.exception.InvalidRequestException; import com.fauna.response.QueryFailure; import com.fauna.response.QuerySuccess; + import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import java.util.ArrayList; @@ -46,6 +48,10 @@ public static void setup() { FaunaConfig config = FaunaConfig.builder().endpoint(LOCAL).secret("secret").build(); client = Fauna.client(config); + } + + @BeforeEach + public void setupEach() { productCollectionTs = Fixtures.ProductCollection(client); } @@ -85,7 +91,10 @@ public void manualFeed() { // Handle page FeedPage latestPage = pageFuture.join(); lastPageCursor = latestPage.getCursor(); - productUpdates.addAll(latestPage.getEvents()); + + List> pageOfEvents = latestPage.getEvents(); + + productUpdates.addAll(pageOfEvents); pageCount++; // Get next page (if it's not null) @@ -100,11 +109,21 @@ public void manualFeed() { } assertEquals(50, productUpdates.size()); assertEquals(25, pageCount); - // Because there is no filtering, these cursors are the same. - // If we filtered events, then the page cursor could be different from the cursor of the last element. - assertEquals(lastPageCursor, - productUpdates.get(productUpdates.size() - 1).getCursor()); + client.query(fql("Product.create({name:\"newProduct\",quantity:123})")); + + FeedOptions newOptions = + FeedOptions.builder().cursor(lastPageCursor).pageSize(2) + .build(); + + FeedPage newPageFuture = + client.poll(source, newOptions, Product.class).join(); + + List> newEvents = newPageFuture.getEvents(); + + assertEquals(1, newEvents.size()); + assertEquals("newProduct", newEvents.get(0).getData().get().getName()); + assertEquals(123, newEvents.get(0).getData().get().getQuantity()); } @Test diff --git a/src/test/java/com/fauna/perf/PerformanceTest.java b/src/test/java/com/fauna/perf/PerformanceTest.java index f040b497..d0e4584f 100644 --- a/src/test/java/com/fauna/perf/PerformanceTest.java +++ b/src/test/java/com/fauna/perf/PerformanceTest.java @@ -32,8 +32,11 @@ private static Stream getTestData() throws IOException { } @BeforeAll - public static void setup() { + public static void setup() throws IllegalArgumentException, InterruptedException, ExecutionException { client = Fauna.client(); + + // Throw away results of initial query used just for establishing connection + client.asyncQuery(fql("null")).get(); } @AfterAll