Skip to content

Commit 02bb1ad

Browse files
Fix race condition in test server SA (#1905)
Fix race condition in test server SA and register TemporalChangeVersion by default.
1 parent 111d8ce commit 02bb1ad

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

temporal-sdk/src/test/java/io/temporal/workflow/searchattributes/TypedSearchAttributesTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public class TypedSearchAttributesTest {
6767
.set(SearchAttributeKey.forDouble("CustomDoubleField"), 1.23)
6868
.set(SearchAttributeKey.forBoolean("CustomBoolField"), true)
6969
.set(SearchAttributeKey.forOffsetDateTime("CustomDatetimeField"), OffsetDateTime.now())
70+
.set(SearchAttributeKey.forKeywordList("TemporalChangeVersion"), Arrays.asList("version"))
7071
.build();
7172

7273
@Rule

temporal-test-server/src/main/java/io/temporal/internal/testservice/TestVisibilityStoreImpl.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import io.temporal.internal.common.ProtoEnumNameUtils;
2929
import io.temporal.internal.common.SearchAttributesUtil;
3030
import java.util.Collections;
31-
import java.util.HashMap;
3231
import java.util.Map;
3332
import java.util.concurrent.ConcurrentHashMap;
3433
import javax.annotation.Nonnull;
@@ -42,6 +41,7 @@ class TestVisibilityStoreImpl implements TestVisibilityStore {
4241
private static final String DEFAULT_KEY_DATE_TIME = "CustomDatetimeField";
4342
private static final String DEFAULT_KEY_DOUBLE = "CustomDoubleField";
4443
private static final String DEFAULT_KEY_BOOL = "CustomBoolField";
44+
private static final String TEMPORAL_CHANGE_VERSION = "TemporalChangeVersion";
4545

4646
private final Map<String, IndexedValueType> searchAttributes =
4747
new ConcurrentHashMap<>(
@@ -53,9 +53,11 @@ class TestVisibilityStoreImpl implements TestVisibilityStore {
5353
.put(DEFAULT_KEY_DOUBLE, IndexedValueType.INDEXED_VALUE_TYPE_DOUBLE)
5454
.put(DEFAULT_KEY_BOOL, IndexedValueType.INDEXED_VALUE_TYPE_BOOL)
5555
.put(DEFAULT_KEY_DATE_TIME, IndexedValueType.INDEXED_VALUE_TYPE_DATETIME)
56+
.put(TEMPORAL_CHANGE_VERSION, IndexedValueType.INDEXED_VALUE_TYPE_KEYWORD_LIST)
5657
.build());
5758

58-
private final Map<ExecutionId, SearchAttributes> executionSearchAttributes = new HashMap<>();
59+
private final Map<ExecutionId, SearchAttributes> executionSearchAttributes =
60+
new ConcurrentHashMap<>();
5961

6062
@Override
6163
public void addSearchAttribute(String name, IndexedValueType type) {

0 commit comments

Comments
 (0)