fix postgres constraints, add postgres testing
This commit fixes the constraint syntax so it is both valid for sqlite and postgres. To validate this, I've added a new postgres testing library and a helper that will spin up local postgres, setup a db and use it in the constraints tests. This should also help testing db stuff in the future. postgres has been added to the nix dev shell and is now required for running the unit tests. Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
parent
7d9b430ec2
commit
f6276ab9d2
7 changed files with 95 additions and 21 deletions
|
@ -558,7 +558,7 @@ func TestAutoApproveRoutes(t *testing.T) {
|
|||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
adb, err := newTestDB()
|
||||
adb, err := newSQLiteTestDB()
|
||||
require.NoError(t, err)
|
||||
pol, err := policy.LoadACLPolicyFromBytes([]byte(tt.acl))
|
||||
|
||||
|
@ -692,7 +692,7 @@ func generateRandomNumber(t *testing.T, max int64) int64 {
|
|||
}
|
||||
|
||||
func TestListEphemeralNodes(t *testing.T) {
|
||||
db, err := newTestDB()
|
||||
db, err := newSQLiteTestDB()
|
||||
if err != nil {
|
||||
t.Fatalf("creating db: %s", err)
|
||||
}
|
||||
|
@ -748,7 +748,7 @@ func TestListEphemeralNodes(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestRenameNode(t *testing.T) {
|
||||
db, err := newTestDB()
|
||||
db, err := newSQLiteTestDB()
|
||||
if err != nil {
|
||||
t.Fatalf("creating db: %s", err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue