- Notifications
You must be signed in to change notification settings - Fork928
chore: support multi-org group sync with runtime configuration#14578
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
99c97c2
bfddeb6
f2857c6
791a059
4326e9d
6d3ed2e
0803619
596e7b4
b9476ac
ee8e4e4
d5ff0f7
86c0f6f
2f03e18
ec8092d
d63727d
2a1769c
640e86e
c544a29
476be45
164aeac
986498d
290cfa5
c563b10
d2c247f
12685bd
bf0d4ed
f95128e
88b0ad9
6491f6a
bd23288
a390ec4
a0a1c53
a86ba83
0df7f28
7a802a9
611f1e3
7f28a53
41994d2
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package coderdtest | ||
import "github.com/google/uuid" | ||
// DeterministicUUIDGenerator allows "naming" uuids for unit tests. | ||
// An example of where this is useful, is when a tabled test references | ||
// a UUID that is not yet known. An alternative to this would be to | ||
// hard code some UUID strings, but these strings are not human friendly. | ||
type DeterministicUUIDGenerator struct { | ||
Named map[string]uuid.UUID | ||
} | ||
func NewDeterministicUUIDGenerator() *DeterministicUUIDGenerator { | ||
return &DeterministicUUIDGenerator{ | ||
Named: make(map[string]uuid.UUID), | ||
} | ||
} | ||
func (d *DeterministicUUIDGenerator) ID(name string) uuid.UUID { | ||
if v, ok := d.Named[name]; ok { | ||
return v | ||
} | ||
d.Named[name] = uuid.New() | ||
return d.Named[name] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package coderdtest_test | ||
import ( | ||
"testing" | ||
"github.com/stretchr/testify/require" | ||
"github.com/coder/coder/v2/coderd/coderdtest" | ||
) | ||
func TestDeterministicUUIDGenerator(t *testing.T) { | ||
t.Parallel() | ||
ids := coderdtest.NewDeterministicUUIDGenerator() | ||
require.Equal(t, ids.ID("g1"), ids.ID("g1")) | ||
require.NotEqual(t, ids.ID("g1"), ids.ID("g2")) | ||
} |
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.