From 842303a24b88bf13d7bef351dd99bc7137e89d38 Mon Sep 17 00:00:00 2001 From: Adam Bollen Date: Thu, 12 Dec 2024 16:02:06 -0800 Subject: [PATCH 1/7] Lower test frequency and pull in new perf-utils commit --- concourse/pipeline.yml | 2 +- concourse/scripts/perf.sh | 2 +- perf-test-setup | 2 +- src/test/java/com/fauna/perf/PerformanceTest.java | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) 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/perf/PerformanceTest.java b/src/test/java/com/fauna/perf/PerformanceTest.java index f040b497..960069a6 100644 --- a/src/test/java/com/fauna/perf/PerformanceTest.java +++ b/src/test/java/com/fauna/perf/PerformanceTest.java @@ -32,8 +32,9 @@ private static Stream getTestData() throws IOException { } @BeforeAll - public static void setup() { + public static void setup() throws IllegalArgumentException, InterruptedException, ExecutionException { client = Fauna.client(); + client.asyncQuery(fql("null")).get(); } @AfterAll From cf7f2edbfb99b853e6457fd95e54cf3b8bdabed0 Mon Sep 17 00:00:00 2001 From: Adam Bollen Date: Thu, 12 Dec 2024 16:04:12 -0800 Subject: [PATCH 2/7] Comment --- src/test/java/com/fauna/perf/PerformanceTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test/java/com/fauna/perf/PerformanceTest.java b/src/test/java/com/fauna/perf/PerformanceTest.java index 960069a6..d0e4584f 100644 --- a/src/test/java/com/fauna/perf/PerformanceTest.java +++ b/src/test/java/com/fauna/perf/PerformanceTest.java @@ -34,6 +34,8 @@ private static Stream getTestData() throws IOException { @BeforeAll 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(); } From 5d33716144785a155eeb0238703c7efc57d5c6f2 Mon Sep 17 00:00:00 2001 From: Adam Bollen Date: Tue, 17 Dec 2024 09:29:48 -0800 Subject: [PATCH 3/7] Removing unneeded assertion --- src/test/java/com/fauna/e2e/E2EFeedsTest.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/test/java/com/fauna/e2e/E2EFeedsTest.java b/src/test/java/com/fauna/e2e/E2EFeedsTest.java index f30c9704..b578e1ae 100644 --- a/src/test/java/com/fauna/e2e/E2EFeedsTest.java +++ b/src/test/java/com/fauna/e2e/E2EFeedsTest.java @@ -85,6 +85,7 @@ public void manualFeed() { // Handle page FeedPage latestPage = pageFuture.join(); lastPageCursor = latestPage.getCursor(); + System.out.println(lastPageCursor); productUpdates.addAll(latestPage.getEvents()); pageCount++; @@ -100,11 +101,6 @@ 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()); - } @Test From 959bebf0473953909a0d6c509a93b7525bc8aee1 Mon Sep 17 00:00:00 2001 From: Adam Bollen Date: Tue, 17 Dec 2024 13:50:39 -0800 Subject: [PATCH 4/7] Add new event, assert lastPageCursor sees it --- src/test/java/com/fauna/e2e/E2EFeedsTest.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/fauna/e2e/E2EFeedsTest.java b/src/test/java/com/fauna/e2e/E2EFeedsTest.java index b578e1ae..d4b6a3db 100644 --- a/src/test/java/com/fauna/e2e/E2EFeedsTest.java +++ b/src/test/java/com/fauna/e2e/E2EFeedsTest.java @@ -85,8 +85,10 @@ public void manualFeed() { // Handle page FeedPage latestPage = pageFuture.join(); lastPageCursor = latestPage.getCursor(); - System.out.println(lastPageCursor); - productUpdates.addAll(latestPage.getEvents()); + + List> pageOfEvents = latestPage.getEvents(); + + productUpdates.addAll(pageOfEvents); pageCount++; // Get next page (if it's not null) @@ -101,6 +103,18 @@ public void manualFeed() { } assertEquals(50, productUpdates.size()); assertEquals(25, pageCount); + + client.query(fql("Product.create({name:\"newProduct\",quantity:1})"), + Product.class); + + FeedOptions newOptions = + FeedOptions.builder().cursor(lastPageCursor).pageSize(2) + .build(); + + FeedPage newPageFuture = + client.poll(source, newOptions, Product.class).join(); + + assertEquals(1, newPageFuture.getEvents().size()); } @Test From 7b4f3951dee9d5c5d004855e30af3fd2cf62aa2b Mon Sep 17 00:00:00 2001 From: Adam Bollen Date: Tue, 17 Dec 2024 14:01:55 -0800 Subject: [PATCH 5/7] Ensure we're seeing the new doc --- src/test/java/com/fauna/e2e/E2EFeedsTest.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/fauna/e2e/E2EFeedsTest.java b/src/test/java/com/fauna/e2e/E2EFeedsTest.java index d4b6a3db..06c618bd 100644 --- a/src/test/java/com/fauna/e2e/E2EFeedsTest.java +++ b/src/test/java/com/fauna/e2e/E2EFeedsTest.java @@ -12,6 +12,7 @@ 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.Test; @@ -104,7 +105,7 @@ public void manualFeed() { assertEquals(50, productUpdates.size()); assertEquals(25, pageCount); - client.query(fql("Product.create({name:\"newProduct\",quantity:1})"), + client.query(fql("Product.create({name:\"newProduct\",quantity:123})"), Product.class); FeedOptions newOptions = @@ -114,7 +115,11 @@ public void manualFeed() { FeedPage newPageFuture = client.poll(source, newOptions, Product.class).join(); - assertEquals(1, newPageFuture.getEvents().size()); + 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 From 5153c84589010d927151a7ed1be11ad95ee7a4a0 Mon Sep 17 00:00:00 2001 From: Adam Bollen Date: Tue, 17 Dec 2024 14:03:05 -0800 Subject: [PATCH 6/7] Eh, remove the result type --- src/test/java/com/fauna/e2e/E2EFeedsTest.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/test/java/com/fauna/e2e/E2EFeedsTest.java b/src/test/java/com/fauna/e2e/E2EFeedsTest.java index 06c618bd..78b11d34 100644 --- a/src/test/java/com/fauna/e2e/E2EFeedsTest.java +++ b/src/test/java/com/fauna/e2e/E2EFeedsTest.java @@ -105,8 +105,7 @@ public void manualFeed() { assertEquals(50, productUpdates.size()); assertEquals(25, pageCount); - client.query(fql("Product.create({name:\"newProduct\",quantity:123})"), - Product.class); + client.query(fql("Product.create({name:\"newProduct\",quantity:123})")); FeedOptions newOptions = FeedOptions.builder().cursor(lastPageCursor).pageSize(2) From df5d22582148c72e4532ade457a1ab04e2e28ac0 Mon Sep 17 00:00:00 2001 From: Adam Bollen Date: Tue, 17 Dec 2024 14:44:12 -0800 Subject: [PATCH 7/7] Setup Product fixture per test --- src/test/java/com/fauna/e2e/E2EFeedsTest.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/test/java/com/fauna/e2e/E2EFeedsTest.java b/src/test/java/com/fauna/e2e/E2EFeedsTest.java index 78b11d34..3614cf25 100644 --- a/src/test/java/com/fauna/e2e/E2EFeedsTest.java +++ b/src/test/java/com/fauna/e2e/E2EFeedsTest.java @@ -14,6 +14,7 @@ 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; @@ -47,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); }