From 9cad7488bc7f55e0664b15342b2bd0dd807072ef Mon Sep 17 00:00:00 2001 From: Matt Straathof Date: Fri, 12 May 2023 10:14:37 -0700 Subject: [PATCH 1/6] fix: update int test ttls to be more lenient --- .../Momento.Sdk.Tests/DictionaryTest.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/Integration/Momento.Sdk.Tests/DictionaryTest.cs b/tests/Integration/Momento.Sdk.Tests/DictionaryTest.cs index 6b333bbf..fdd3e4a8 100644 --- a/tests/Integration/Momento.Sdk.Tests/DictionaryTest.cs +++ b/tests/Integration/Momento.Sdk.Tests/DictionaryTest.cs @@ -85,7 +85,7 @@ public async Task DictionarySetGetAsync_FieldIsByteArrayValueIsByteArray_NoRefre var field = Utils.NewGuidByteArray(); var value = Utils.NewGuidByteArray(); - CacheDictionarySetFieldResponse setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, CollectionTtl.Of(TimeSpan.FromSeconds(5)).WithNoRefreshTtlOnUpdates()); + CacheDictionarySetFieldResponse setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, CollectionTtl.Of(TimeSpan.FromSeconds(4)).WithNoRefreshTtlOnUpdates()); Assert.True(setResponse is CacheDictionarySetFieldResponse.Success, $"Unexpected response: {setResponse}"); await Task.Delay(100); @@ -177,7 +177,7 @@ public async Task DictionaryIncrementAsync_IncrementFromZero_NoRefreshTtl() var dictionaryName = Utils.NewGuidString(); var field = Utils.NewGuidString(); - CacheDictionaryIncrementResponse resp = await client.DictionaryIncrementAsync(cacheName, dictionaryName, field, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(5))); + CacheDictionaryIncrementResponse resp = await client.DictionaryIncrementAsync(cacheName, dictionaryName, field, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4))); Assert.True(resp is CacheDictionaryIncrementResponse.Success, $"Unexpected response: {resp}"); await Task.Delay(101); @@ -316,7 +316,7 @@ public async Task DictionarySetGetAsync_FieldIsStringValueIsString_NoRefreshTtl( var field = Utils.NewGuidString(); var value = Utils.NewGuidString(); - CacheDictionarySetFieldResponse setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(5))); + CacheDictionarySetFieldResponse setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4))); Assert.True(setResponse is CacheDictionarySetFieldResponse.Success, $"Unexpected response: {setResponse}"); await Task.Delay(100); @@ -379,7 +379,7 @@ public async Task DictionarySetGetAsync_FieldIsStringValueIsByteArray_NoRefreshT var field = Utils.NewGuidString(); var value = Utils.NewGuidByteArray(); - CacheDictionarySetFieldResponse setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(5))); + CacheDictionarySetFieldResponse setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4))); Assert.True(setResponse is CacheDictionarySetFieldResponse.Success, $"Unexpected response: {setResponse}"); await Task.Delay(100); @@ -460,7 +460,7 @@ public async Task DictionarySetFieldsAsync_FieldsAreByteArrayValuesAreByteArray_ var value = Utils.NewGuidByteArray(); var content = new Dictionary() { { field, value } }; - await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(5))); + await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4))); await Task.Delay(100); await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); @@ -538,7 +538,7 @@ public async Task DictionarySetFieldsAsync_FieldsAreStringValuesAreString_NoRefr var value = Utils.NewGuidString(); var content = new Dictionary() { { field, value } }; - await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(5))); + await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4))); await Task.Delay(100); await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); @@ -616,7 +616,7 @@ public async Task DictionarySetFieldsAsync_FieldsAreStringValuesAreByteArray_NoR var value = Utils.NewGuidByteArray(); var content = new Dictionary() { { field, value } }; - await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(5)).WithNoRefreshTtlOnUpdates()); + await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4)).WithNoRefreshTtlOnUpdates()); await Task.Delay(100); await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); From 559e23b044a370c49b2b21ccf59bc7a7293ab246 Mon Sep 17 00:00:00 2001 From: Matt Straathof Date: Fri, 12 May 2023 10:42:59 -0700 Subject: [PATCH 2/6] fix: update int test ttls to be more lenient --- .../Integration/Momento.Sdk.Tests/ListTest.cs | 26 +++++++++---------- .../Integration/Momento.Sdk.Tests/SetTest.cs | 8 +++--- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/Integration/Momento.Sdk.Tests/ListTest.cs b/tests/Integration/Momento.Sdk.Tests/ListTest.cs index aea84f76..b4f2bbd8 100644 --- a/tests/Integration/Momento.Sdk.Tests/ListTest.cs +++ b/tests/Integration/Momento.Sdk.Tests/ListTest.cs @@ -285,10 +285,10 @@ public async Task ListConcatenateFrontFetch_ValueIsByteArray_NoRefreshTtl() var listName = Utils.NewGuidString(); byte[][] values = new byte[][] { Utils.NewGuidByteArray() }; - await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(5)).WithNoRefreshTtlOnUpdates()); + await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4)).WithNoRefreshTtlOnUpdates()); await Task.Delay(100); - await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(5)).WithNoRefreshTtlOnUpdates()); + await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); await Task.Delay(4900); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); @@ -365,10 +365,10 @@ public async Task ListConcatenateFrontFetch_ValueIsStringArray_NoRefreshTtl() var listName = Utils.NewGuidString(); string[] values = new string[] { Utils.NewGuidString() }; - await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(5)).WithNoRefreshTtlOnUpdates()); + await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4)).WithNoRefreshTtlOnUpdates()); await Task.Delay(100); - await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(5)).WithNoRefreshTtlOnUpdates()); + await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); await Task.Delay(4900); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); @@ -461,9 +461,9 @@ public async Task ListConcatenateBackFetch_ValueIsByteArray_NoRefreshTtl() var listName = Utils.NewGuidString(); byte[][] values = new byte[][] { Utils.NewGuidByteArray() }; - await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(5)).WithNoRefreshTtlOnUpdates()); + await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4)).WithNoRefreshTtlOnUpdates()); await Task.Delay(100); - await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(5)).WithNoRefreshTtlOnUpdates()); + await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); await Task.Delay(4900); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); @@ -476,7 +476,7 @@ public async Task ListConcatenateBackFetch_ValueIsByteArray_RefreshTtl() var listName = Utils.NewGuidString(); byte[][] values = new byte[][] { Utils.NewGuidByteArray() }; - await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(5)).WithNoRefreshTtlOnUpdates()); + await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4)).WithNoRefreshTtlOnUpdates()); await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithRefreshTtlOnUpdates()); await Task.Delay(2000); @@ -540,10 +540,10 @@ public async Task ListConcatenateBackFetch_ValueIsStringArray_NoRefreshTtl() var listName = Utils.NewGuidString(); string[] values = new string[] { Utils.NewGuidString() }; - await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(5)).WithNoRefreshTtlOnUpdates()); + await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4)).WithNoRefreshTtlOnUpdates()); await Task.Delay(100); - await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(5)).WithNoRefreshTtlOnUpdates()); + await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); await Task.Delay(4900); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); @@ -556,7 +556,7 @@ public async Task ListConcatenateBackFetch_ValueIsStringArray_RefreshTtl() var listName = Utils.NewGuidString(); string[] values = new string[] { Utils.NewGuidString() }; - await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(5)).WithNoRefreshTtlOnUpdates()); + await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4)).WithNoRefreshTtlOnUpdates()); await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); await Task.Delay(2000); @@ -629,7 +629,7 @@ public async Task ListPushFrontFetch_ValueIsByteArray_NoRefreshTtl() var listName = Utils.NewGuidString(); var value = Utils.NewGuidByteArray(); - await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(5)).WithNoRefreshTtlOnUpdates()); + await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4)).WithNoRefreshTtlOnUpdates()); await Task.Delay(100); await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); @@ -716,7 +716,7 @@ public async Task ListPushFrontFetch_ValueIsString_NoRefreshTtl() var listName = Utils.NewGuidString(); var value = Utils.NewGuidString(); - await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(5)).WithNoRefreshTtlOnUpdates()); + await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4)).WithNoRefreshTtlOnUpdates()); await Task.Delay(100); await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); @@ -802,7 +802,7 @@ public async Task ListPushBackFetch_ValueIsByteArray_NoRefreshTtl() var listName = Utils.NewGuidString(); var value = Utils.NewGuidByteArray(); - await client.ListPushBackAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(5)).WithNoRefreshTtlOnUpdates()); + await client.ListPushBackAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4)).WithNoRefreshTtlOnUpdates()); await Task.Delay(100); await client.ListPushBackAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); diff --git a/tests/Integration/Momento.Sdk.Tests/SetTest.cs b/tests/Integration/Momento.Sdk.Tests/SetTest.cs index 72f4c257..e1fb2e7e 100644 --- a/tests/Integration/Momento.Sdk.Tests/SetTest.cs +++ b/tests/Integration/Momento.Sdk.Tests/SetTest.cs @@ -47,7 +47,7 @@ public async Task SetAddFetch_ElementIsByteArray_noRefreshTtlOnUpdates() var setName = Utils.NewGuidString(); var element = Utils.NewGuidByteArray(); - CacheSetAddElementResponse response = await client.SetAddElementAsync(cacheName, setName, element, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(5)).WithNoRefreshTtlOnUpdates()); + CacheSetAddElementResponse response = await client.SetAddElementAsync(cacheName, setName, element, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4)).WithNoRefreshTtlOnUpdates()); Assert.True(response is CacheSetAddElementResponse.Success, $"Unexpected response: {response}"); await Task.Delay(100); @@ -108,7 +108,7 @@ public async Task SetAddFetch_ElementIsString_noRefreshTtlOnUpdates() var setName = Utils.NewGuidString(); var element = Utils.NewGuidString(); - CacheSetAddElementResponse response = await client.SetAddElementAsync(cacheName, setName, element, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(5)).WithNoRefreshTtlOnUpdates()); + CacheSetAddElementResponse response = await client.SetAddElementAsync(cacheName, setName, element, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4)).WithNoRefreshTtlOnUpdates()); Assert.True(response is CacheSetAddElementResponse.Success, $"Unexpected response: {response}"); await Task.Delay(100); @@ -185,7 +185,7 @@ public async Task SetAddElementsAsync_ElementsAreByteArrayEnumerable_noRefreshTt var element = Utils.NewGuidByteArray(); var content = new List() { element }; - CacheSetAddElementsResponse response = await client.SetAddElementsAsync(cacheName, setName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(5)).WithNoRefreshTtlOnUpdates()); + CacheSetAddElementsResponse response = await client.SetAddElementsAsync(cacheName, setName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4)).WithNoRefreshTtlOnUpdates()); Assert.True(response is CacheSetAddElementsResponse.Success, $"Unexpected response: {response}"); await Task.Delay(100); @@ -265,7 +265,7 @@ public async Task SetAddElementsAsync_ElementsAreStringEnumerable_noRefreshTtlOn var element = Utils.NewGuidString(); var content = new List() { element }; - CacheSetAddElementsResponse response = await client.SetAddElementsAsync(cacheName, setName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(5)).WithNoRefreshTtlOnUpdates()); + CacheSetAddElementsResponse response = await client.SetAddElementsAsync(cacheName, setName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4)).WithNoRefreshTtlOnUpdates()); Assert.True(response is CacheSetAddElementsResponse.Success, $"Unexpected response: {response}"); await Task.Delay(100); From 1abed857b39ef7fb5fa82f9b9243935b94fba5ff Mon Sep 17 00:00:00 2001 From: Matt Straathof Date: Fri, 12 May 2023 11:35:32 -0700 Subject: [PATCH 3/6] fix: update int test ttls to be more lenient --- tests/Integration/Momento.Sdk.Tests/TtlTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Integration/Momento.Sdk.Tests/TtlTest.cs b/tests/Integration/Momento.Sdk.Tests/TtlTest.cs index 395adcb8..d1dd3538 100644 --- a/tests/Integration/Momento.Sdk.Tests/TtlTest.cs +++ b/tests/Integration/Momento.Sdk.Tests/TtlTest.cs @@ -76,7 +76,7 @@ public async Task UpdateTtlAsync_KeyIsByteArrayAndExists_IsSet() Assert.True(updateTtlResponse is CacheUpdateTtlResponse.Set, $"UpdateTtl call should have been Set but was: {response}"); // Wait for the TTL to expire - await Task.Delay(1000); + await Task.Delay(2000); // Check it is gone existsResponse = await client.KeyExistsAsync(cacheName, key); From e46d53b62fccb3d2ebf9b5d344666a5b8e7f9e31 Mon Sep 17 00:00:00 2001 From: Matt Straathof Date: Fri, 12 May 2023 11:39:03 -0700 Subject: [PATCH 4/6] fix: update int test ttls to be more lenient --- tests/Integration/Momento.Sdk.Tests/TtlTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Integration/Momento.Sdk.Tests/TtlTest.cs b/tests/Integration/Momento.Sdk.Tests/TtlTest.cs index d1dd3538..3fe0dd2a 100644 --- a/tests/Integration/Momento.Sdk.Tests/TtlTest.cs +++ b/tests/Integration/Momento.Sdk.Tests/TtlTest.cs @@ -103,7 +103,7 @@ public async Task UpdateTtlAsync_KeyIsStringAndExists_IsSet() Assert.True(updateTtlResponse is CacheUpdateTtlResponse.Set, $"UpdateTtl call should have been Set but was: {response}"); // Wait for the TTL to expire - await Task.Delay(1000); + await Task.Delay(2000); // Check it is gone existsResponse = await client.KeyExistsAsync(cacheName, key); From 9526f3f3e6a098a1f51a6a8cca9ffcde1dee5e2f Mon Sep 17 00:00:00 2001 From: Matt Straathof Date: Mon, 15 May 2023 13:08:20 -0700 Subject: [PATCH 5/6] chore: add static vars for test timeouts/sleeps --- .../Momento.Sdk.Tests/DictionaryTest.cs | 72 ++++++++-------- .../Integration/Momento.Sdk.Tests/ListTest.cs | 82 +++++++++---------- .../Integration/Momento.Sdk.Tests/SetTest.cs | 40 ++++----- tests/Integration/Momento.Sdk.Tests/Utils.cs | 8 ++ 4 files changed, 105 insertions(+), 97 deletions(-) diff --git a/tests/Integration/Momento.Sdk.Tests/DictionaryTest.cs b/tests/Integration/Momento.Sdk.Tests/DictionaryTest.cs index fdd3e4a8..06f5228a 100644 --- a/tests/Integration/Momento.Sdk.Tests/DictionaryTest.cs +++ b/tests/Integration/Momento.Sdk.Tests/DictionaryTest.cs @@ -85,13 +85,13 @@ public async Task DictionarySetGetAsync_FieldIsByteArrayValueIsByteArray_NoRefre var field = Utils.NewGuidByteArray(); var value = Utils.NewGuidByteArray(); - CacheDictionarySetFieldResponse setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, CollectionTtl.Of(TimeSpan.FromSeconds(4)).WithNoRefreshTtlOnUpdates()); + CacheDictionarySetFieldResponse setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl)).WithNoRefreshTtlOnUpdates()); Assert.True(setResponse is CacheDictionarySetFieldResponse.Success, $"Unexpected response: {setResponse}"); - await Task.Delay(100); + await Task.Delay(Utils.waitForItemToBeSet); - setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); + setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); Assert.True(setResponse is CacheDictionarySetFieldResponse.Success, $"Unexpected response: {setResponse}"); - await Task.Delay(4900); + await Task.Delay(Utils.waitForInitialItemToExpire); CacheDictionaryGetFieldResponse response = await client.DictionaryGetFieldAsync(cacheName, dictionaryName, field); Assert.True(response is CacheDictionaryGetFieldResponse.Miss, $"Unexpected response: {response}"); @@ -106,7 +106,7 @@ public async Task DictionarySetGetAsync_FieldIsByteArrayValueIsByteArray_Refresh CacheDictionarySetFieldResponse setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, CollectionTtl.Of(TimeSpan.FromSeconds(2))); Assert.True(setResponse is CacheDictionarySetFieldResponse.Success, $"Unexpected response: {setResponse}"); - setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, CollectionTtl.Of(TimeSpan.FromSeconds(10))); + setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); Assert.True(setResponse is CacheDictionarySetFieldResponse.Success, $"Unexpected response: {setResponse}"); await Task.Delay(2000); @@ -162,7 +162,7 @@ public async Task DictionaryIncrementAsync_IncrementFromZero_RefreshTtl() CacheDictionaryIncrementResponse resp = await client.DictionaryIncrementAsync(cacheName, dictionaryName, field, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2))); Assert.True(resp is CacheDictionaryIncrementResponse.Success, $"Unexpected response: {resp}"); - resp = await client.DictionaryIncrementAsync(cacheName, dictionaryName, field, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10))); + resp = await client.DictionaryIncrementAsync(cacheName, dictionaryName, field, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); Assert.True(resp is CacheDictionaryIncrementResponse.Success, $"Unexpected response: {resp}"); await Task.Delay(2000); @@ -177,13 +177,13 @@ public async Task DictionaryIncrementAsync_IncrementFromZero_NoRefreshTtl() var dictionaryName = Utils.NewGuidString(); var field = Utils.NewGuidString(); - CacheDictionaryIncrementResponse resp = await client.DictionaryIncrementAsync(cacheName, dictionaryName, field, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4))); + CacheDictionaryIncrementResponse resp = await client.DictionaryIncrementAsync(cacheName, dictionaryName, field, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl))); Assert.True(resp is CacheDictionaryIncrementResponse.Success, $"Unexpected response: {resp}"); - await Task.Delay(101); + await Task.Delay(Utils.waitForItemToBeSet); - resp = await client.DictionaryIncrementAsync(cacheName, dictionaryName, field, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); + resp = await client.DictionaryIncrementAsync(cacheName, dictionaryName, field, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); Assert.True(resp is CacheDictionaryIncrementResponse.Success, $"Unexpected response: {resp}"); - await Task.Delay(4900); + await Task.Delay(Utils.waitForInitialItemToExpire); CacheDictionaryGetFieldResponse response = await client.DictionaryGetFieldAsync(cacheName, dictionaryName, field); Assert.True(response is CacheDictionaryGetFieldResponse.Miss, $"Unexpected response: {response}"); @@ -316,13 +316,13 @@ public async Task DictionarySetGetAsync_FieldIsStringValueIsString_NoRefreshTtl( var field = Utils.NewGuidString(); var value = Utils.NewGuidString(); - CacheDictionarySetFieldResponse setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4))); + CacheDictionarySetFieldResponse setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl))); Assert.True(setResponse is CacheDictionarySetFieldResponse.Success, $"Unexpected response: {setResponse}"); - await Task.Delay(100); + await Task.Delay(Utils.waitForItemToBeSet); - setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); + setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); Assert.True(setResponse is CacheDictionarySetFieldResponse.Success, $"Unexpected response: {setResponse}"); - await Task.Delay(4900); + await Task.Delay(Utils.waitForInitialItemToExpire); CacheDictionaryGetFieldResponse response = await client.DictionaryGetFieldAsync(cacheName, dictionaryName, field); Assert.True(response is CacheDictionaryGetFieldResponse.Miss, $"Unexpected response: {response}"); @@ -337,7 +337,7 @@ public async Task DictionarySetGetAsync_FieldIsStringValueIsString_RefreshTtl() CacheDictionarySetFieldResponse setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2))); Assert.True(setResponse is CacheDictionarySetFieldResponse.Success, $"Unexpected response: {setResponse}"); - setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10))); + setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); Assert.True(setResponse is CacheDictionarySetFieldResponse.Success, $"Unexpected response: {setResponse}"); await Task.Delay(2000); @@ -379,13 +379,13 @@ public async Task DictionarySetGetAsync_FieldIsStringValueIsByteArray_NoRefreshT var field = Utils.NewGuidString(); var value = Utils.NewGuidByteArray(); - CacheDictionarySetFieldResponse setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4))); + CacheDictionarySetFieldResponse setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl))); Assert.True(setResponse is CacheDictionarySetFieldResponse.Success, $"Unexpected response: {setResponse}"); - await Task.Delay(100); + await Task.Delay(Utils.waitForItemToBeSet); - setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); + setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); Assert.True(setResponse is CacheDictionarySetFieldResponse.Success, $"Unexpected response: {setResponse}"); - await Task.Delay(4900); + await Task.Delay(Utils.waitForInitialItemToExpire); CacheDictionaryGetFieldResponse response = await client.DictionaryGetFieldAsync(cacheName, dictionaryName, field); Assert.True(response is CacheDictionaryGetFieldResponse.Miss, $"Unexpected response: {response}"); @@ -400,7 +400,7 @@ public async Task DictionarySetGetAsync_FieldIsStringValueIsByteArray_RefreshTtl CacheDictionarySetFieldResponse setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2))); Assert.True(setResponse is CacheDictionarySetFieldResponse.Success, $"Unexpected response: {setResponse}"); - setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10))); + setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); Assert.True(setResponse is CacheDictionarySetFieldResponse.Success, $"Unexpected response: {setResponse}"); await Task.Delay(2000); @@ -441,7 +441,7 @@ public async Task DictionarySetFieldsAsync_FieldsAreByteArrayValuesAreByteArray_ var items = new Dictionary() { { field1, value1 }, { field2, value2 } }; - await client.DictionarySetFieldsAsync(cacheName, dictionaryName, items, CollectionTtl.Of(TimeSpan.FromSeconds(10))); + await client.DictionarySetFieldsAsync(cacheName, dictionaryName, items, CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); CacheDictionaryGetFieldResponse getResponse = await client.DictionaryGetFieldAsync(cacheName, dictionaryName, field1); Assert.True(getResponse is CacheDictionaryGetFieldResponse.Hit, $"Unexpected response: {getResponse}"); @@ -460,11 +460,11 @@ public async Task DictionarySetFieldsAsync_FieldsAreByteArrayValuesAreByteArray_ var value = Utils.NewGuidByteArray(); var content = new Dictionary() { { field, value } }; - await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4))); - await Task.Delay(100); + await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl))); + await Task.Delay(Utils.waitForItemToBeSet); - await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(4900); + await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.waitForInitialItemToExpire); CacheDictionaryGetFieldResponse response = await client.DictionaryGetFieldAsync(cacheName, dictionaryName, field); Assert.True(response is CacheDictionaryGetFieldResponse.Miss, $"Unexpected response: {response}"); @@ -479,7 +479,7 @@ public async Task DictionarySetFieldsAsync_FieldsAreByteArrayValuesAreByteArray_ var content = new Dictionary() { { field, value } }; await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2))); - await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10))); + await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); await Task.Delay(2000); CacheDictionaryGetFieldResponse response = await client.DictionaryGetFieldAsync(cacheName, dictionaryName, field); @@ -538,11 +538,11 @@ public async Task DictionarySetFieldsAsync_FieldsAreStringValuesAreString_NoRefr var value = Utils.NewGuidString(); var content = new Dictionary() { { field, value } }; - await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4))); - await Task.Delay(100); + await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl))); + await Task.Delay(Utils.waitForItemToBeSet); - await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(4900); + await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.waitForInitialItemToExpire); CacheDictionaryGetFieldResponse response = await client.DictionaryGetFieldAsync(cacheName, dictionaryName, field); Assert.True(response is CacheDictionaryGetFieldResponse.Miss, $"Unexpected response: {response}"); @@ -557,7 +557,7 @@ public async Task DictionarySetFieldsAsync_FieldsAreStringValuesAreString_Refres var content = new Dictionary() { { field, value } }; await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2))); - await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10))); + await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); await Task.Delay(2000); CacheDictionaryGetFieldResponse response = await client.DictionaryGetFieldAsync(cacheName, dictionaryName, field); @@ -616,11 +616,11 @@ public async Task DictionarySetFieldsAsync_FieldsAreStringValuesAreByteArray_NoR var value = Utils.NewGuidByteArray(); var content = new Dictionary() { { field, value } }; - await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(100); + await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.waitForItemToBeSet); - await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(4900); + await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.waitForInitialItemToExpire); CacheDictionaryGetFieldResponse response = await client.DictionaryGetFieldAsync(cacheName, dictionaryName, field); Assert.True(response is CacheDictionaryGetFieldResponse.Miss, $"Unexpected response: {response}"); @@ -635,7 +635,7 @@ public async Task DictionarySetFieldsAsync_FieldsAreStringValuesAreByteArray_Ref var content = new Dictionary() { { field, value } }; await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2))); - await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10))); + await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); await Task.Delay(2000); CacheDictionaryGetFieldResponse response = await client.DictionaryGetFieldAsync(cacheName, dictionaryName, field); diff --git a/tests/Integration/Momento.Sdk.Tests/ListTest.cs b/tests/Integration/Momento.Sdk.Tests/ListTest.cs index b4f2bbd8..14123db5 100644 --- a/tests/Integration/Momento.Sdk.Tests/ListTest.cs +++ b/tests/Integration/Momento.Sdk.Tests/ListTest.cs @@ -285,11 +285,11 @@ public async Task ListConcatenateFrontFetch_ValueIsByteArray_NoRefreshTtl() var listName = Utils.NewGuidString(); byte[][] values = new byte[][] { Utils.NewGuidByteArray() }; - await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(100); + await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.waitForItemToBeSet); - await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(4900); + await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.waitForInitialItemToExpire); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); Assert.True(response is CacheListFetchResponse.Miss, $"Unexpected response: {response}"); @@ -302,7 +302,7 @@ public async Task ListConcatenateFrontFetch_ValueIsByteArray_RefreshTtl() byte[][] values = new byte[][] { Utils.NewGuidByteArray() }; await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2)).WithNoRefreshTtlOnUpdates()); - await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10))); + await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); await Task.Delay(2000); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); @@ -365,11 +365,11 @@ public async Task ListConcatenateFrontFetch_ValueIsStringArray_NoRefreshTtl() var listName = Utils.NewGuidString(); string[] values = new string[] { Utils.NewGuidString() }; - await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(100); + await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.waitForItemToBeSet); - await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(4900); + await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.waitForInitialItemToExpire); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); Assert.True(response is CacheListFetchResponse.Miss, $"Unexpected response: {response}"); @@ -382,7 +382,7 @@ public async Task ListConcatenateFrontFetch_ValueIsStringArray_RefreshTtl() string[] values = new string[] { Utils.NewGuidString() }; await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2)).WithNoRefreshTtlOnUpdates()); - await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithRefreshTtlOnUpdates()); + await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithRefreshTtlOnUpdates()); await Task.Delay(2000); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); @@ -461,10 +461,10 @@ public async Task ListConcatenateBackFetch_ValueIsByteArray_NoRefreshTtl() var listName = Utils.NewGuidString(); byte[][] values = new byte[][] { Utils.NewGuidByteArray() }; - await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(100); - await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(4900); + await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.waitForItemToBeSet); + await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.waitForInitialItemToExpire); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); Assert.True(response is CacheListFetchResponse.Miss, $"Unexpected response: {response}"); @@ -476,8 +476,8 @@ public async Task ListConcatenateBackFetch_ValueIsByteArray_RefreshTtl() var listName = Utils.NewGuidString(); byte[][] values = new byte[][] { Utils.NewGuidByteArray() }; - await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4)).WithNoRefreshTtlOnUpdates()); - await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithRefreshTtlOnUpdates()); + await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithRefreshTtlOnUpdates()); await Task.Delay(2000); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); @@ -540,11 +540,11 @@ public async Task ListConcatenateBackFetch_ValueIsStringArray_NoRefreshTtl() var listName = Utils.NewGuidString(); string[] values = new string[] { Utils.NewGuidString() }; - await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(100); + await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.waitForItemToBeSet); - await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(4900); + await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.waitForInitialItemToExpire); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); Assert.True(response is CacheListFetchResponse.Miss, $"Unexpected response: {response}"); @@ -556,8 +556,8 @@ public async Task ListConcatenateBackFetch_ValueIsStringArray_RefreshTtl() var listName = Utils.NewGuidString(); string[] values = new string[] { Utils.NewGuidString() }; - await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4)).WithNoRefreshTtlOnUpdates()); - await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); + await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); await Task.Delay(2000); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); @@ -629,11 +629,11 @@ public async Task ListPushFrontFetch_ValueIsByteArray_NoRefreshTtl() var listName = Utils.NewGuidString(); var value = Utils.NewGuidByteArray(); - await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(100); + await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.waitForItemToBeSet); - await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(4900); + await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.waitForInitialItemToExpire); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); Assert.True(response is CacheListFetchResponse.Miss, $"Unexpected response: {response}"); @@ -646,7 +646,7 @@ public async Task ListPushFrontFetch_ValueIsByteArray_RefreshTtl() var value = Utils.NewGuidByteArray(); await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2)).WithNoRefreshTtlOnUpdates()); - await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10))); + await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); await Task.Delay(2000); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); @@ -716,11 +716,11 @@ public async Task ListPushFrontFetch_ValueIsString_NoRefreshTtl() var listName = Utils.NewGuidString(); var value = Utils.NewGuidString(); - await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(100); + await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.waitForItemToBeSet); - await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(4900); + await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.waitForInitialItemToExpire); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); Assert.True(response is CacheListFetchResponse.Miss, $"Unexpected response: {response}"); @@ -733,7 +733,7 @@ public async Task ListPushFrontFetch_ValueIsString_RefreshTtl() var value = Utils.NewGuidString(); await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2)).WithNoRefreshTtlOnUpdates()); - await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10))); + await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); await Task.Delay(2000); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); @@ -802,11 +802,11 @@ public async Task ListPushBackFetch_ValueIsByteArray_NoRefreshTtl() var listName = Utils.NewGuidString(); var value = Utils.NewGuidByteArray(); - await client.ListPushBackAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(100); + await client.ListPushBackAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.waitForItemToBeSet); - await client.ListPushBackAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(4900); + await client.ListPushBackAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.waitForInitialItemToExpire); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); Assert.True(response is CacheListFetchResponse.Miss, $"Unexpected response: {response}"); @@ -819,7 +819,7 @@ public async Task ListPushBackFetch_ValueIsByteArray_RefreshTtl() var value = Utils.NewGuidByteArray(); await client.ListPushBackAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2)).WithNoRefreshTtlOnUpdates()); - await client.ListPushBackAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10))); + await client.ListPushBackAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); await Task.Delay(2000); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); @@ -961,10 +961,10 @@ public async Task ListPushBackFetch_ValueIsString_NoRefreshTtl() var value = Utils.NewGuidString(); await client.ListPushBackAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(100); + await Task.Delay(Utils.waitForItemToBeSet); - await client.ListPushBackAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(4900); + await client.ListPushBackAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.waitForInitialItemToExpire); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); Assert.True(response is CacheListFetchResponse.Miss, $"Unexpected response: {response}"); @@ -977,7 +977,7 @@ public async Task ListPushBackFetch_ValueIsString_RefreshTtl() var value = Utils.NewGuidString(); await client.ListPushBackAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2))); - await client.ListPushBackAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10))); + await client.ListPushBackAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); await Task.Delay(2000); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); diff --git a/tests/Integration/Momento.Sdk.Tests/SetTest.cs b/tests/Integration/Momento.Sdk.Tests/SetTest.cs index e1fb2e7e..3aa7f342 100644 --- a/tests/Integration/Momento.Sdk.Tests/SetTest.cs +++ b/tests/Integration/Momento.Sdk.Tests/SetTest.cs @@ -47,13 +47,13 @@ public async Task SetAddFetch_ElementIsByteArray_noRefreshTtlOnUpdates() var setName = Utils.NewGuidString(); var element = Utils.NewGuidByteArray(); - CacheSetAddElementResponse response = await client.SetAddElementAsync(cacheName, setName, element, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4)).WithNoRefreshTtlOnUpdates()); + CacheSetAddElementResponse response = await client.SetAddElementAsync(cacheName, setName, element, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl)).WithNoRefreshTtlOnUpdates()); Assert.True(response is CacheSetAddElementResponse.Success, $"Unexpected response: {response}"); - await Task.Delay(100); + await Task.Delay(Utils.waitForItemToBeSet); - response = await client.SetAddElementAsync(cacheName, setName, element, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); + response = await client.SetAddElementAsync(cacheName, setName, element, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); Assert.True(response is CacheSetAddElementResponse.Success, $"Unexpected response: {response}"); - await Task.Delay(4900); + await Task.Delay(Utils.waitForInitialItemToExpire); CacheSetFetchResponse fetchResponse = await client.SetFetchAsync(cacheName, setName); Assert.True(fetchResponse is CacheSetFetchResponse.Miss, $"Unexpected response: {fetchResponse}"); } @@ -66,7 +66,7 @@ public async Task SetAddFetch_ElementIsByteArray_RefreshTtl() CacheSetAddElementResponse response = await client.SetAddElementAsync(cacheName, setName, element, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2)).WithNoRefreshTtlOnUpdates()); Assert.True(response is CacheSetAddElementResponse.Success, $"Unexpected response: {response}"); - await client.SetAddElementAsync(cacheName, setName, element, CollectionTtl.Of(TimeSpan.FromSeconds(10))); + await client.SetAddElementAsync(cacheName, setName, element, CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); await Task.Delay(2000); CacheSetFetchResponse fetchResponse = await client.SetFetchAsync(cacheName, setName); @@ -108,13 +108,13 @@ public async Task SetAddFetch_ElementIsString_noRefreshTtlOnUpdates() var setName = Utils.NewGuidString(); var element = Utils.NewGuidString(); - CacheSetAddElementResponse response = await client.SetAddElementAsync(cacheName, setName, element, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4)).WithNoRefreshTtlOnUpdates()); + CacheSetAddElementResponse response = await client.SetAddElementAsync(cacheName, setName, element, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl)).WithNoRefreshTtlOnUpdates()); Assert.True(response is CacheSetAddElementResponse.Success, $"Unexpected response: {response}"); - await Task.Delay(100); + await Task.Delay(Utils.waitForItemToBeSet); - response = await client.SetAddElementAsync(cacheName, setName, element, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); + response = await client.SetAddElementAsync(cacheName, setName, element, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); Assert.True(response is CacheSetAddElementResponse.Success, $"Unexpected response: {response}"); - await Task.Delay(4900); + await Task.Delay(Utils.waitForInitialItemToExpire); CacheSetFetchResponse fetchResponse = await client.SetFetchAsync(cacheName, setName); Assert.True(fetchResponse is CacheSetFetchResponse.Miss, $"Unexpected response: {fetchResponse}"); @@ -128,7 +128,7 @@ public async Task SetAddFetch_ElementIsString_RefreshTtl() CacheSetAddElementResponse response = await client.SetAddElementAsync(cacheName, setName, element, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2)).WithNoRefreshTtlOnUpdates()); Assert.True(response is CacheSetAddElementResponse.Success, $"Unexpected response: {response}"); - response = await client.SetAddElementAsync(cacheName, setName, element, CollectionTtl.Of(TimeSpan.FromSeconds(10))); + response = await client.SetAddElementAsync(cacheName, setName, element, CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); Assert.True(response is CacheSetAddElementResponse.Success, $"Unexpected response: {response}"); await Task.Delay(2000); @@ -185,13 +185,13 @@ public async Task SetAddElementsAsync_ElementsAreByteArrayEnumerable_noRefreshTt var element = Utils.NewGuidByteArray(); var content = new List() { element }; - CacheSetAddElementsResponse response = await client.SetAddElementsAsync(cacheName, setName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4)).WithNoRefreshTtlOnUpdates()); + CacheSetAddElementsResponse response = await client.SetAddElementsAsync(cacheName, setName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl)).WithNoRefreshTtlOnUpdates()); Assert.True(response is CacheSetAddElementsResponse.Success, $"Unexpected response: {response}"); - await Task.Delay(100); + await Task.Delay(Utils.waitForItemToBeSet); - response = await client.SetAddElementsAsync(cacheName, setName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); + response = await client.SetAddElementsAsync(cacheName, setName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); Assert.True(response is CacheSetAddElementsResponse.Success, $"Unexpected response: {response}"); - await Task.Delay(4900); + await Task.Delay(Utils.waitForInitialItemToExpire); CacheSetFetchResponse fetchResponse = await client.SetFetchAsync(cacheName, setName); Assert.True(fetchResponse is CacheSetFetchResponse.Miss, $"Unexpected response: {fetchResponse}"); @@ -206,7 +206,7 @@ public async Task SetAddElementsAsync_ElementsAreByteArrayEnumerable_RefreshTtl( CacheSetAddElementsResponse response = await client.SetAddElementsAsync(cacheName, setName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2)).WithNoRefreshTtlOnUpdates()); Assert.True(response is CacheSetAddElementsResponse.Success, $"Unexpected response: {response}"); - await client.SetAddElementsAsync(cacheName, setName, content, CollectionTtl.Of(TimeSpan.FromSeconds(10))); + await client.SetAddElementsAsync(cacheName, setName, content, CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); await Task.Delay(2000); CacheSetFetchResponse fetchResponse = await client.SetFetchAsync(cacheName, setName); @@ -265,13 +265,13 @@ public async Task SetAddElementsAsync_ElementsAreStringEnumerable_noRefreshTtlOn var element = Utils.NewGuidString(); var content = new List() { element }; - CacheSetAddElementsResponse response = await client.SetAddElementsAsync(cacheName, setName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(4)).WithNoRefreshTtlOnUpdates()); + CacheSetAddElementsResponse response = await client.SetAddElementsAsync(cacheName, setName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl)).WithNoRefreshTtlOnUpdates()); Assert.True(response is CacheSetAddElementsResponse.Success, $"Unexpected response: {response}"); - await Task.Delay(100); + await Task.Delay(Utils.waitForItemToBeSet); - response = await client.SetAddElementsAsync(cacheName, setName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(10)).WithNoRefreshTtlOnUpdates()); + response = await client.SetAddElementsAsync(cacheName, setName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); Assert.True(response is CacheSetAddElementsResponse.Success, $"Unexpected response: {response}"); - await Task.Delay(4900); + await Task.Delay(Utils.waitForInitialItemToExpire); CacheSetFetchResponse fetchResponse = await client.SetFetchAsync(cacheName, setName); Assert.True(fetchResponse is CacheSetFetchResponse.Miss, $"Unexpected response: {fetchResponse}"); @@ -286,7 +286,7 @@ public async Task SetAddElementsAsync_ElementsAreStringEnumerable_RefreshTtl() CacheSetAddElementsResponse response = await client.SetAddElementsAsync(cacheName, setName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2)).WithNoRefreshTtlOnUpdates()); Assert.True(response is CacheSetAddElementsResponse.Success, $"Unexpected response: {response}"); - response = await client.SetAddElementsAsync(cacheName, setName, content, CollectionTtl.Of(TimeSpan.FromSeconds(10))); + response = await client.SetAddElementsAsync(cacheName, setName, content, CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); Assert.True(response is CacheSetAddElementsResponse.Success, $"Unexpected response: {response}"); await Task.Delay(2000); diff --git a/tests/Integration/Momento.Sdk.Tests/Utils.cs b/tests/Integration/Momento.Sdk.Tests/Utils.cs index 47134ba4..27eab327 100644 --- a/tests/Integration/Momento.Sdk.Tests/Utils.cs +++ b/tests/Integration/Momento.Sdk.Tests/Utils.cs @@ -11,4 +11,12 @@ public static class Utils public static string NewGuidString() => Guid.NewGuid().ToString(); public static byte[] NewGuidByteArray() => Guid.NewGuid().ToByteArray(); + + public static int initialRefreshTtl = 4; + + public static int updatedRefreshTtl = 10; + + public static int waitForItemToBeSet = 100; + + public static int waitForInitialItemToExpire = 4900; } \ No newline at end of file From 560e397a5a96f24db2f2fe92363503739e0540ff Mon Sep 17 00:00:00 2001 From: Matt Straathof Date: Mon, 15 May 2023 13:52:20 -0700 Subject: [PATCH 6/6] chore: make util static fields readonly --- .../Momento.Sdk.Tests/DictionaryTest.cs | 72 ++++++++-------- .../Integration/Momento.Sdk.Tests/ListTest.cs | 82 +++++++++---------- .../Integration/Momento.Sdk.Tests/SetTest.cs | 40 ++++----- tests/Integration/Momento.Sdk.Tests/Utils.cs | 8 +- 4 files changed, 101 insertions(+), 101 deletions(-) diff --git a/tests/Integration/Momento.Sdk.Tests/DictionaryTest.cs b/tests/Integration/Momento.Sdk.Tests/DictionaryTest.cs index 06f5228a..9122712b 100644 --- a/tests/Integration/Momento.Sdk.Tests/DictionaryTest.cs +++ b/tests/Integration/Momento.Sdk.Tests/DictionaryTest.cs @@ -85,13 +85,13 @@ public async Task DictionarySetGetAsync_FieldIsByteArrayValueIsByteArray_NoRefre var field = Utils.NewGuidByteArray(); var value = Utils.NewGuidByteArray(); - CacheDictionarySetFieldResponse setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl)).WithNoRefreshTtlOnUpdates()); + CacheDictionarySetFieldResponse setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, CollectionTtl.Of(TimeSpan.FromSeconds(Utils.InitialRefreshTtl)).WithNoRefreshTtlOnUpdates()); Assert.True(setResponse is CacheDictionarySetFieldResponse.Success, $"Unexpected response: {setResponse}"); - await Task.Delay(Utils.waitForItemToBeSet); + await Task.Delay(Utils.WaitForItemToBeSet); - setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); Assert.True(setResponse is CacheDictionarySetFieldResponse.Success, $"Unexpected response: {setResponse}"); - await Task.Delay(Utils.waitForInitialItemToExpire); + await Task.Delay(Utils.WaitForInitialItemToExpire); CacheDictionaryGetFieldResponse response = await client.DictionaryGetFieldAsync(cacheName, dictionaryName, field); Assert.True(response is CacheDictionaryGetFieldResponse.Miss, $"Unexpected response: {response}"); @@ -106,7 +106,7 @@ public async Task DictionarySetGetAsync_FieldIsByteArrayValueIsByteArray_Refresh CacheDictionarySetFieldResponse setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, CollectionTtl.Of(TimeSpan.FromSeconds(2))); Assert.True(setResponse is CacheDictionarySetFieldResponse.Success, $"Unexpected response: {setResponse}"); - setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); + setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl))); Assert.True(setResponse is CacheDictionarySetFieldResponse.Success, $"Unexpected response: {setResponse}"); await Task.Delay(2000); @@ -162,7 +162,7 @@ public async Task DictionaryIncrementAsync_IncrementFromZero_RefreshTtl() CacheDictionaryIncrementResponse resp = await client.DictionaryIncrementAsync(cacheName, dictionaryName, field, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2))); Assert.True(resp is CacheDictionaryIncrementResponse.Success, $"Unexpected response: {resp}"); - resp = await client.DictionaryIncrementAsync(cacheName, dictionaryName, field, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); + resp = await client.DictionaryIncrementAsync(cacheName, dictionaryName, field, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl))); Assert.True(resp is CacheDictionaryIncrementResponse.Success, $"Unexpected response: {resp}"); await Task.Delay(2000); @@ -177,13 +177,13 @@ public async Task DictionaryIncrementAsync_IncrementFromZero_NoRefreshTtl() var dictionaryName = Utils.NewGuidString(); var field = Utils.NewGuidString(); - CacheDictionaryIncrementResponse resp = await client.DictionaryIncrementAsync(cacheName, dictionaryName, field, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl))); + CacheDictionaryIncrementResponse resp = await client.DictionaryIncrementAsync(cacheName, dictionaryName, field, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.InitialRefreshTtl))); Assert.True(resp is CacheDictionaryIncrementResponse.Success, $"Unexpected response: {resp}"); - await Task.Delay(Utils.waitForItemToBeSet); + await Task.Delay(Utils.WaitForItemToBeSet); - resp = await client.DictionaryIncrementAsync(cacheName, dictionaryName, field, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + resp = await client.DictionaryIncrementAsync(cacheName, dictionaryName, field, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); Assert.True(resp is CacheDictionaryIncrementResponse.Success, $"Unexpected response: {resp}"); - await Task.Delay(Utils.waitForInitialItemToExpire); + await Task.Delay(Utils.WaitForInitialItemToExpire); CacheDictionaryGetFieldResponse response = await client.DictionaryGetFieldAsync(cacheName, dictionaryName, field); Assert.True(response is CacheDictionaryGetFieldResponse.Miss, $"Unexpected response: {response}"); @@ -316,13 +316,13 @@ public async Task DictionarySetGetAsync_FieldIsStringValueIsString_NoRefreshTtl( var field = Utils.NewGuidString(); var value = Utils.NewGuidString(); - CacheDictionarySetFieldResponse setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl))); + CacheDictionarySetFieldResponse setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.InitialRefreshTtl))); Assert.True(setResponse is CacheDictionarySetFieldResponse.Success, $"Unexpected response: {setResponse}"); - await Task.Delay(Utils.waitForItemToBeSet); + await Task.Delay(Utils.WaitForItemToBeSet); - setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); Assert.True(setResponse is CacheDictionarySetFieldResponse.Success, $"Unexpected response: {setResponse}"); - await Task.Delay(Utils.waitForInitialItemToExpire); + await Task.Delay(Utils.WaitForInitialItemToExpire); CacheDictionaryGetFieldResponse response = await client.DictionaryGetFieldAsync(cacheName, dictionaryName, field); Assert.True(response is CacheDictionaryGetFieldResponse.Miss, $"Unexpected response: {response}"); @@ -337,7 +337,7 @@ public async Task DictionarySetGetAsync_FieldIsStringValueIsString_RefreshTtl() CacheDictionarySetFieldResponse setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2))); Assert.True(setResponse is CacheDictionarySetFieldResponse.Success, $"Unexpected response: {setResponse}"); - setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); + setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl))); Assert.True(setResponse is CacheDictionarySetFieldResponse.Success, $"Unexpected response: {setResponse}"); await Task.Delay(2000); @@ -379,13 +379,13 @@ public async Task DictionarySetGetAsync_FieldIsStringValueIsByteArray_NoRefreshT var field = Utils.NewGuidString(); var value = Utils.NewGuidByteArray(); - CacheDictionarySetFieldResponse setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl))); + CacheDictionarySetFieldResponse setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.InitialRefreshTtl))); Assert.True(setResponse is CacheDictionarySetFieldResponse.Success, $"Unexpected response: {setResponse}"); - await Task.Delay(Utils.waitForItemToBeSet); + await Task.Delay(Utils.WaitForItemToBeSet); - setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); Assert.True(setResponse is CacheDictionarySetFieldResponse.Success, $"Unexpected response: {setResponse}"); - await Task.Delay(Utils.waitForInitialItemToExpire); + await Task.Delay(Utils.WaitForInitialItemToExpire); CacheDictionaryGetFieldResponse response = await client.DictionaryGetFieldAsync(cacheName, dictionaryName, field); Assert.True(response is CacheDictionaryGetFieldResponse.Miss, $"Unexpected response: {response}"); @@ -400,7 +400,7 @@ public async Task DictionarySetGetAsync_FieldIsStringValueIsByteArray_RefreshTtl CacheDictionarySetFieldResponse setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2))); Assert.True(setResponse is CacheDictionarySetFieldResponse.Success, $"Unexpected response: {setResponse}"); - setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); + setResponse = await client.DictionarySetFieldAsync(cacheName, dictionaryName, field, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl))); Assert.True(setResponse is CacheDictionarySetFieldResponse.Success, $"Unexpected response: {setResponse}"); await Task.Delay(2000); @@ -441,7 +441,7 @@ public async Task DictionarySetFieldsAsync_FieldsAreByteArrayValuesAreByteArray_ var items = new Dictionary() { { field1, value1 }, { field2, value2 } }; - await client.DictionarySetFieldsAsync(cacheName, dictionaryName, items, CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); + await client.DictionarySetFieldsAsync(cacheName, dictionaryName, items, CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl))); CacheDictionaryGetFieldResponse getResponse = await client.DictionaryGetFieldAsync(cacheName, dictionaryName, field1); Assert.True(getResponse is CacheDictionaryGetFieldResponse.Hit, $"Unexpected response: {getResponse}"); @@ -460,11 +460,11 @@ public async Task DictionarySetFieldsAsync_FieldsAreByteArrayValuesAreByteArray_ var value = Utils.NewGuidByteArray(); var content = new Dictionary() { { field, value } }; - await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl))); - await Task.Delay(Utils.waitForItemToBeSet); + await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.InitialRefreshTtl))); + await Task.Delay(Utils.WaitForItemToBeSet); - await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(Utils.waitForInitialItemToExpire); + await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.WaitForInitialItemToExpire); CacheDictionaryGetFieldResponse response = await client.DictionaryGetFieldAsync(cacheName, dictionaryName, field); Assert.True(response is CacheDictionaryGetFieldResponse.Miss, $"Unexpected response: {response}"); @@ -479,7 +479,7 @@ public async Task DictionarySetFieldsAsync_FieldsAreByteArrayValuesAreByteArray_ var content = new Dictionary() { { field, value } }; await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2))); - await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); + await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl))); await Task.Delay(2000); CacheDictionaryGetFieldResponse response = await client.DictionaryGetFieldAsync(cacheName, dictionaryName, field); @@ -538,11 +538,11 @@ public async Task DictionarySetFieldsAsync_FieldsAreStringValuesAreString_NoRefr var value = Utils.NewGuidString(); var content = new Dictionary() { { field, value } }; - await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl))); - await Task.Delay(Utils.waitForItemToBeSet); + await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.InitialRefreshTtl))); + await Task.Delay(Utils.WaitForItemToBeSet); - await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(Utils.waitForInitialItemToExpire); + await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.WaitForInitialItemToExpire); CacheDictionaryGetFieldResponse response = await client.DictionaryGetFieldAsync(cacheName, dictionaryName, field); Assert.True(response is CacheDictionaryGetFieldResponse.Miss, $"Unexpected response: {response}"); @@ -557,7 +557,7 @@ public async Task DictionarySetFieldsAsync_FieldsAreStringValuesAreString_Refres var content = new Dictionary() { { field, value } }; await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2))); - await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); + await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl))); await Task.Delay(2000); CacheDictionaryGetFieldResponse response = await client.DictionaryGetFieldAsync(cacheName, dictionaryName, field); @@ -616,11 +616,11 @@ public async Task DictionarySetFieldsAsync_FieldsAreStringValuesAreByteArray_NoR var value = Utils.NewGuidByteArray(); var content = new Dictionary() { { field, value } }; - await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(Utils.waitForItemToBeSet); + await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.InitialRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.WaitForItemToBeSet); - await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(Utils.waitForInitialItemToExpire); + await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.WaitForInitialItemToExpire); CacheDictionaryGetFieldResponse response = await client.DictionaryGetFieldAsync(cacheName, dictionaryName, field); Assert.True(response is CacheDictionaryGetFieldResponse.Miss, $"Unexpected response: {response}"); @@ -635,7 +635,7 @@ public async Task DictionarySetFieldsAsync_FieldsAreStringValuesAreByteArray_Ref var content = new Dictionary() { { field, value } }; await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2))); - await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); + await client.DictionarySetFieldsAsync(cacheName, dictionaryName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl))); await Task.Delay(2000); CacheDictionaryGetFieldResponse response = await client.DictionaryGetFieldAsync(cacheName, dictionaryName, field); diff --git a/tests/Integration/Momento.Sdk.Tests/ListTest.cs b/tests/Integration/Momento.Sdk.Tests/ListTest.cs index 14123db5..f01a2ccc 100644 --- a/tests/Integration/Momento.Sdk.Tests/ListTest.cs +++ b/tests/Integration/Momento.Sdk.Tests/ListTest.cs @@ -285,11 +285,11 @@ public async Task ListConcatenateFrontFetch_ValueIsByteArray_NoRefreshTtl() var listName = Utils.NewGuidString(); byte[][] values = new byte[][] { Utils.NewGuidByteArray() }; - await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(Utils.waitForItemToBeSet); + await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.InitialRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.WaitForItemToBeSet); - await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(Utils.waitForInitialItemToExpire); + await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.WaitForInitialItemToExpire); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); Assert.True(response is CacheListFetchResponse.Miss, $"Unexpected response: {response}"); @@ -302,7 +302,7 @@ public async Task ListConcatenateFrontFetch_ValueIsByteArray_RefreshTtl() byte[][] values = new byte[][] { Utils.NewGuidByteArray() }; await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2)).WithNoRefreshTtlOnUpdates()); - await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); + await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl))); await Task.Delay(2000); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); @@ -365,11 +365,11 @@ public async Task ListConcatenateFrontFetch_ValueIsStringArray_NoRefreshTtl() var listName = Utils.NewGuidString(); string[] values = new string[] { Utils.NewGuidString() }; - await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(Utils.waitForItemToBeSet); + await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.InitialRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.WaitForItemToBeSet); - await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(Utils.waitForInitialItemToExpire); + await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.WaitForInitialItemToExpire); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); Assert.True(response is CacheListFetchResponse.Miss, $"Unexpected response: {response}"); @@ -382,7 +382,7 @@ public async Task ListConcatenateFrontFetch_ValueIsStringArray_RefreshTtl() string[] values = new string[] { Utils.NewGuidString() }; await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2)).WithNoRefreshTtlOnUpdates()); - await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithRefreshTtlOnUpdates()); + await client.ListConcatenateFrontAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl)).WithRefreshTtlOnUpdates()); await Task.Delay(2000); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); @@ -461,10 +461,10 @@ public async Task ListConcatenateBackFetch_ValueIsByteArray_NoRefreshTtl() var listName = Utils.NewGuidString(); byte[][] values = new byte[][] { Utils.NewGuidByteArray() }; - await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(Utils.waitForItemToBeSet); - await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(Utils.waitForInitialItemToExpire); + await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.InitialRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.WaitForItemToBeSet); + await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.WaitForInitialItemToExpire); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); Assert.True(response is CacheListFetchResponse.Miss, $"Unexpected response: {response}"); @@ -476,8 +476,8 @@ public async Task ListConcatenateBackFetch_ValueIsByteArray_RefreshTtl() var listName = Utils.NewGuidString(); byte[][] values = new byte[][] { Utils.NewGuidByteArray() }; - await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl)).WithNoRefreshTtlOnUpdates()); - await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithRefreshTtlOnUpdates()); + await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.InitialRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl)).WithRefreshTtlOnUpdates()); await Task.Delay(2000); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); @@ -540,11 +540,11 @@ public async Task ListConcatenateBackFetch_ValueIsStringArray_NoRefreshTtl() var listName = Utils.NewGuidString(); string[] values = new string[] { Utils.NewGuidString() }; - await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(Utils.waitForItemToBeSet); + await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.InitialRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.WaitForItemToBeSet); - await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(Utils.waitForInitialItemToExpire); + await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.WaitForInitialItemToExpire); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); Assert.True(response is CacheListFetchResponse.Miss, $"Unexpected response: {response}"); @@ -556,8 +556,8 @@ public async Task ListConcatenateBackFetch_ValueIsStringArray_RefreshTtl() var listName = Utils.NewGuidString(); string[] values = new string[] { Utils.NewGuidString() }; - await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl)).WithNoRefreshTtlOnUpdates()); - await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.InitialRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await client.ListConcatenateBackAsync(cacheName, listName, values, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); await Task.Delay(2000); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); @@ -629,11 +629,11 @@ public async Task ListPushFrontFetch_ValueIsByteArray_NoRefreshTtl() var listName = Utils.NewGuidString(); var value = Utils.NewGuidByteArray(); - await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(Utils.waitForItemToBeSet); + await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.InitialRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.WaitForItemToBeSet); - await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(Utils.waitForInitialItemToExpire); + await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.WaitForInitialItemToExpire); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); Assert.True(response is CacheListFetchResponse.Miss, $"Unexpected response: {response}"); @@ -646,7 +646,7 @@ public async Task ListPushFrontFetch_ValueIsByteArray_RefreshTtl() var value = Utils.NewGuidByteArray(); await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2)).WithNoRefreshTtlOnUpdates()); - await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); + await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl))); await Task.Delay(2000); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); @@ -716,11 +716,11 @@ public async Task ListPushFrontFetch_ValueIsString_NoRefreshTtl() var listName = Utils.NewGuidString(); var value = Utils.NewGuidString(); - await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(Utils.waitForItemToBeSet); + await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.InitialRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.WaitForItemToBeSet); - await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(Utils.waitForInitialItemToExpire); + await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.WaitForInitialItemToExpire); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); Assert.True(response is CacheListFetchResponse.Miss, $"Unexpected response: {response}"); @@ -733,7 +733,7 @@ public async Task ListPushFrontFetch_ValueIsString_RefreshTtl() var value = Utils.NewGuidString(); await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2)).WithNoRefreshTtlOnUpdates()); - await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); + await client.ListPushFrontAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl))); await Task.Delay(2000); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); @@ -802,11 +802,11 @@ public async Task ListPushBackFetch_ValueIsByteArray_NoRefreshTtl() var listName = Utils.NewGuidString(); var value = Utils.NewGuidByteArray(); - await client.ListPushBackAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(Utils.waitForItemToBeSet); + await client.ListPushBackAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.InitialRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.WaitForItemToBeSet); - await client.ListPushBackAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(Utils.waitForInitialItemToExpire); + await client.ListPushBackAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.WaitForInitialItemToExpire); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); Assert.True(response is CacheListFetchResponse.Miss, $"Unexpected response: {response}"); @@ -819,7 +819,7 @@ public async Task ListPushBackFetch_ValueIsByteArray_RefreshTtl() var value = Utils.NewGuidByteArray(); await client.ListPushBackAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2)).WithNoRefreshTtlOnUpdates()); - await client.ListPushBackAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); + await client.ListPushBackAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl))); await Task.Delay(2000); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); @@ -961,10 +961,10 @@ public async Task ListPushBackFetch_ValueIsString_NoRefreshTtl() var value = Utils.NewGuidString(); await client.ListPushBackAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(Utils.waitForItemToBeSet); + await Task.Delay(Utils.WaitForItemToBeSet); - await client.ListPushBackAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); - await Task.Delay(Utils.waitForInitialItemToExpire); + await client.ListPushBackAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + await Task.Delay(Utils.WaitForInitialItemToExpire); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); Assert.True(response is CacheListFetchResponse.Miss, $"Unexpected response: {response}"); @@ -977,7 +977,7 @@ public async Task ListPushBackFetch_ValueIsString_RefreshTtl() var value = Utils.NewGuidString(); await client.ListPushBackAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2))); - await client.ListPushBackAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); + await client.ListPushBackAsync(cacheName, listName, value, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl))); await Task.Delay(2000); CacheListFetchResponse response = await client.ListFetchAsync(cacheName, listName); diff --git a/tests/Integration/Momento.Sdk.Tests/SetTest.cs b/tests/Integration/Momento.Sdk.Tests/SetTest.cs index 3aa7f342..6a512cfe 100644 --- a/tests/Integration/Momento.Sdk.Tests/SetTest.cs +++ b/tests/Integration/Momento.Sdk.Tests/SetTest.cs @@ -47,13 +47,13 @@ public async Task SetAddFetch_ElementIsByteArray_noRefreshTtlOnUpdates() var setName = Utils.NewGuidString(); var element = Utils.NewGuidByteArray(); - CacheSetAddElementResponse response = await client.SetAddElementAsync(cacheName, setName, element, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl)).WithNoRefreshTtlOnUpdates()); + CacheSetAddElementResponse response = await client.SetAddElementAsync(cacheName, setName, element, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.InitialRefreshTtl)).WithNoRefreshTtlOnUpdates()); Assert.True(response is CacheSetAddElementResponse.Success, $"Unexpected response: {response}"); - await Task.Delay(Utils.waitForItemToBeSet); + await Task.Delay(Utils.WaitForItemToBeSet); - response = await client.SetAddElementAsync(cacheName, setName, element, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + response = await client.SetAddElementAsync(cacheName, setName, element, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); Assert.True(response is CacheSetAddElementResponse.Success, $"Unexpected response: {response}"); - await Task.Delay(Utils.waitForInitialItemToExpire); + await Task.Delay(Utils.WaitForInitialItemToExpire); CacheSetFetchResponse fetchResponse = await client.SetFetchAsync(cacheName, setName); Assert.True(fetchResponse is CacheSetFetchResponse.Miss, $"Unexpected response: {fetchResponse}"); } @@ -66,7 +66,7 @@ public async Task SetAddFetch_ElementIsByteArray_RefreshTtl() CacheSetAddElementResponse response = await client.SetAddElementAsync(cacheName, setName, element, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2)).WithNoRefreshTtlOnUpdates()); Assert.True(response is CacheSetAddElementResponse.Success, $"Unexpected response: {response}"); - await client.SetAddElementAsync(cacheName, setName, element, CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); + await client.SetAddElementAsync(cacheName, setName, element, CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl))); await Task.Delay(2000); CacheSetFetchResponse fetchResponse = await client.SetFetchAsync(cacheName, setName); @@ -108,13 +108,13 @@ public async Task SetAddFetch_ElementIsString_noRefreshTtlOnUpdates() var setName = Utils.NewGuidString(); var element = Utils.NewGuidString(); - CacheSetAddElementResponse response = await client.SetAddElementAsync(cacheName, setName, element, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl)).WithNoRefreshTtlOnUpdates()); + CacheSetAddElementResponse response = await client.SetAddElementAsync(cacheName, setName, element, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.InitialRefreshTtl)).WithNoRefreshTtlOnUpdates()); Assert.True(response is CacheSetAddElementResponse.Success, $"Unexpected response: {response}"); - await Task.Delay(Utils.waitForItemToBeSet); + await Task.Delay(Utils.WaitForItemToBeSet); - response = await client.SetAddElementAsync(cacheName, setName, element, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + response = await client.SetAddElementAsync(cacheName, setName, element, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); Assert.True(response is CacheSetAddElementResponse.Success, $"Unexpected response: {response}"); - await Task.Delay(Utils.waitForInitialItemToExpire); + await Task.Delay(Utils.WaitForInitialItemToExpire); CacheSetFetchResponse fetchResponse = await client.SetFetchAsync(cacheName, setName); Assert.True(fetchResponse is CacheSetFetchResponse.Miss, $"Unexpected response: {fetchResponse}"); @@ -128,7 +128,7 @@ public async Task SetAddFetch_ElementIsString_RefreshTtl() CacheSetAddElementResponse response = await client.SetAddElementAsync(cacheName, setName, element, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2)).WithNoRefreshTtlOnUpdates()); Assert.True(response is CacheSetAddElementResponse.Success, $"Unexpected response: {response}"); - response = await client.SetAddElementAsync(cacheName, setName, element, CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); + response = await client.SetAddElementAsync(cacheName, setName, element, CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl))); Assert.True(response is CacheSetAddElementResponse.Success, $"Unexpected response: {response}"); await Task.Delay(2000); @@ -185,13 +185,13 @@ public async Task SetAddElementsAsync_ElementsAreByteArrayEnumerable_noRefreshTt var element = Utils.NewGuidByteArray(); var content = new List() { element }; - CacheSetAddElementsResponse response = await client.SetAddElementsAsync(cacheName, setName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl)).WithNoRefreshTtlOnUpdates()); + CacheSetAddElementsResponse response = await client.SetAddElementsAsync(cacheName, setName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.InitialRefreshTtl)).WithNoRefreshTtlOnUpdates()); Assert.True(response is CacheSetAddElementsResponse.Success, $"Unexpected response: {response}"); - await Task.Delay(Utils.waitForItemToBeSet); + await Task.Delay(Utils.WaitForItemToBeSet); - response = await client.SetAddElementsAsync(cacheName, setName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + response = await client.SetAddElementsAsync(cacheName, setName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); Assert.True(response is CacheSetAddElementsResponse.Success, $"Unexpected response: {response}"); - await Task.Delay(Utils.waitForInitialItemToExpire); + await Task.Delay(Utils.WaitForInitialItemToExpire); CacheSetFetchResponse fetchResponse = await client.SetFetchAsync(cacheName, setName); Assert.True(fetchResponse is CacheSetFetchResponse.Miss, $"Unexpected response: {fetchResponse}"); @@ -206,7 +206,7 @@ public async Task SetAddElementsAsync_ElementsAreByteArrayEnumerable_RefreshTtl( CacheSetAddElementsResponse response = await client.SetAddElementsAsync(cacheName, setName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2)).WithNoRefreshTtlOnUpdates()); Assert.True(response is CacheSetAddElementsResponse.Success, $"Unexpected response: {response}"); - await client.SetAddElementsAsync(cacheName, setName, content, CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); + await client.SetAddElementsAsync(cacheName, setName, content, CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl))); await Task.Delay(2000); CacheSetFetchResponse fetchResponse = await client.SetFetchAsync(cacheName, setName); @@ -265,13 +265,13 @@ public async Task SetAddElementsAsync_ElementsAreStringEnumerable_noRefreshTtlOn var element = Utils.NewGuidString(); var content = new List() { element }; - CacheSetAddElementsResponse response = await client.SetAddElementsAsync(cacheName, setName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.initialRefreshTtl)).WithNoRefreshTtlOnUpdates()); + CacheSetAddElementsResponse response = await client.SetAddElementsAsync(cacheName, setName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.InitialRefreshTtl)).WithNoRefreshTtlOnUpdates()); Assert.True(response is CacheSetAddElementsResponse.Success, $"Unexpected response: {response}"); - await Task.Delay(Utils.waitForItemToBeSet); + await Task.Delay(Utils.WaitForItemToBeSet); - response = await client.SetAddElementsAsync(cacheName, setName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); + response = await client.SetAddElementsAsync(cacheName, setName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl)).WithNoRefreshTtlOnUpdates()); Assert.True(response is CacheSetAddElementsResponse.Success, $"Unexpected response: {response}"); - await Task.Delay(Utils.waitForInitialItemToExpire); + await Task.Delay(Utils.WaitForInitialItemToExpire); CacheSetFetchResponse fetchResponse = await client.SetFetchAsync(cacheName, setName); Assert.True(fetchResponse is CacheSetFetchResponse.Miss, $"Unexpected response: {fetchResponse}"); @@ -286,7 +286,7 @@ public async Task SetAddElementsAsync_ElementsAreStringEnumerable_RefreshTtl() CacheSetAddElementsResponse response = await client.SetAddElementsAsync(cacheName, setName, content, ttl: CollectionTtl.Of(TimeSpan.FromSeconds(2)).WithNoRefreshTtlOnUpdates()); Assert.True(response is CacheSetAddElementsResponse.Success, $"Unexpected response: {response}"); - response = await client.SetAddElementsAsync(cacheName, setName, content, CollectionTtl.Of(TimeSpan.FromSeconds(Utils.updatedRefreshTtl))); + response = await client.SetAddElementsAsync(cacheName, setName, content, CollectionTtl.Of(TimeSpan.FromSeconds(Utils.UpdatedRefreshTtl))); Assert.True(response is CacheSetAddElementsResponse.Success, $"Unexpected response: {response}"); await Task.Delay(2000); diff --git a/tests/Integration/Momento.Sdk.Tests/Utils.cs b/tests/Integration/Momento.Sdk.Tests/Utils.cs index 27eab327..66f1721b 100644 --- a/tests/Integration/Momento.Sdk.Tests/Utils.cs +++ b/tests/Integration/Momento.Sdk.Tests/Utils.cs @@ -12,11 +12,11 @@ public static class Utils public static byte[] NewGuidByteArray() => Guid.NewGuid().ToByteArray(); - public static int initialRefreshTtl = 4; + public static int InitialRefreshTtl { get; } = 4; - public static int updatedRefreshTtl = 10; + public static int UpdatedRefreshTtl { get; } = 10; - public static int waitForItemToBeSet = 100; + public static int WaitForItemToBeSet { get; } = 100; - public static int waitForInitialItemToExpire = 4900; + public static int WaitForInitialItemToExpire { get; } = 4900; } \ No newline at end of file