Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: re-enable setSample tests #548

Merged
merged 3 commits into from
Mar 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions tests/Integration/Momento.Sdk.Tests/SetTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ public async Task SetFetchAsync_UsesCachedStringSet_HappyPath()
Assert.Same(set1, set2);
}

[Theory(Skip = "SetSample is a new API, we can't enable these tests until the server changes are deployed")]
[Theory]
[InlineData(null, "my-set", 100)]
[InlineData("cache", null, 100)]
[InlineData("cache", "my-set", -1)]
Expand All @@ -589,15 +589,15 @@ public async Task SetSampleAsync_NullChecks_IsError(string cacheName, string set
Assert.Equal(MomentoErrorCode.INVALID_ARGUMENT_ERROR, ((CacheSetSampleResponse.Error)response).ErrorCode);
}

[Fact(Skip = "SetSample is a new API, we can't enable these tests until the server changes are deployed")]
[Fact]
public async Task SetSampleAsync_Missing_HappyPath()
{
var setName = Utils.NewGuidString();
CacheSetSampleResponse response = await client.SetSampleAsync(cacheName, setName, 100);
Assert.True(response is CacheSetSampleResponse.Miss, $"Unexpected response: {response}");
}

[Fact(Skip = "SetSample is a new API, we can't enable these tests until the server changes are deployed")]
[Fact]
public async Task SetSampleAsync_UsesCachedStringSet_HappyPath()
{
var setName = Utils.NewGuidString();
Expand All @@ -616,12 +616,9 @@ public async Task SetSampleAsync_UsesCachedStringSet_HappyPath()
Assert.True(allValues.SetEquals(limitGreaterThanSetSizeHitValues), $"Expected sample with with limit greater than set size to return the entire set; expected ({String.Join(", ", allValues)}), got ({String.Join(", ", limitGreaterThanSetSizeHitValues)})");

CacheSetSampleResponse limitZeroResponse = await client.SetSampleAsync(cacheName, setName, 0);
// TODO: for now the server is returning a MISS for this. We will are updating that behavior and will need to fix this
// test accordingly, but this is an edge case that we don't need to block the SDK release on so we can fix the test
// once the server behavior changes.
Assert.True(limitZeroResponse is CacheSetSampleResponse.Miss, $"Unexpected response: {limitZeroResponse}");
// var limitZeroHitValues = ((CacheSetSampleResponse.Hit)limitZeroResponse).ValueSetString;
// Assert.True(allValues.SetEquals(limitZeroHitValues), $"Expected sample with with limit zero to return the entire set; expected ({allValues}), got ({limitZeroHitValues})");
var emptySet = new HashSet<String>();
var limitZeroHitValues = ((CacheSetSampleResponse.Hit)limitZeroResponse).ValueSetString;
Assert.True(emptySet.SetEquals(limitZeroHitValues), $"Expected sample with with limit zero to return empty set; got ({limitZeroHitValues})");

for (int i = 0; i < 10; i++)
{
Expand Down
Loading