File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ public static async Task Main(string[] args)
4949 }
5050 }
5151
52- private static async Task RunDemoAsync ( TemporalClient client )
52+ public static async Task RunDemoAsync ( TemporalClient client )
5353 {
5454 // Wait for v1 worker and set as current version
5555 var workerV1Version = new WorkerDeploymentVersion ( Program . DeploymentName , "1.0" ) ;
Original file line number Diff line number Diff line change 3131 <ProjectReference Include =" ..\src\UpdateWithStartLazyInit\TemporalioSamples.UpdateWithStartLazyInit.csproj" />
3232 <ProjectReference Include =" ..\src\WorkerSpecificTaskQueues\TemporalioSamples.WorkerSpecificTaskQueues.csproj" />
3333 <ProjectReference Include =" ..\src\WorkflowUpdate\TemporalioSamples.WorkflowUpdate.csproj" />
34+ <ProjectReference Include =" ..\src\WorkerVersioning\TemporalioSamples.WorkerVersioning.csproj" />
3435 <ProjectReference Include =" ..\src\SleepForDays\TemporalioSamples.SleepForDays.csproj" />
3536 </ItemGroup >
3637
Original file line number Diff line number Diff line change 1+ namespace TemporalioSamples . Tests . WorkerVersioning ;
2+
3+ using Temporalio . Client ;
4+ using TemporalioSamples . WorkerVersioning ;
5+ using Xunit ;
6+ using Xunit . Abstractions ;
7+
8+ public class WorkerVersioningTests : WorkflowEnvironmentTestBase
9+ {
10+ public WorkerVersioningTests ( ITestOutputHelper output , WorkflowEnvironment env )
11+ : base ( output , env )
12+ {
13+ }
14+
15+ [ Fact ]
16+ public async Task WorkerVersioningSampleCanRun ( )
17+ {
18+ var temporalClient = new TemporalClient ( Client . Connection , Client . Options ) ;
19+
20+ using var cts = new CancellationTokenSource ( ) ;
21+
22+ var workerV1Task = Task . Run ( ( ) => WorkerV1 . RunAsync ( Client , cts . Token ) ) ;
23+ var workerV1_1Task = Task . Run ( ( ) => WorkerV1Dot1 . RunAsync ( Client , cts . Token ) ) ;
24+ var workerV2Task = Task . Run ( ( ) => WorkerV2 . RunAsync ( Client , cts . Token ) ) ;
25+
26+ try
27+ {
28+ await Program . RunDemoAsync ( temporalClient ) ;
29+ Assert . True ( true , "Worker versioning demo completed successfully" ) ;
30+ }
31+ finally
32+ {
33+ await cts . CancelAsync ( ) ;
34+
35+ try
36+ {
37+ await Task . WhenAll ( workerV1Task , workerV1_1Task , workerV2Task ) ;
38+ }
39+ catch ( OperationCanceledException )
40+ {
41+ }
42+ }
43+ }
44+ }
You can’t perform that action at this time.
0 commit comments