Atlas › Test

TestGenerateDeduplicationKey

Exact test identity: go.temporal.io/server/common/definition/TestResourceDeduplicationSuite/TestGenerateDeduplicationKey

Package
go.temporal.io/server/common/definition
Suite / test hierarchy
TestResourceDeduplicationSuite/TestGenerateDeduplicationKey
Test
TestGenerateDeduplicationKey
Introduced at
resource_dedup.go ×1 Frontier kind: Joint frontier
Covered ranges
4
Covered lines
23
Covered files
1

Covered source

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

go.temporal.io/server/common/definition/resource_dedup.go 23 covered LOC · 4 ranges

Open complete file

35 eventID int64,
36 version int64,
37 > ) EventReappliedID { resource_dedup.go
38 >
39 > newID := fmt.Sprintf(
40 > eventReappliedIDTemplate,
41 > runID,
42 > eventID,
43 > version,
44 > )
45 > return EventReappliedID{
46 > id: newID,
47 > }
48 > }
49
50 // GetID returns id of EventReappliedID
51 > func (e EventReappliedID) GetID() string { resource_dedup.go
52 > return e.id
53 > }
54
55 // GenerateDeduplicationKey generates deduplication key
56 func GenerateDeduplicationKey(
57 resource DeduplicationID,
58 > ) string { resource_dedup.go
59 >
60 > switch resource.(type) {
61 > case EventReappliedID:
62 > return generateKey(eventReappliedID, resource.GetID())
63 default:
64 panic("unsupported deduplication key")
66 }
67
68 > func generateKey(resourceType int32, id string) string { resource_dedup.go
69 > return fmt.Sprintf(resourceIDTemplate, resourceType, id)
70 > }