From 2041bb2d7543647a5b0546842a6e82f38065e2a7 Mon Sep 17 00:00:00 2001 From: Nate Anderson Date: Thu, 19 Sep 2024 10:46:11 -0700 Subject: [PATCH] fix: add a sleep in a list test to fix an intermittent canary failure --- tests/Integration/Momento.Sdk.Tests/Cache/ListTest.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/Integration/Momento.Sdk.Tests/Cache/ListTest.cs b/tests/Integration/Momento.Sdk.Tests/Cache/ListTest.cs index d797d95a..0cc5a272 100644 --- a/tests/Integration/Momento.Sdk.Tests/Cache/ListTest.cs +++ b/tests/Integration/Momento.Sdk.Tests/Cache/ListTest.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using System.Threading; using System.Threading.Tasks; using Momento.Sdk.Internal.ExtensionMethods; using Momento.Sdk.Requests; @@ -706,14 +707,13 @@ public async Task ListPushFrontFetch_ValueIsString_HappyPath() var listName = Utils.NewGuidString(); var value1 = Utils.NewGuidString(); - CacheListPushFrontResponse pushResponse = await client.ListPushFrontAsync(cacheName, listName, value1); + var pushResponse = await client.ListPushFrontAsync(cacheName, listName, value1); Assert.True(pushResponse is CacheListPushFrontResponse.Success, $"Unexpected response: {pushResponse}"); var successResponse = (CacheListPushFrontResponse.Success)pushResponse; Assert.Equal(1, successResponse.ListLength); Assert.Equal("Momento.Sdk.Responses.CacheListPushFrontResponse+Success: ListLength: 1", successResponse.ToString()); - successResponse = (CacheListPushFrontResponse.Success)pushResponse; - CacheListFetchResponse fetchResponse = await client.ListFetchAsync(cacheName, listName); + var fetchResponse = await client.ListFetchAsync(cacheName, listName); Assert.True(fetchResponse is CacheListFetchResponse.Hit, $"Unexpected response: {fetchResponse}"); var hitResponse = (CacheListFetchResponse.Hit)fetchResponse; @@ -727,7 +727,9 @@ public async Task ListPushFrontFetch_ValueIsString_HappyPath() Assert.True(pushResponse is CacheListPushFrontResponse.Success, $"Unexpected response: {pushResponse}"); successResponse = (CacheListPushFrontResponse.Success)pushResponse; Assert.Equal(2, successResponse.ListLength); - + + Thread.Sleep(100); + fetchResponse = await client.ListFetchAsync(cacheName, listName); Assert.True(fetchResponse is CacheListFetchResponse.Hit, $"Unexpected response: {fetchResponse}"); hitResponse = (CacheListFetchResponse.Hit)fetchResponse;