@@ -312,63 +312,8 @@ await store.SetParameters(
312312 sf . Parameter . ShouldNotBeNull ( ) ;
313313 }
314314
315- public abstract Task RestartExecutionsRestartsMultipleUnownedFlows ( ) ;
316- public async Task RestartExecutionsRestartsMultipleUnownedFlows ( Task < IFunctionStore > storeTask )
317- {
318- var store = await storeTask ;
319- var storedId1 = TestStoredId . Create ( ) ;
320- var storedId2 = TestStoredId . Create ( ) ;
321- var storedId3 = TestStoredId . Create ( ) ;
322- var owner = ReplicaId . NewId ( ) ;
323-
324- // Create 3 functions without owners (postponed)
325- await store . CreateFunction (
326- storedId1 ,
327- "instance1" ,
328- Param . ToUtf8Bytes ( ) ,
329- postponeUntil : DateTime . UtcNow . Ticks ,
330- timestamp : DateTime . UtcNow . Ticks ,
331- parent : null ,
332- owner : null
333- ) ;
334- await store . CreateFunction (
335- storedId2 ,
336- "instance2" ,
337- Param . ToUtf8Bytes ( ) ,
338- postponeUntil : DateTime . UtcNow . Ticks ,
339- timestamp : DateTime . UtcNow . Ticks ,
340- parent : null ,
341- owner : null
342- ) ;
343- await store . CreateFunction (
344- storedId3 ,
345- "instance3" ,
346- Param . ToUtf8Bytes ( ) ,
347- postponeUntil : DateTime . UtcNow . Ticks ,
348- timestamp : DateTime . UtcNow . Ticks ,
349- parent : null ,
350- owner : null
351- ) ;
352-
353- // Restart all three
354- var result = await store . RestartExecutions ( [ storedId1 , storedId2 , storedId3 ] , owner ) ;
355-
356- // All three should be restarted
357- result . Count . ShouldBe ( 3 ) ;
358- result . ContainsKey ( storedId1 ) . ShouldBeTrue ( ) ;
359- result . ContainsKey ( storedId2 ) . ShouldBeTrue ( ) ;
360- result . ContainsKey ( storedId3 ) . ShouldBeTrue ( ) ;
361-
362- result [ storedId1 ] . StoredFlow . OwnerId . ShouldBe ( owner ) ;
363- result [ storedId1 ] . StoredFlow . Status . ShouldBe ( Status . Executing ) ;
364- result [ storedId2 ] . StoredFlow . OwnerId . ShouldBe ( owner ) ;
365- result [ storedId2 ] . StoredFlow . Status . ShouldBe ( Status . Executing ) ;
366- result [ storedId3 ] . StoredFlow . OwnerId . ShouldBe ( owner ) ;
367- result [ storedId3 ] . StoredFlow . Status . ShouldBe ( Status . Executing ) ;
368- }
369-
370- public abstract Task RestartExecutionsReturnsEmptyDictionaryWhenNoFlowsAreEligible ( ) ;
371- public async Task RestartExecutionsReturnsEmptyDictionaryWhenNoFlowsAreEligible ( Task < IFunctionStore > storeTask )
315+ public abstract Task RestartExecutionsWithoutMessagesReturnsEmptyDictionaryWhenNoFlowsAreEligible ( ) ;
316+ public async Task RestartExecutionsWithoutMessagesReturnsEmptyDictionaryWhenNoFlowsAreEligible ( Task < IFunctionStore > storeTask )
372317 {
373318 var store = await storeTask ;
374319 var storedId1 = TestStoredId . Create ( ) ;
@@ -397,165 +342,11 @@ await store.CreateFunction(
397342 ) ;
398343
399344 // Try to restart - should return empty dictionary
400- var result = await store . RestartExecutions ( [ storedId1 , storedId2 ] , newOwner ) ;
345+ var result = await store . RestartExecutionsWithoutMessages ( [ storedId1 , storedId2 ] , newOwner ) ;
401346
402347 result . Count . ShouldBe ( 0 ) ;
403348 }
404349
405- public abstract Task RestartExecutionsRestartsOnlyUnownedFlows ( ) ;
406- public async Task RestartExecutionsRestartsOnlyUnownedFlows ( Task < IFunctionStore > storeTask )
407- {
408- var store = await storeTask ;
409- var storedId1 = TestStoredId . Create ( ) ;
410- var storedId2 = TestStoredId . Create ( ) ;
411- var storedId3 = TestStoredId . Create ( ) ;
412- var existingOwner = ReplicaId . NewId ( ) ;
413- var newOwner = ReplicaId . NewId ( ) ;
414-
415- // Create 2 functions without owners and 1 with owner
416- await store . CreateFunction (
417- storedId1 ,
418- "instance1" ,
419- Param . ToUtf8Bytes ( ) ,
420- postponeUntil : DateTime . UtcNow . Ticks ,
421- timestamp : DateTime . UtcNow . Ticks ,
422- parent : null ,
423- owner : null
424- ) ;
425- await store . CreateFunction (
426- storedId2 ,
427- "instance2" ,
428- Param . ToUtf8Bytes ( ) ,
429- postponeUntil : null ,
430- timestamp : DateTime . UtcNow . Ticks ,
431- parent : null ,
432- owner : existingOwner
433- ) ;
434- await store . CreateFunction (
435- storedId3 ,
436- "instance3" ,
437- Param . ToUtf8Bytes ( ) ,
438- postponeUntil : DateTime . UtcNow . Ticks ,
439- timestamp : DateTime . UtcNow . Ticks ,
440- parent : null ,
441- owner : null
442- ) ;
443-
444- // Restart all three - only 1 and 3 should succeed
445- var result = await store . RestartExecutions ( [ storedId1 , storedId2 , storedId3 ] , newOwner ) ;
446-
447- result . Count . ShouldBe ( 2 ) ;
448- result . ContainsKey ( storedId1 ) . ShouldBeTrue ( ) ;
449- result . ContainsKey ( storedId2 ) . ShouldBeFalse ( ) ;
450- result . ContainsKey ( storedId3 ) . ShouldBeTrue ( ) ;
451-
452- result [ storedId1 ] . StoredFlow . OwnerId . ShouldBe ( newOwner ) ;
453- result [ storedId3 ] . StoredFlow . OwnerId . ShouldBe ( newOwner ) ;
454- }
455-
456- public abstract Task RestartExecutionsReturnsEmptyDictionaryForEmptyInput ( ) ;
457- public async Task RestartExecutionsReturnsEmptyDictionaryForEmptyInput ( Task < IFunctionStore > storeTask )
458- {
459- var store = await storeTask ;
460- var owner = ReplicaId . NewId ( ) ;
461-
462- var result = await store . RestartExecutions ( [ ] , owner ) ;
463-
464- result . Count . ShouldBe ( 0 ) ;
465- }
466-
467- public abstract Task RestartExecutionsIncludesExistingEffectsAndMessages ( ) ;
468- public async Task RestartExecutionsIncludesExistingEffectsAndMessages ( Task < IFunctionStore > storeTask )
469- {
470- var store = await storeTask ;
471- var storedId1 = TestStoredId . Create ( ) ;
472- var storedId2 = TestStoredId . Create ( ) ;
473- var owner = ReplicaId . NewId ( ) ;
474-
475- // Create effects
476- var effect1 = new StoredEffect (
477- EffectId : "effect1" . GetHashCode ( ) . ToEffectId ( ) ,
478- WorkStatus : WorkStatus . Completed ,
479- Result : "result1" . ToUtf8Bytes ( ) ,
480- StoredException : null ,
481- Alias : null
482- ) ;
483- var effect2 = new StoredEffect (
484- EffectId : "effect2" . GetHashCode ( ) . ToEffectId ( ) ,
485- WorkStatus : WorkStatus . Completed ,
486- Result : "result2" . ToUtf8Bytes ( ) ,
487- StoredException : null ,
488- Alias : null
489- ) ;
490-
491- // Create messages
492- var message1 = new StoredMessage (
493- MessageContent : "message1" . ToUtf8Bytes ( ) ,
494- MessageType : "Type1" . ToUtf8Bytes ( ) ,
495- Position : 0 ,
496- Replica : ReplicaId . Empty ,
497- IdempotencyKey : null
498- ) ;
499- var message2 = new StoredMessage (
500- MessageContent : "message2" . ToUtf8Bytes ( ) ,
501- MessageType : "Type2" . ToUtf8Bytes ( ) ,
502- Position : 1 ,
503- Replica : ReplicaId . Empty ,
504- IdempotencyKey : null
505- ) ;
506-
507- // Create 2 functions with effects and messages
508- await store . CreateFunction (
509- storedId1 ,
510- "instance1" ,
511- Param . ToUtf8Bytes ( ) ,
512- postponeUntil : DateTime . UtcNow . Ticks ,
513- timestamp : DateTime . UtcNow . Ticks ,
514- parent : null ,
515- owner : null ,
516- effects : [ effect1 ] ,
517- messages : [ message1 ]
518- ) ;
519- await store . CreateFunction (
520- storedId2 ,
521- "instance2" ,
522- Param . ToUtf8Bytes ( ) ,
523- postponeUntil : DateTime . UtcNow . Ticks ,
524- timestamp : DateTime . UtcNow . Ticks ,
525- parent : null ,
526- owner : null ,
527- effects : [ effect2 ] ,
528- messages : [ message2 ]
529- ) ;
530-
531- // Restart both
532- var result = await store . RestartExecutions ( [ storedId1 , storedId2 ] , owner ) ;
533-
534- // Verify both flows returned with their effects and messages
535- result . Count . ShouldBe ( 2 ) ;
536-
537- result . ContainsKey ( storedId1 ) . ShouldBeTrue ( ) ;
538- result . ContainsKey ( storedId2 ) . ShouldBeTrue ( ) ;
539-
540- // Verify flow 1 has correct effects and messages
541- var flow1 = result [ storedId1 ] ;
542- flow1 . Effects . Count . ShouldBe ( 1 ) ;
543- flow1 . Effects [ 0 ] . EffectId . ShouldBe ( "effect1" . GetHashCode ( ) . ToEffectId ( ) ) ;
544- flow1 . Effects [ 0 ] . Result . ShouldBe ( "result1" . ToUtf8Bytes ( ) ) ;
545- flow1 . Messages . Count . ShouldBe ( 1 ) ;
546- flow1 . Messages [ 0 ] . MessageContent . ShouldBe ( "message1" . ToUtf8Bytes ( ) ) ;
547- flow1 . Messages [ 0 ] . MessageType . ShouldBe ( "Type1" . ToUtf8Bytes ( ) ) ;
548-
549- // Verify flow 2 has correct effects and messages
550- var flow2 = result [ storedId2 ] ;
551- flow2 . Effects . Count . ShouldBe ( 1 ) ;
552- flow2 . Effects [ 0 ] . EffectId . ShouldBe ( "effect2" . GetHashCode ( ) . ToEffectId ( ) ) ;
553- flow2 . Effects [ 0 ] . Result . ShouldBe ( "result2" . ToUtf8Bytes ( ) ) ;
554- flow2 . Messages . Count . ShouldBe ( 1 ) ;
555- flow2 . Messages [ 0 ] . MessageContent . ShouldBe ( "message2" . ToUtf8Bytes ( ) ) ;
556- flow2 . Messages [ 0 ] . MessageType . ShouldBe ( "Type2" . ToUtf8Bytes ( ) ) ;
557- }
558-
559350 public abstract Task RestartExecutionsWithoutMessagesRestartsMultipleUnownedFlows ( ) ;
560351 public async Task RestartExecutionsWithoutMessagesRestartsMultipleUnownedFlows ( Task < IFunctionStore > storeTask )
561352 {
0 commit comments