Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1261,6 +1261,9 @@ type (
// underlying connection. Only the final close of all existing clients will
// close the underlying connection.
Close()

// Namespace returns the configured namespace of the Temporal client
Namespace() string
}

// NamespaceClient is the client for managing operations on the namespace.
Expand Down
3 changes: 3 additions & 0 deletions internal/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,9 @@ type (

// Close client and clean up underlying resources.
Close()

// Namespace returns the configured namespace of the Temporal client
Namespace() string
}

// ClientOptions are optional parameters for Client creation.
Expand Down
5 changes: 5 additions & 0 deletions internal/internal_workflow_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1365,6 +1365,11 @@ func (wc *WorkflowClient) Close() {
}
}

// Namespace returns the configured namespace of the Temporal client
func (wc *WorkflowClient) Namespace() string {
return wc.namespace
}

// Register a namespace with temporal server
// The errors it can throw:
// - NamespaceAlreadyExistsError
Expand Down
8 changes: 8 additions & 0 deletions internal/internal_workflow_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2478,3 +2478,11 @@ func TestUpdate(t *testing.T) {
require.NoError(t, err)
})
}

func (s *workflowClientTestSuite) TestNamespace() {
dc := NewContextAwareDataConverter(converter.GetDefaultDataConverter())
s.client = NewServiceClient(s.service, nil, ClientOptions{DataConverter: dc})
client, ok := s.client.(*WorkflowClient)
s.Require().True(ok)
s.Equal(DefaultNamespace, client.Namespace())
}
5 changes: 5 additions & 0 deletions internal/nexus_operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,11 @@ func (t *testSuiteClientForNexusOperations) UpdateWorkflowExecutionOptions(ctx c
panic("not implemented in the test environment")
}

// Namespace returns the default testing namespace, ie. "default-test-namespace"
func (t *testSuiteClientForNexusOperations) Namespace() string {
return t.env.workflowInfo.Namespace
}

var _ Client = &testSuiteClientForNexusOperations{}

// testEnvWorkflowRunForNexusOperations is a partial [WorkflowRun] implementation for the test workflow environment used
Expand Down
20 changes: 20 additions & 0 deletions mocks/Client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.