diff --git a/.github/workflows/on-push-to-main-branch.yaml b/.github/workflows/on-push-to-main-branch.yaml index bca2453b..01586c0d 100644 --- a/.github/workflows/on-push-to-main-branch.yaml +++ b/.github/workflows/on-push-to-main-branch.yaml @@ -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: diff --git a/src/Momento.Sdk/CacheClient.cs b/src/Momento.Sdk/CacheClient.cs index a47a9e03..ce448de5 100644 --- a/src/Momento.Sdk/CacheClient.cs +++ b/src/Momento.Sdk/CacheClient.cs @@ -51,7 +51,15 @@ private ScsDataClient DataClient public static async Task 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; } diff --git a/tests/Integration/Momento.Sdk.Tests/SetTest.cs b/tests/Integration/Momento.Sdk.Tests/SetTest.cs index 18741586..a8b05a8f 100644 --- a/tests/Integration/Momento.Sdk.Tests/SetTest.cs +++ b/tests/Integration/Momento.Sdk.Tests/SetTest.cs @@ -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)] @@ -589,7 +589,7 @@ 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(); @@ -597,7 +597,7 @@ public async Task SetSampleAsync_Missing_HappyPath() 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(); @@ -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(); + 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++) {