(t *testing.T)
| 11 | ) |
| 12 | |
| 13 | func TestDeterministicIDGenerator(t *testing.T) { |
| 14 | ts := time.Now().UnixMilli() |
| 15 | |
| 16 | gen := NewDeterministicIDGenerator(util.FakeTenantID, 0, uint64(ts)) |
| 17 | |
| 18 | firstPassIDs := make(map[backend.UUID]struct{}) |
| 19 | for seq := int64(0); seq < 10; seq++ { |
| 20 | id := gen.NewID() |
| 21 | firstPassIDs[id] = struct{}{} |
| 22 | } |
| 23 | |
| 24 | // Verify that that UUIDs are valid |
| 25 | for id := range firstPassIDs { |
| 26 | _, err := uuid.Parse(id.String()) |
| 27 | assert.NoError(t, err) |
| 28 | } |
| 29 | |
| 30 | gen = NewDeterministicIDGenerator(util.FakeTenantID, 0, uint64(ts)) |
| 31 | for seq := int64(0); seq < 10; seq++ { |
| 32 | id := gen.NewID() |
| 33 | if _, ok := firstPassIDs[id]; !ok { |
| 34 | t.Errorf("ID %s not found in first pass IDs", id) |
| 35 | } |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | func TestDeterministicIDGeneratorWithDifferentTenants(t *testing.T) { |
| 40 | ts := time.Now().UnixMilli() |
nothing calls this directly
no test coverage detected