Open dakraus opened 1 year ago
Hmm, so CockroachDB allows pinging a nonexistent DB. That seems like a problem, but I'm not quite sure how to handle it since we're just using the generic postgres driver, which cockroachdb claims to be compliant with.
In case CockroachDB is used as backend and
KIND_ENDPOINT
points at a non-existing database, the PostgreSQL driver does not create the corresponding database.Steps to reproduce:
KINE_ENDPOINT
at non-existing database in file test-run-cockroachdb (e.g.KINE_ENDPOINT="postgres://root@$ip:$port/kine?sslmode=disable$extra_params"
)scripts/test
Reason: It seems that (at least in my local setup), the following code is causing this behavior:
https://github.com/k3s-io/kine/blob/aade54563c866c34e2cf6b8a58cf90e847f00d70/pkg/drivers/pgsql/pgsql.go#L133-L137
db.Ping()
in this case returnsnil
instead of an error and therefore the following type assertion fails andnil
is returned to the caller.