k3s-io / kine

Run Kubernetes on MySQL, Postgres, sqlite, dqlite, not etcd.
Apache License 2.0
1.5k stars 228 forks source link

Bugfix? create pgql database if not exists #241

Closed oz123 closed 8 months ago

oz123 commented 8 months ago

With the current master branch code (commit afb2121bb0d8c2e079f90f7d3a1b1a2c3338bfa1) I see the following error:

root@vm2:/home/vagrant# kine --debug --endpoint postgres://postgres:postgresql@localhost:5432/foobster INFO[2023-11-03T20:07:09.379099258Z] metrics server is starting to listen at :8080 INFO[2023-11-03T20:07:09.379709686Z] starting metrics server path /metrics FATA[2023-11-03T20:07:09.40247106Z] building kine: failed to connect to host=localhost user=postgres database=foobster: server error (FATAL: database "foobster" does not exist (SQLSTATE 3D000))

This is fixed with the current commit.

brandond commented 8 months ago

Can you rebase your changes? It appears that you are missing some changes to the tests and this is causing CI to fail.

I suspect that this was broken by https://github.com/k3s-io/kine/pull/179 - we should add or modify the tests so that they also exercise the database creation code. I believe they all currently use the default database.

oz123 commented 8 months ago

@brandond thanks for reviewing my PR so quickly. I rebased the patch against the current master. :crossed_fingers: that the tests work now.