Atlas › Test

EmptyNamespace

Exact test identity: go.temporal.io/server/common/links/TestValidate/WorkflowEvent/EmptyNamespace

Package
go.temporal.io/server/common/links
Suite / test hierarchy
TestValidate/WorkflowEvent/EmptyNamespace
Test
EmptyNamespace
Introduced at
validator.go ×1 Frontier kind: Joint frontier
Covered ranges
6
Covered lines
9
Covered files
1

Covered source

Expand a file to inspect source; the > gutter marks covered lines.

go.temporal.io/server/common/links/validator.go 9 covered LOC · 6 ranges

Open complete file

12 // populated.
13 // nolint:revive // cognitive-complexity is high but justified to keep each case together for readability.
14 > func Validate(links []*commonpb.Link, maxAllowedLinks, maxSize int) error { validator.go
15 > if len(links) > maxAllowedLinks {
16 return serviceerror.NewInvalidArgumentf("cannot attach more than %d links per request, got %d", maxAllowedLinks, len(links))
17 }
18 > for _, l := range links { validator.go
19 > if l.Size() > maxSize { validator.go
20 return serviceerror.NewInvalidArgumentf("link exceeds allowed size of %d, got %d", maxSize, l.Size())
21 }
22 > switch t := l.Variant.(type) { validator.go
23 > case *commonpb.Link_WorkflowEvent_: validator.go
24 > if t.WorkflowEvent.GetNamespace() == "" {
25 > return serviceerror.NewInvalidArgument("workflow event link must not have an empty namespace field") validator.go
26 > }
27 if t.WorkflowEvent.GetWorkflowId() == "" {
28 return serviceerror.NewInvalidArgument("workflow event link must not have an empty workflow ID field")