x/pkgsite: test databases don't override LC_COLLATE and LC_CTYPE #40347
Labels
Milestone
Comments
/cc @julieqiu |
Thanks, @akolar! Fixing |
Change https://golang.org/cl/244517 mentions this issue: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is the URL of the page with the issue?
n/a
What is your user agent?
n/a
Screenshot
n/a
What did you do?
Run
./all.bash
while using a development PostgreSQL database.Minimal example below:
Note that
LANG=en_US.UTF-8
which means thattemplate1
will useen_US.UTF-8
for its collation sinceinitdb
uses whatever is set in$LANG
as a default value (and for non-production systems, it is reasonable to assume that$LANG
is notC
).Unlike
discovery-db
created in https://github.com/golang/pkgsite/blob/master/devtools/create_local_db.sh,dbtest.CreateDBIfNotExists()
does not override template/locale used by theCREATE DATABASE
statement. This means that the two are carried over fromtemplate1
(which may or may not use C locale).Listing all databases returns the following:
(
discovery_*_test
databases have collate and ctypeen_US.UTF-8
).The behaviour described above is extremely flakey (for example, when the example is run on
postgres:alpine
instead ofpostgres:latest
, tests pass). Related: https://www.postgresql.org/message-id/flat/23053.1337036410%40sss.pgh.pa.us#23053.1337036410@sss.pgh.pa.usI think that the documentation should either make it clear that
template1
must useC
as its locale or that we should fixdbtest.CreateDBIfNotExists()
andpostgres.recreateDB()
so that they create databases the same way./devtools/create_local_db.sh
does.What did you expect to see?
All tests pass.
What did you see instead?
TestPostgres_GetTaggedAndPseudoVersions/want_releases_and_prereleases_only
failed because entries were out of order.Unless you have other plans with this, I'm more than happy to create a CL since most files that need changing are already identified above.
The text was updated successfully, but these errors were encountered: