mirror of
https://github.com/coder/coder.git
synced 2026-06-03 13:08:25 +00:00
af3ff825a1
Adds columns to track package and test name to test_databases table, and populates them as databases are created using the Broker. In order to seamlessly work with existing `coder_database` databases with the old schema, the SQL that creates the table and columns is additive and idempotent, so we run it every time we initialize the Broker (once per test binary execution). We include a transaction level advisorly lock to prevent deadlocks before attempting to alter the schema. I was seeing deadlocks without this.
14 lines
242 B
Go
14 lines
242 B
Go
package dbtestutil
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestGetTestPackageName(t *testing.T) {
|
|
t.Parallel()
|
|
packageName := getTestPackageName(t)
|
|
require.Equal(t, "coderd/database/dbtestutil", packageName)
|
|
}
|