Skip to content

Commit

Permalink
Fix testvars usage in versioning3 tests (#7066)
Browse files Browse the repository at this point in the history
## What changed?
<!-- Describe what has changed in this PR -->
Fix `testvars` usage in versioning3 tests.

## Why?
<!-- Tell your future self why have you made these changes -->
Use `testvars` as intended.

## How did you test it?
<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->
Run it.

## Potential risks
<!-- Assuming the worst case, what can be broken when deploying this
change to production? -->
No risks.

## Documentation
<!-- Have you made sure this change doesn't falsify anything currently
stated in `docs/`? If significant
new behavior is added, have you described that in `docs/`? -->
No.

## Is hotfix candidate?
<!-- Is this PR a hotfix candidate or does it require a notification to
be sent to the broader community? (Yes/No) -->
No.
  • Loading branch information
alexshtin authored Jan 15, 2025
1 parent c92c263 commit 7c03c16
Show file tree
Hide file tree
Showing 2 changed files with 142 additions and 159 deletions.
30 changes: 30 additions & 0 deletions common/testing/testvars/test_vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ import (
deploymentpb "go.temporal.io/api/deployment/v1"
enumspb "go.temporal.io/api/enums/v1"
namespacepb "go.temporal.io/api/namespace/v1"
querypb "go.temporal.io/api/query/v1"
taskqueuepb "go.temporal.io/api/taskqueue/v1"
updatepb "go.temporal.io/api/update/v1"
workflowpb "go.temporal.io/api/workflow/v1"
persistencespb "go.temporal.io/server/api/persistence/v1"
"go.temporal.io/server/common/namespace"
"go.temporal.io/server/common/primitives/timestamp"
Expand Down Expand Up @@ -253,6 +255,19 @@ func (tv *TestVars) Deployment() *deploymentpb.Deployment {
}
}

func (tv *TestVars) DeploymentTransition() *workflowpb.DeploymentTransition {
return &workflowpb.DeploymentTransition{
Deployment: tv.Deployment(),
}
}

func (tv *TestVars) VersioningOverridePinned() *workflowpb.VersioningOverride {
return &workflowpb.VersioningOverride{
Behavior: enumspb.VERSIONING_BEHAVIOR_PINNED,
Deployment: tv.Deployment(),
}
}

func (tv *TestVars) TaskQueue() *taskqueuepb.TaskQueue {
return &taskqueuepb.TaskQueue{
Name: getOrCreate(tv, "task_queue", tv.uniqueString, tv.stringNSetter),
Expand Down Expand Up @@ -350,6 +365,13 @@ func (tv *TestVars) QueryType() string {
return getOrCreate(tv, "query_type", tv.uniqueString, tv.stringNSetter)
}

func (tv *TestVars) Query() *querypb.WorkflowQuery {
return &querypb.WorkflowQuery{
QueryType: tv.QueryType(),
QueryArgs: tv.Any().Payloads(),
}
}

func (tv *TestVars) SignalName() string {
return getOrCreate(tv, "signal_name", tv.uniqueString, tv.stringNSetter)
}
Expand All @@ -358,6 +380,14 @@ func (tv *TestVars) IndexName() string {
return getOrCreate(tv, "index_name", tv.uniqueString, tv.stringNSetter)
}

func (tv *TestVars) Service() string {
return getOrCreate(tv, "service", tv.uniqueString, tv.stringNSetter)
}

func (tv *TestVars) Operation() string {
return getOrCreate(tv, "operation", tv.uniqueString, tv.stringNSetter)
}

// ----------- Generic methods ------------
func (tv *TestVars) Any() Any {
return tv.an
Expand Down
Loading

0 comments on commit 7c03c16

Please sign in to comment.