Skip to content

Commit

Permalink
fix: add a sleep in a list test to fix an intermittent canary failure
Browse files Browse the repository at this point in the history
  • Loading branch information
nand4011 committed Sep 19, 2024
1 parent 4ac887e commit 2041bb2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/Integration/Momento.Sdk.Tests/Cache/ListTest.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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;

Expand All @@ -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;
Expand Down

0 comments on commit 2041bb2

Please sign in to comment.