Skip to content

Commit 06b7fd7

Browse files
committed
updated StartRewindNonFailedOrchestration test
1 parent c6ca0e4 commit 06b7fd7

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

endtoendtests/src/main/java/com/functions/RewindTest.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import com.microsoft.durabletask.azurefunctions.DurableClientContext;
1515
import com.microsoft.durabletask.azurefunctions.DurableClientInput;
1616
import com.microsoft.durabletask.azurefunctions.DurableOrchestrationTrigger;
17+
import io.grpc.StatusRuntimeException;
1718

1819
import java.time.Duration;
1920
import java.util.Optional;
@@ -99,9 +100,15 @@ public HttpResponseMessage startRewindNonFailedOrchestration(
99100
.build();
100101
}
101102

102-
// Attempt to rewind the non-failed orchestration using the client method
103-
client.rewindInstance(instanceId, "Testing rewind on non-failed orchestration");
104-
context.getLogger().info("Rewind request sent for non-failed instance: " + instanceId);
103+
// Attempt to rewind the non-failed orchestration using the client method.
104+
// This is expected to be a no-op or may throw if the sidecar rejects it,
105+
// so we catch any exception and still return the check status response.
106+
try {
107+
client.rewindInstance(instanceId, "Testing rewind on non-failed orchestration");
108+
context.getLogger().info("Rewind request sent for non-failed instance: " + instanceId);
109+
} catch (StatusRuntimeException e) {
110+
context.getLogger().info("Rewind on non-failed instance was rejected (expected): " + e.getMessage());
111+
}
105112

106113
return durableContext.createCheckStatusResponse(request, instanceId);
107114
}

0 commit comments

Comments
 (0)