Skip to content

Commit

Permalink
Refactor: remove key parameter from testvar methods (#7040)
Browse files Browse the repository at this point in the history
## What changed?
<!-- Describe what has changed in this PR -->
Remove `key` parameter from `testvar` methods.

## Why?
<!-- Tell your future self why have you made these changes -->
It turn out to be confusing for people on how to use optional `key`
parameter. @bergundy got a great idea to remove this parameter and use
different instance of `tv` when more than one entity is needed.

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

## 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/`? -->
Yes, updated testing docs.

## 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 10, 2025
1 parent a862298 commit 7ac04aa
Show file tree
Hide file tree
Showing 17 changed files with 789 additions and 713 deletions.
7 changes: 7 additions & 0 deletions common/testing/testvars/any.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@
package testvars

import (
"time"

"github.com/pborman/uuid"
commonpb "go.temporal.io/api/common/v1"
failurepb "go.temporal.io/api/failure/v1"
"go.temporal.io/server/common/payload"
"go.temporal.io/server/common/payloads"
"google.golang.org/protobuf/types/known/durationpb"
)

type Any struct {
Expand Down Expand Up @@ -80,6 +83,10 @@ func (a Any) ApplicationFailure() *failurepb.Failure {
}
}

func (a Any) InfiniteTimeout() *durationpb.Duration {
return durationpb.New(10 * time.Hour)
}

func (a Any) RunID() string {
return uuid.New()
}
Loading

0 comments on commit 7ac04aa

Please sign in to comment.