Closed akarki15 closed 8 years ago
How did you get extra tables in the test database?
i didn't add table to the test database. statements.PG_OBJECTS
returns tables from all databases
PG_OBJECTS statement only returns objects from the current database. Also, if you look at client tests, it drops and then recreates the database on every run so you should not have any extra tables in your database. Would need more info on your setup since i cant reproduce your issue.
You should not have any tables while running make test
since it will drop and recreate the database on every run, see https://github.com/sosedoff/pgweb/blob/master/pkg/client/client_test.go#L332
Closing for now since its an edge case and has something to do with your local setup. I tried to reproduce with no luck.
sorry for replying late @sosedoff. i found out that for some reason whenever i create a new pg database, it was automatically creating a table named "person". i think there is some default schema being applied to every new table and that was polluting the test db. since this is an issue very specific to my machine setup, im going to close the pull request as well. thanks for getting back though!
@akarki15 check the template1
database.
https://www.postgresql.org/docs/current/static/sql-createdatabase.html
holy shit that was it. thanks a lot @cbandy!
i am running
make test
on master and it is failing because the expected tables returned bystatements.PG_OBJECTS
does not exactly match the tables that the running postgres has.statements.PG_OBJECTS
returns tables from all databases, not just the one that theclient.TestAll()
creates. however, the test at line 203 asserts equality- which fails as the following output demonstrateslets change the
assert.Equal
in line 208 to something that checks asserts thatobjects["public"].Tables
contains all the expected tables. something like :