Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: use namespace.Name and namespace.ID in tests #7065

Merged
merged 4 commits into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions tests/activity_api_pause_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import (
"go.temporal.io/sdk/temporal"
"go.temporal.io/sdk/workflow"
"go.temporal.io/server/common/dynamicconfig"
"go.temporal.io/server/common/namespace"
"go.temporal.io/server/common/testing/testvars"
"go.temporal.io/server/common/util"
"go.temporal.io/server/tests/testcore"
Expand All @@ -56,7 +55,7 @@ type ActivityApiPauseClientTestSuite struct {
func (s *ActivityApiPauseClientTestSuite) SetupSuite() {
s.ClientFunctionalSuite.SetupSuite()
s.OverrideDynamicConfig(dynamicconfig.ActivityAPIsEnabled, true)
s.tv = testvars.New(s.T()).WithTaskQueue(s.TaskQueue()).WithNamespaceName(namespace.Name(s.Namespace()))
s.tv = testvars.New(s.T()).WithTaskQueue(s.TaskQueue()).WithNamespaceName(s.Namespace())
}

func (s *ActivityApiPauseClientTestSuite) SetupTest() {
Expand Down Expand Up @@ -134,7 +133,7 @@ func (s *ActivityApiPauseClientTestSuite) TestActivityPauseApi_WhileRunning() {

// pause activity
pauseRequest := &workflowservice.PauseActivityByIdRequest{
Namespace: s.Namespace(),
Namespace: s.Namespace().String(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is more inconvenient then before.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More typing, yes. More inconvenient, no.

WorkflowId: workflowRun.GetID(),
ActivityId: "activity-id",
}
Expand Down Expand Up @@ -162,7 +161,7 @@ func (s *ActivityApiPauseClientTestSuite) TestActivityPauseApi_WhileRunning() {

// unpause the activity
unpauseRequest := &workflowservice.UnpauseActivityByIdRequest{
Namespace: s.Namespace(),
Namespace: s.Namespace().String(),
WorkflowId: workflowRun.GetID(),
ActivityId: "activity-id",
Operation: &workflowservice.UnpauseActivityByIdRequest_Resume{
Expand Down Expand Up @@ -230,7 +229,7 @@ func (s *ActivityApiPauseClientTestSuite) TestActivityPauseApi_WhileWaiting() {

// pause activity
pauseRequest := &workflowservice.PauseActivityByIdRequest{
Namespace: s.Namespace(),
Namespace: s.Namespace().String(),
WorkflowId: workflowRun.GetID(),
ActivityId: "activity-id",
}
Expand All @@ -250,7 +249,7 @@ func (s *ActivityApiPauseClientTestSuite) TestActivityPauseApi_WhileWaiting() {

// unpause the activity
unpauseRequest := &workflowservice.UnpauseActivityByIdRequest{
Namespace: s.Namespace(),
Namespace: s.Namespace().String(),
WorkflowId: workflowRun.GetID(),
ActivityId: "activity-id",
Operation: &workflowservice.UnpauseActivityByIdRequest_Resume{
Expand Down Expand Up @@ -322,7 +321,7 @@ func (s *ActivityApiPauseClientTestSuite) TestActivityPauseApi_WhileRetryNoWait(

// pause activity
pauseRequest := &workflowservice.PauseActivityByIdRequest{
Namespace: s.Namespace(),
Namespace: s.Namespace().String(),
WorkflowId: workflowRun.GetID(),
ActivityId: "activity-id",
}
Expand All @@ -332,7 +331,7 @@ func (s *ActivityApiPauseClientTestSuite) TestActivityPauseApi_WhileRetryNoWait(

// unpause the activity, and set noWait flag
unpauseRequest := &workflowservice.UnpauseActivityByIdRequest{
Namespace: s.Namespace(),
Namespace: s.Namespace().String(),
WorkflowId: workflowRun.GetID(),
ActivityId: "activity-id",
Operation: &workflowservice.UnpauseActivityByIdRequest_Resume{
Expand Down Expand Up @@ -405,7 +404,7 @@ func (s *ActivityApiPauseClientTestSuite) TestActivityPauseApi_WithReset() {

// pause activity
pauseRequest := &workflowservice.PauseActivityByIdRequest{
Namespace: s.Namespace(),
Namespace: s.Namespace().String(),
WorkflowId: workflowRun.GetID(),
ActivityId: "activity-id",
}
Expand All @@ -427,7 +426,7 @@ func (s *ActivityApiPauseClientTestSuite) TestActivityPauseApi_WithReset() {

// unpause the activity with reset, and set noWait flag
unpauseRequest := &workflowservice.UnpauseActivityByIdRequest{
Namespace: s.Namespace(),
Namespace: s.Namespace().String(),
WorkflowId: workflowRun.GetID(),
ActivityId: "activity-id",
Operation: &workflowservice.UnpauseActivityByIdRequest_Reset_{
Expand Down
9 changes: 4 additions & 5 deletions tests/activity_api_reset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import (
"go.temporal.io/sdk/temporal"
"go.temporal.io/sdk/workflow"
"go.temporal.io/server/common/dynamicconfig"
"go.temporal.io/server/common/namespace"
"go.temporal.io/server/common/testing/testvars"
"go.temporal.io/server/common/util"
"go.temporal.io/server/tests/testcore"
Expand All @@ -58,7 +57,7 @@ type ActivityApiResetClientTestSuite struct {
func (s *ActivityApiResetClientTestSuite) SetupSuite() {
s.ClientFunctionalSuite.SetupSuite()
s.OverrideDynamicConfig(dynamicconfig.ActivityAPIsEnabled, true)
s.tv = testvars.New(s.T()).WithTaskQueue(s.TaskQueue()).WithNamespaceName(namespace.Name(s.Namespace()))
s.tv = testvars.New(s.T()).WithTaskQueue(s.TaskQueue()).WithNamespaceName(s.Namespace())
}

func (s *ActivityApiResetClientTestSuite) SetupTest() {
Expand Down Expand Up @@ -138,7 +137,7 @@ func (s *ActivityApiResetClientTestSuite) TestActivityResetApi_AfterRetry() {
}, 5*time.Second, 200*time.Millisecond)

resetRequest := &workflowservice.ResetActivityByIdRequest{
Namespace: s.Namespace(),
Namespace: s.Namespace().String(),
WorkflowId: workflowRun.GetID(),
ActivityId: "activity-id",
NoWait: true,
Expand Down Expand Up @@ -214,7 +213,7 @@ func (s *ActivityApiResetClientTestSuite) TestActivityResetApi_WithRunningAndNoW

activityAboutToReset.Store(true)
resetRequest := &workflowservice.ResetActivityByIdRequest{
Namespace: s.Namespace(),
Namespace: s.Namespace().String(),
WorkflowId: workflowRun.GetID(),
ActivityId: "activity-id",
NoWait: true,
Expand Down Expand Up @@ -299,7 +298,7 @@ func (s *ActivityApiResetClientTestSuite) TestActivityResetApi_InRetry() {
}, 5*time.Second, 200*time.Millisecond)

resetRequest := &workflowservice.ResetActivityByIdRequest{
Namespace: s.Namespace(),
Namespace: s.Namespace().String(),
WorkflowId: workflowRun.GetID(),
ActivityId: "activity-id",
NoWait: true,
Expand Down
9 changes: 4 additions & 5 deletions tests/activity_api_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import (
"go.temporal.io/sdk/temporal"
"go.temporal.io/sdk/workflow"
"go.temporal.io/server/common/dynamicconfig"
"go.temporal.io/server/common/namespace"
"go.temporal.io/server/common/testing/testvars"
"go.temporal.io/server/tests/testcore"
"google.golang.org/protobuf/types/known/durationpb"
Expand All @@ -56,7 +55,7 @@ type ActivityApiUpdateClientTestSuite struct {
func (s *ActivityApiUpdateClientTestSuite) SetupSuite() {
s.ClientFunctionalSuite.SetupSuite()
s.OverrideDynamicConfig(dynamicconfig.ActivityAPIsEnabled, true)
s.tv = testvars.New(s.T()).WithTaskQueue(s.TaskQueue()).WithNamespaceName(namespace.Name(s.Namespace()))
s.tv = testvars.New(s.T()).WithTaskQueue(s.TaskQueue()).WithNamespaceName(s.Namespace())
}

func (s *ActivityApiUpdateClientTestSuite) SetupTest() {
Expand Down Expand Up @@ -141,7 +140,7 @@ func (s *ActivityApiUpdateClientTestSuite) TestActivityUpdateApi_ChangeRetryInte
}, 10*time.Second, 500*time.Millisecond)

updateRequest := &workflowservice.UpdateActivityOptionsByIdRequest{
Namespace: s.Namespace(),
Namespace: s.Namespace().String(),
WorkflowId: workflowRun.GetID(),
ActivityId: "activity-id",
ActivityOptions: &activitypb.ActivityOptions{
Expand Down Expand Up @@ -219,7 +218,7 @@ func (s *ActivityApiUpdateClientTestSuite) TestActivityUpdateApi_ChangeScheduleT

// update schedule_to_close_timeout
updateRequest := &workflowservice.UpdateActivityOptionsByIdRequest{
Namespace: s.Namespace(),
Namespace: s.Namespace().String(),
WorkflowId: workflowRun.GetID(),
ActivityId: "activity-id",
ActivityOptions: &activitypb.ActivityOptions{
Expand Down Expand Up @@ -298,7 +297,7 @@ func (s *ActivityApiUpdateClientTestSuite) TestActivityUpdateApi_ChangeScheduleT
// also update retry policy interval, make it shorter
newScheduleToCloseTimeout := 10 * time.Second
updateRequest := &workflowservice.UpdateActivityOptionsByIdRequest{
Namespace: s.Namespace(),
Namespace: s.Namespace().String(),
WorkflowId: workflowRun.GetID(),
ActivityId: "activity-id",
ActivityOptions: &activitypb.ActivityOptions{
Expand Down
Loading
Loading