Skip to content

Commit

Permalink
Sync DeduplicationTest with Harness repo
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk committed Jan 20, 2025
1 parent fffcc39 commit 07324fc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function updateHandlersWithOneCall(
$resolver = $stub->startUpdate('resolve', "key", "resolved");

// Should be completed after the previous operation
$result = $stub->getResult(timeout: 1);
$result = $stub->getResult();

$this->assertSame(['key' => 'resolved'], (array) $result, 'Workflow result contains resolved value');
$this->assertFalse($handle->hasResult());
Expand Down
12 changes: 3 additions & 9 deletions tests/Acceptance/Harness/Update/DeduplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Temporal\Client\Update\UpdateOptions;
use Temporal\Client\WorkflowClientInterface;
use Temporal\Client\WorkflowStubInterface;
use Temporal\Exception\Client\WorkflowUpdateException;
use Temporal\Tests\Acceptance\App\Attribute\Stub;
use Temporal\Tests\Acceptance\App\TestCase;
use Temporal\Workflow;
Expand Down Expand Up @@ -40,13 +39,8 @@ public function check(
self::assertSame(1, $handle1->getResult(1));
self::assertSame(1, $handle2->getResult(1));

try {
# This only needs to start to unblock the workflow
$stub->startUpdate('my_update');
} catch (WorkflowUpdateException) {
# Workflow Update failed because the Workflow completed before the Update completed
# It's OK in this case
}
# This only needs to start to unblock the workflow
$stub->startUpdate('my_update');

# There should be two accepted updates, and only one of them should be completed with the set id
$totalUpdates = 0;
Expand All @@ -70,7 +64,7 @@ class FeatureWorkflow
#[WorkflowMethod('Harness_Update_Deduplication')]
public function run()
{
yield Workflow::await(fn(): bool => $this->counter >= 2);
yield Workflow::await(fn(): bool => $this->counter >= 2 && Workflow::allHandlersFinished());
return $this->counter;
}

Expand Down

0 comments on commit 07324fc

Please sign in to comment.