fix(tests): use getMonoTime().ticks for unique temp dirs to avoid CI collisions
This commit is contained in:
@@ -2,6 +2,7 @@ import std/unittest
|
|||||||
import std/os
|
import std/os
|
||||||
import std/strutils
|
import std/strutils
|
||||||
import std/times
|
import std/times
|
||||||
|
import std/monotimes
|
||||||
import barabadb/core/types
|
import barabadb/core/types
|
||||||
import barabadb/query/executor as qexec
|
import barabadb/query/executor as qexec
|
||||||
import barabadb/query/parser
|
import barabadb/query/parser
|
||||||
@@ -18,7 +19,7 @@ suite "JOIN execution":
|
|||||||
var testDir: string
|
var testDir: string
|
||||||
|
|
||||||
setup:
|
setup:
|
||||||
testDir = getTempDir() / "baradb_join_test_" & $getCurrentProcessId() & "_" & $getTime().toUnix()
|
testDir = getTempDir() / "baradb_join_test_" & $getCurrentProcessId() & "_" & $getMonoTime().ticks
|
||||||
createDir(testDir)
|
createDir(testDir)
|
||||||
db = newLSMTree(testDir)
|
db = newLSMTree(testDir)
|
||||||
ctx = qexec.newExecutionContext(db)
|
ctx = qexec.newExecutionContext(db)
|
||||||
|
|||||||
+8
-7
@@ -6,6 +6,7 @@ import std/os
|
|||||||
import std/asyncdispatch
|
import std/asyncdispatch
|
||||||
import std/times
|
import std/times
|
||||||
import std/random
|
import std/random
|
||||||
|
import std/monotimes
|
||||||
|
|
||||||
import barabadb/core/types
|
import barabadb/core/types
|
||||||
import barabadb/core/mvcc
|
import barabadb/core/mvcc
|
||||||
@@ -2109,7 +2110,7 @@ suite "Row-Level Security":
|
|||||||
check ast.stmts[0].drlsTable == "accounts"
|
check ast.stmts[0].drlsTable == "accounts"
|
||||||
|
|
||||||
test "RLS filter on SELECT":
|
test "RLS filter on SELECT":
|
||||||
var testDir = getTempDir() / "baradb_rls_test_" & $getCurrentProcessId() & "_" & $getTime().toUnix() & "_" & $(rand(100000))
|
var testDir = getTempDir() / "baradb_rls_test_" & $getCurrentProcessId() & "_" & $getMonoTime().ticks
|
||||||
createDir(testDir)
|
createDir(testDir)
|
||||||
var db = newLSMTree(testDir)
|
var db = newLSMTree(testDir)
|
||||||
var ctx = qexec.newExecutionContext(db)
|
var ctx = qexec.newExecutionContext(db)
|
||||||
@@ -2133,7 +2134,7 @@ suite "Row-Level Security":
|
|||||||
check res.rows[0]["owner"] == "alice"
|
check res.rows[0]["owner"] == "alice"
|
||||||
|
|
||||||
test "RLS superuser bypass":
|
test "RLS superuser bypass":
|
||||||
var testDir = getTempDir() / "baradb_rls_test_" & $getCurrentProcessId() & "_" & $getTime().toUnix() & "_" & $(rand(100000))
|
var testDir = getTempDir() / "baradb_rls_test_" & $getCurrentProcessId() & "_" & $getMonoTime().ticks
|
||||||
createDir(testDir)
|
createDir(testDir)
|
||||||
var db = newLSMTree(testDir)
|
var db = newLSMTree(testDir)
|
||||||
var ctx = qexec.newExecutionContext(db)
|
var ctx = qexec.newExecutionContext(db)
|
||||||
@@ -2248,7 +2249,7 @@ suite "Enhanced Migrations":
|
|||||||
check ast.stmts[0].mdrName == "add_users"
|
check ast.stmts[0].mdrName == "add_users"
|
||||||
|
|
||||||
test "Create and apply migration with checksum":
|
test "Create and apply migration with checksum":
|
||||||
var testDir = getTempDir() / "baradb_migration_test_" & $getCurrentProcessId() & "_" & $getTime().toUnix() & "_" & $(rand(100000))
|
var testDir = getTempDir() / "baradb_migration_test_" & $getCurrentProcessId() & "_" & $getMonoTime().ticks
|
||||||
createDir(testDir)
|
createDir(testDir)
|
||||||
var db = newLSMTree(testDir)
|
var db = newLSMTree(testDir)
|
||||||
var ctx = qexec.newExecutionContext(db)
|
var ctx = qexec.newExecutionContext(db)
|
||||||
@@ -2269,7 +2270,7 @@ suite "Enhanced Migrations":
|
|||||||
check reapplyRes.message.contains("already applied")
|
check reapplyRes.message.contains("already applied")
|
||||||
|
|
||||||
test "Migration STATUS shows applied migrations":
|
test "Migration STATUS shows applied migrations":
|
||||||
var testDir = getTempDir() / "baradb_migration_test_" & $getCurrentProcessId() & "_" & $getTime().toUnix() & "_" & $(rand(100000))
|
var testDir = getTempDir() / "baradb_migration_test_" & $getCurrentProcessId() & "_" & $getMonoTime().ticks
|
||||||
createDir(testDir)
|
createDir(testDir)
|
||||||
var db = newLSMTree(testDir)
|
var db = newLSMTree(testDir)
|
||||||
var ctx = qexec.newExecutionContext(db)
|
var ctx = qexec.newExecutionContext(db)
|
||||||
@@ -2283,7 +2284,7 @@ suite "Enhanced Migrations":
|
|||||||
check statusRes.rows[1]["status"] == "pending"
|
check statusRes.rows[1]["status"] == "pending"
|
||||||
|
|
||||||
test "Migration UP applies all pending":
|
test "Migration UP applies all pending":
|
||||||
var testDir = getTempDir() / "baradb_migration_test_" & $getCurrentProcessId() & "_" & $getTime().toUnix() & "_" & $(rand(100000))
|
var testDir = getTempDir() / "baradb_migration_test_" & $getCurrentProcessId() & "_" & $getMonoTime().ticks
|
||||||
createDir(testDir)
|
createDir(testDir)
|
||||||
var db = newLSMTree(testDir)
|
var db = newLSMTree(testDir)
|
||||||
var ctx = qexec.newExecutionContext(db)
|
var ctx = qexec.newExecutionContext(db)
|
||||||
@@ -2294,7 +2295,7 @@ suite "Enhanced Migrations":
|
|||||||
check upRes.message.contains("Applied 2 migrations")
|
check upRes.message.contains("Applied 2 migrations")
|
||||||
|
|
||||||
test "Migration DOWN rollback":
|
test "Migration DOWN rollback":
|
||||||
var testDir = getTempDir() / "baradb_migration_test_" & $getCurrentProcessId() & "_" & $getTime().toUnix() & "_" & $(rand(100000))
|
var testDir = getTempDir() / "baradb_migration_test_" & $getCurrentProcessId() & "_" & $getMonoTime().ticks
|
||||||
createDir(testDir)
|
createDir(testDir)
|
||||||
var db = newLSMTree(testDir)
|
var db = newLSMTree(testDir)
|
||||||
var ctx = qexec.newExecutionContext(db)
|
var ctx = qexec.newExecutionContext(db)
|
||||||
@@ -2309,7 +2310,7 @@ suite "Enhanced Migrations":
|
|||||||
check tableRes.rows.len == 0 # table does not exist
|
check tableRes.rows.len == 0 # table does not exist
|
||||||
|
|
||||||
test "Migration DRYRUN":
|
test "Migration DRYRUN":
|
||||||
var testDir = getTempDir() / "baradb_migration_test_" & $getCurrentProcessId() & "_" & $getTime().toUnix() & "_" & $(rand(100000))
|
var testDir = getTempDir() / "baradb_migration_test_" & $getCurrentProcessId() & "_" & $getMonoTime().ticks
|
||||||
createDir(testDir)
|
createDir(testDir)
|
||||||
var db = newLSMTree(testDir)
|
var db = newLSMTree(testDir)
|
||||||
var ctx = qexec.newExecutionContext(db)
|
var ctx = qexec.newExecutionContext(db)
|
||||||
|
|||||||
Reference in New Issue
Block a user