We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parent7fc8ead commit5ba3463Copy full SHA for 5ba3463
coderd/database/databasefake/generator.go
@@ -31,7 +31,9 @@ type Generator struct {
31
32
funcNewGenerator(t*testing.T,db database.Store)*Generator {
33
if_,ok:=db.(FakeDatabase);!ok {
34
-panic("Generator db must be a FakeDatabase")
+// This does not work for postgres databases because of foreign key
35
+// constraints
36
+t.Fatalf("Generator db must be a FakeDatabase")
37
}
38
return&Generator{
39
names:make(map[string]uuid.UUID),
@@ -58,6 +60,7 @@ func (g *Generator) PrimaryOrg(ctx context.Context) database.Organization {
58
60
59
61
62
funcpopulate[DBTypeany](ctx context.Context,g*Generator,namestring,seedDBType)DBType {
63
+g.testT.Helper()
64
ifname=="" {
65
name=g.RandomName()
66
@@ -67,7 +70,7 @@ func populate[DBType any](ctx context.Context, g *Generator, name string, seed D
67
70
})
68
71
v,ok:=out[name].(DBType)
69
72
if!ok {
-panic("developer error, type mismatch")
73
+g.testT.Fatalf("developer error, type mismatch in data generator")
74
75
returnv
76