Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
2 parents 551049a + aa9742e commit 376504f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/on-push-to-main-branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ jobs:
- name: Integration Test
run: dotnet test -f ${{ matrix.target-framework }} tests/Integration/Momento.Sdk.Tests

generate_readme:
runs-on: ubuntu-latest
steps:
- name: Setup repo
uses: actions/checkout@v2
with:
token: ${{ secrets.MOMENTO_MACHINE_USER_GITHUB_TOKEN }}

- name: Generate README
uses: momentohq/standards-and-practices/github-actions/generate-and-commit-oss-readme@gh-actions-v2
with:
Expand Down
10 changes: 9 additions & 1 deletion src/Momento.Sdk/CacheClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,15 @@ private ScsDataClient DataClient
public static async Task<ICacheClient> CreateAsync(IConfiguration config, ICredentialProvider authProvider, TimeSpan defaultTtl, TimeSpan eagerConnectionTimeout)
{
CacheClient cacheClient = new CacheClient(config, authProvider, defaultTtl);
await cacheClient.DataClient.EagerConnectAsync(eagerConnectionTimeout);
try
{
await cacheClient.DataClient.EagerConnectAsync(eagerConnectionTimeout);
}
catch (Exception e)
{
cacheClient.Dispose();
throw e;
}
return cacheClient;
}

Expand Down
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

0 comments on commit 376504f

Please sign in to comment.