Skip to content

Commit e363750

Browse files
2 parents 1dfab11 + 4a8b746 commit e363750

File tree

22 files changed

+540
-457
lines changed

22 files changed

+540
-457
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
run: make GRPC_WEB=${{ matrix.grpc-web }} build
4646

4747
- name: Test
48-
run: make test
48+
run: make prod-test
4949

5050
build_examples:
5151
runs-on: ubuntu-latest

.github/workflows/on-push-to-main-branch.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
run: make GRPC_WEB=${{ matrix.grpc-web }} build
3333

3434
- name: Test
35-
run: make test
35+
run: make prod-test
3636

3737
generate_readme:
3838
runs-on: ubuntu-latest

Makefile

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,9 @@ TEST_LOGGER_OPTIONS := --logger "console;verbosity=detailed"
3232
ifneq (,$(findstring NT,$(OS)))
3333
BUILD_TARGETS := build-dotnet6 build-dotnet-framework
3434
TEST_TARGETS := test-dotnet6 test-dotnet-framework
35-
TEST_TARGETS_AUTH_SERVICE := test-dotnet6-auth-service test-dotnet-framework-auth-service
36-
TEST_TARGETS_CACHE_SERVICE := test-dotnet6-cache-service test-dotnet-framework-cache-service
37-
TEST_TARGETS_TOPICS_SERVICE := test-dotnet6-topics-service test-dotnet-framework-topics-service
3835
else
3936
BUILD_TARGETS := build-dotnet6
4037
TEST_TARGETS := test-dotnet6
41-
TEST_TARGETS_AUTH_SERVICE := test-dotnet6-auth-service
42-
TEST_TARGETS_CACHE_SERVICE := test-dotnet6-cache-service
43-
TEST_TARGETS_TOPICS_SERVICE := test-dotnet6-topics-service
4438
endif
4539

4640
# Enable gRPC-Web if requested
@@ -98,6 +92,16 @@ restore:
9892
test: ${TEST_TARGETS}
9993

10094

95+
## Run unit and integration tests with consistent reads (conditioned by OS)
96+
prod-test:
97+
@echo "running tests with consistent reads..."
98+
ifeq (,$(findstring NT,$(OS)))
99+
@CONSISTENT_READS=1 $(MAKE) ${TEST_TARGETS}
100+
else
101+
@set CONSISTENT_READS=1 && $(MAKE) ${TEST_TARGETS}
102+
endif
103+
104+
101105
## Run unit and integration tests on the .NET 6.0 runtime
102106
test-dotnet6:
103107
@echo "Running unit and integration tests on the .NET 6.0 runtime..."
@@ -147,11 +151,21 @@ test-dotnet-framework-auth-service:
147151

148152

149153
## Run auth service tests
150-
test-auth-service: ${TEST_TARGETS_AUTH_SERVICE}
154+
test-auth-service:
155+
ifeq (,$(findstring NT,$(OS)))
156+
@CONSISTENT_READS=1 $(MAKE) test-dotnet6-auth-service
157+
else
158+
@set CONSISTENT_READS=1 && $(MAKE) test-dotnet6-auth-service test-dotnet-framework-auth-service
159+
endif
151160

152161

153162
## Run cache service tests
154-
test-cache-service: ${TEST_TARGETS_CACHE_SERVICE}
163+
test-cache-service:
164+
ifeq (,$(findstring NT,$(OS)))
165+
@CONSISTENT_READS=1 $(MAKE) test-dotnet6-cache-service
166+
else
167+
@set CONSISTENT_READS=1 && $(MAKE) test-dotnet6-cache-service test-dotnet-framework-cache-service
168+
endif
155169

156170

157171
## Run leaderboard service tests
@@ -165,7 +179,12 @@ test-storage-service:
165179

166180

167181
## Run topics service tests
168-
test-topics-service: ${TEST_TARGETS_TOPICS_SERVICE}
182+
test-topics-service:
183+
ifeq (,$(findstring NT,$(OS)))
184+
@CONSISTENT_READS=1 $(MAKE) test-dotnet6-topics-service
185+
else
186+
@set CONSISTENT_READS=1 && $(MAKE) test-dotnet6-topics-service test-dotnet-framework-topics-service
187+
endif
169188

170189

171190
## Run example applications and snippets

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
<head>
2-
<meta name="Momento .NET Client Library Documentation" content=".NET client software development kit for Momento Cache">
2+
<meta name="Momento Client Library Documentation for .NET" content="Momento client software development kit for .NET">
33
</head>
44
<img src="https://docs.momentohq.com/img/momento-logo-forest.svg" alt="logo" width="400"/>
55

66
[![project status](https://momentohq.github.io/standards-and-practices/badges/project-status-official.svg)](https://github.com/momentohq/standards-and-practices/blob/main/docs/momento-on-github.md)
77
[![project stability](https://momentohq.github.io/standards-and-practices/badges/project-stability-stable.svg)](https://github.com/momentohq/standards-and-practices/blob/main/docs/momento-on-github.md)
88

9-
# Momento .NET Client Library
9+
# Momento Client Library for .NET
1010

1111
Momento Cache is a fast, simple, pay-as-you-go caching solution without any of the operational overhead
12-
required by traditional caching solutions. This repo contains the source code for the Momento .NET client library.
12+
required by traditional caching solutions. This repo contains the source code for the Momento client library for .NET.
1313

1414
To get started with Momento you will need a Momento Auth Token. You can get one from the [Momento Console](https://console.gomomento.com).
1515

1616
* Website: [https://www.gomomento.com/](https://www.gomomento.com/)
1717
* Momento Documentation: [https://docs.momentohq.com/](https://docs.momentohq.com/)
1818
* Getting Started: [https://docs.momentohq.com/getting-started](https://docs.momentohq.com/getting-started)
19-
* .NET SDK Documentation: [https://docs.momentohq.com/sdks/dotnet](https://docs.momentohq.com/sdks/dotnet)
19+
* Momento SDK Documentation for .NET: [https://docs.momentohq.com/sdks/dotnet](https://docs.momentohq.com/sdks/dotnet)
2020
* Discuss: [Momento Discord](https://discord.gg/3HkAKjUZGq)
2121

2222
Japanese: [日本語](README.ja.md)

examples/DocExampleApis/DocExampleApis.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Momento.Sdk" Version="1.36.1" />
11+
<PackageReference Include="Momento.Sdk" Version="1.37.0" />
1212
</ItemGroup>
1313

1414
</Project>

examples/DocExampleApis/Program.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public static async Task Example_API_Delete(CacheClient cacheClient)
142142

143143
public static async Task Example_API_SetSample(CacheClient cacheClient)
144144
{
145-
var setAddResult = await cacheClient.SetAddElementsAsync("test-cache", "test-set", new string[] {"foo", "bar", "baz"});
145+
var setAddResult = await cacheClient.SetAddElementsAsync("test-cache", "test-set", new string[] { "foo", "bar", "baz" });
146146
if (setAddResult is CacheSetAddElementsResponse.Success)
147147
{
148148
Console.WriteLine("Added elements to 'test-set' successfully");
@@ -261,28 +261,35 @@ public static async Task Example_API_TopicPublish(ITopicClient topicClient)
261261
public static async Task Example_API_TopicSubscribe(ITopicClient topicClient)
262262
{
263263
var produceCancellation = new CancellationTokenSource();
264-
produceCancellation.CancelAfter(2000);
264+
produceCancellation.CancelAfter(5_000);
265265

266266
var subscribeResponse = await topicClient.SubscribeAsync("test-cache", "test-topic");
267267
switch (subscribeResponse)
268268
{
269269
case TopicSubscribeResponse.Subscription subscription:
270-
var cancellableSubscription = subscription.WithCancellation(produceCancellation.Token);
270+
// Note: use `WithCancellation` to filter only the `TopicMessage` types
271+
var cancellableSubscription = subscription.WithCancellationForAllEvents(produceCancellation.Token);
271272

272273
await Task.Delay(1_000);
273274
await topicClient.PublishAsync("test-cache", "test-topic", "test-topic-value");
274275
await Task.Delay(1_000);
275276

276-
await foreach (var message in cancellableSubscription)
277+
await foreach (var topicEvent in cancellableSubscription)
277278
{
278-
switch (message)
279+
switch (topicEvent)
279280
{
280281
case TopicMessage.Binary:
281282
Console.WriteLine("Received unexpected binary message from topic.");
282283
break;
283284
case TopicMessage.Text text:
284285
Console.WriteLine($"Received string message from topic: {text.Value}");
285286
break;
287+
case TopicSystemEvent.Heartbeat:
288+
Console.WriteLine("Received heartbeat from topic.");
289+
break;
290+
case TopicSystemEvent.Discontinuity discontinuity:
291+
Console.WriteLine($"Received discontinuity from topic: {discontinuity}");
292+
break;
286293
case TopicMessage.Error error:
287294
throw new Exception($"An error occurred while receiving topic message: {error.ErrorCode}: {error}");
288295
default:

examples/MomentoExamples.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TopicExample", "TopicExampl
2323
EndProject
2424
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MomentoWeb", "MomentoWeb\MomentoWeb.csproj", "{DE3FDC58-9342-4B93-A4DB-C4039A235BA3}"
2525
EndProject
26+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TopicHeartbeatExample", "TopicHeartbeatExample\TopicHeartbeatExample.csproj", "{31E3111A-655E-4844-86DD-06F2B2AD9DE6}"
27+
EndProject
2628
Global
2729
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2830
Debug|Any CPU = Debug|Any CPU
@@ -73,6 +75,10 @@ Global
7375
{DE3FDC58-9342-4B93-A4DB-C4039A235BA3}.Debug|Any CPU.Build.0 = Debug|Any CPU
7476
{DE3FDC58-9342-4B93-A4DB-C4039A235BA3}.Release|Any CPU.ActiveCfg = Release|Any CPU
7577
{DE3FDC58-9342-4B93-A4DB-C4039A235BA3}.Release|Any CPU.Build.0 = Release|Any CPU
78+
{31E3111A-655E-4844-86DD-06F2B2AD9DE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
79+
{31E3111A-655E-4844-86DD-06F2B2AD9DE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
80+
{31E3111A-655E-4844-86DD-06F2B2AD9DE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
81+
{31E3111A-655E-4844-86DD-06F2B2AD9DE6}.Release|Any CPU.Build.0 = Release|Any CPU
7682
EndGlobalSection
7783
GlobalSection(SolutionProperties) = preSolution
7884
HideSolutionNode = FALSE

0 commit comments

Comments
 (0)