Skip to content

Commit 4acf674

Browse files
Update test server to v1.4.0 (#2587)
Update test server to v1.4.0
1 parent d75b253 commit 4acf674

File tree

3 files changed

+32
-23
lines changed

3 files changed

+32
-23
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272

7373
- name: Start containerized server and dependencies
7474
env:
75-
TEMPORAL_CLI_VERSION: 1.3.1-nexus-links.0
75+
TEMPORAL_CLI_VERSION: 1.4.0
7676
run: |
7777
wget -O temporal_cli.tar.gz https://github.com/temporalio/cli/releases/download/v${TEMPORAL_CLI_VERSION}/temporal_cli_${TEMPORAL_CLI_VERSION}_linux_amd64.tar.gz
7878
tar -xzf temporal_cli.tar.gz

temporal-sdk/src/test/java/io/temporal/worker/WorkerVersioningTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package io.temporal.worker;
22

3+
import static io.temporal.api.enums.v1.VersioningBehavior.VERSIONING_BEHAVIOR_PINNED;
4+
import static io.temporal.api.workflow.v1.VersioningOverride.PinnedOverrideBehavior.PINNED_OVERRIDE_BEHAVIOR_PINNED;
35
import static org.junit.Assume.assumeTrue;
46

57
import com.google.protobuf.ByteString;
@@ -273,8 +275,7 @@ public void testDynamicWorkflow() {
273275
e ->
274276
e.getEventType() == EventType.EVENT_TYPE_WORKFLOW_TASK_COMPLETED
275277
&& e.getWorkflowTaskCompletedEventAttributes().getVersioningBehavior()
276-
== io.temporal.api.enums.v1.VersioningBehavior
277-
.VERSIONING_BEHAVIOR_PINNED));
278+
== VERSIONING_BEHAVIOR_PINNED));
278279
}
279280

280281
public static class TestWorkerVersioningMissingAnnotation extends QueueLoop
@@ -353,8 +354,7 @@ public void testWorkflowsCanUseDefaultVersioningBehaviorWhenSpecified() {
353354
e ->
354355
e.getEventType() == EventType.EVENT_TYPE_WORKFLOW_TASK_COMPLETED
355356
&& e.getWorkflowTaskCompletedEventAttributes().getVersioningBehavior()
356-
== io.temporal.api.enums.v1.VersioningBehavior
357-
.VERSIONING_BEHAVIOR_PINNED));
357+
== VERSIONING_BEHAVIOR_PINNED));
358358
}
359359

360360
@WorkflowInterface
@@ -426,9 +426,9 @@ public void testWorkflowsCanUseVersioningOverride() {
426426
e.getEventType() == EventType.EVENT_TYPE_WORKFLOW_EXECUTION_STARTED
427427
&& e.getWorkflowExecutionStartedEventAttributes()
428428
.getVersioningOverride()
429+
.getPinned()
429430
.getBehavior()
430-
== io.temporal.api.enums.v1.VersioningBehavior
431-
.VERSIONING_BEHAVIOR_PINNED));
431+
== PINNED_OVERRIDE_BEHAVIOR_PINNED));
432432
}
433433

434434
@SuppressWarnings("deprecation")

temporal-test-server/src/test/java/io/temporal/testserver/functional/DescribeWorkflowExecutionTest.java

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public void testSuccessfulActivity() throws InterruptedException {
143143
PendingActivityInfo actual = asserter.getActual().getPendingActivities(0);
144144

145145
// No fancy asserter type for PendingActivityInfo... we just build the expected proto
146-
PendingActivityInfo expected =
146+
PendingActivityInfo.Builder expected =
147147
PendingActivityInfo.newBuilder()
148148
.setActivityId(actual.getActivityId())
149149
.setActivityType(ActivityType.newBuilder().setName("TestDescribeActivity").build())
@@ -160,10 +160,13 @@ public void testSuccessfulActivity() throws InterruptedException {
160160
// going to run against the real server.
161161
.setScheduledTime(actual.getScheduledTime())
162162
.setLastStartedTime(actual.getLastStartedTime())
163-
.setExpirationTime(actual.getExpirationTime())
164-
.build();
163+
.setExpirationTime(actual.getExpirationTime());
165164

166-
Assert.assertEquals("PendingActivityInfo should match before", expected, actual);
165+
if (actual.hasActivityOptions()) {
166+
// If the activity options are present, we can assert them
167+
expected.setActivityOptions(actual.getActivityOptions());
168+
}
169+
Assert.assertEquals("PendingActivityInfo should match before", expected.build(), actual);
167170

168171
// Make the activity heartbeat - this should show in the next describe call
169172
ThreadUtils.waitForWorkflow(token + "-heartbeat");
@@ -181,11 +184,11 @@ public void testSuccessfulActivity() throws InterruptedException {
181184

182185
// Now, our PendingActivityInfo has heartbeat data, but is otherwise unchanged
183186
expected =
184-
expected.toBuilder()
187+
expected
185188
.setHeartbeatDetails(DescribeWorkflowAsserter.stringsToPayloads("heartbeatDetails"))
186-
.setLastHeartbeatTime(actual.getLastHeartbeatTime())
187-
.build();
188-
Assert.assertEquals("PendingActivityInfo should match after heartbeat", expected, actual);
189+
.setLastHeartbeatTime(actual.getLastHeartbeatTime());
190+
Assert.assertEquals(
191+
"PendingActivityInfo should match after heartbeat", expected.build(), actual);
189192

190193
// Let the activity finish, which will let the workflow finish.
191194
ThreadUtils.waitForWorkflow(token + "-finish");
@@ -241,7 +244,7 @@ public void testFailedActivity() throws InterruptedException {
241244
"Activity was asked to fail on attempt 1",
242245
actual.getLastFailure().getMessage());
243246

244-
PendingActivityInfo expected =
247+
PendingActivityInfo.Builder expected =
245248
PendingActivityInfo.newBuilder()
246249
.setActivityId(actual.getActivityId())
247250
.setActivityType(ActivityType.newBuilder().setName("TestDescribeActivity").build())
@@ -258,10 +261,13 @@ public void testFailedActivity() throws InterruptedException {
258261
// it.
259262
.setLastWorkerIdentity(actual.getLastWorkerIdentity())
260263
// We don't deeply assert the failure structure since we asserted the message above
261-
.setLastFailure(actual.getLastFailure())
262-
.build();
264+
.setLastFailure(actual.getLastFailure());
265+
if (actual.hasActivityOptions()) {
266+
// If the activity options are present, we can assert them
267+
expected.setActivityOptions(actual.getActivityOptions());
268+
}
263269

264-
Assert.assertEquals("PendingActivityInfo should match", expected, actual);
270+
Assert.assertEquals("PendingActivityInfo should match", expected.build(), actual);
265271

266272
// Now let the workflow succeed
267273
ThreadUtils.waitForWorkflow(token + "-finish");
@@ -311,7 +317,7 @@ private void testKilledWorkflow(
311317

312318
PendingActivityInfo actual = asserter.getActual().getPendingActivities(0);
313319

314-
PendingActivityInfo expected =
320+
PendingActivityInfo.Builder expected =
315321
PendingActivityInfo.newBuilder()
316322
.setActivityId(actual.getActivityId())
317323
.setActivityType(ActivityType.newBuilder().setName("TestDescribeActivity").build())
@@ -325,10 +331,13 @@ private void testKilledWorkflow(
325331
.setExpirationTime(actual.getExpirationTime())
326332
// this ends up being a dummy value, but if it weren't, we still wouldn't expect to know
327333
// it.
328-
.setLastWorkerIdentity(actual.getLastWorkerIdentity())
329-
.build();
334+
.setLastWorkerIdentity(actual.getLastWorkerIdentity());
335+
if (actual.hasActivityOptions()) {
336+
// If the activity options are present, we can assert them
337+
expected.setActivityOptions(actual.getActivityOptions());
338+
}
330339

331-
Assert.assertEquals("PendingActivityInfo should match", expected, actual);
340+
Assert.assertEquals("PendingActivityInfo should match", expected.build(), actual);
332341
}
333342

334343
@Test

0 commit comments

Comments
 (0)