chore: avoid dbmock test errors in dbgen (#10923)

This commit is contained in:
Dean Sheather 2023-11-29 03:04:25 +10:00 committed by GitHub
parent 14bd489af6
commit 452668c893
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 3 deletions

View File

@ -58,6 +58,7 @@ SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}")
go run golang.org/x/tools/cmd/goimports@latest -w queries.sql.go go run golang.org/x/tools/cmd/goimports@latest -w queries.sql.go
go run ../../scripts/dbgen go run ../../scripts/dbgen
# This will error if a view is broken. # This will error if a view is broken. This is in it's own package to avoid
go test -run=TestViewSubset # stuff like dbmock breaking builds if it's out of date from the interface.
go test ./gentest
) )

View File

@ -0,0 +1,8 @@
// Package gentest contains tests that are run at db generate time. These tests
// need to exist in their own package to avoid importing stuff that gets
// generated after the DB.
//
// E.g. if we put these tests in coderd/database, then we'd be importing dbmock
// which is generated after the DB and can cause type problems when building
// the tests.
package gentest

View File

@ -1,4 +1,4 @@
package database_test package gentest_test
import ( import (
"reflect" "reflect"