Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add locale config option #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2020

Conversation

tachiniererin
Copy link
Contributor

This makes the locale of the database created configurable. E.g. for consistent testing where some things depend on the database locale, this is helpful. Or also on broken systems, where the default locale is an invalid string.

I also bumped the versions to the latest point releases.

@fergusstrange
Copy link
Owner

Hey @tachiniererin,

Thanks for the contribution. Unfortunately the point version upgrades can't be supported in OSX due to the upstream bugs in zonkyio/embedded-postgres-binaries#21...

I'd recommend removing these from the PR and trying to stick with one clean change with the locale changes. I'll bump a minor version for this when the tests are green.

If you could also add a locale specific happy path test that would be awesome.

Thanks

@tachiniererin
Copy link
Contributor Author

Ok done. Reverted the version changes and added a test. Unfortunately "C" is the only locale we can always assume to work but it tests the functionality just fine.

@fergusstrange
Copy link
Owner

fergusstrange commented Jun 11, 2020

Looks like there are still some failing tests here https://github.com/fergusstrange/embedded-postgres/pull/12/checks?check_run_id=761577382

When I run locally on OSX I get one failing test as follows...

    Test_defaultInitDatabase_ErrorWhenCannotStartInitDBProcess: prepare_database_test.go:33: 
        	Error Trace:	prepare_database_test.go:33
        	Error:      	Error message not equal:
        	            	expected: "unable to init database using: /var/folders/9y/kcdkzfbj1y9g72rfcl69w7j00000gn/T/prepare_database_test019940563/bin/initdb -A password -U Tom -D /var/folders/9y/kcdkzfbj1y9g72rfcl69w7j00000gn/T/prepare_database_test019940563/data --pwfile=/var/folders/9y/kcdkzfbj1y9g72rfcl69w7j00000gn/T/prepare_database_test019940563/pwfile --locale=C"
        	            	actual  : "unable to init database using: /var/folders/9y/kcdkzfbj1y9g72rfcl69w7j00000gn/T/prepare_database_test019940563/bin/initdb -A password -U Tom -D /var/folders/9y/kcdkzfbj1y9g72rfcl69w7j00000gn/T/prepare_database_test019940563/data --pwfile=/var/folders/9y/kcdkzfbj1y9g72rfcl69w7j00000gn/T/prepare_database_test019940563/pwfile"
        	Test:       	Test_defaultInitDatabase_ErrorWhenCannotStartInitDBProcess
--- FAIL: Test_defaultInitDatabase_ErrorWhenCannotStartInitDBProcess (0.01s)

Are these failing locally for you?

@tachiniererin
Copy link
Contributor Author

I tested it on my system with broken locale settings, so of course it passed locally 🤦‍♀️

@fergusstrange fergusstrange merged commit 73cda76 into fergusstrange:master Jun 12, 2020
@fergusstrange
Copy link
Owner

Thanks @tachiniererin, release has been made at v1.1.0 https://github.com/fergusstrange/embedded-postgres/releases/tag/v1.1.0

Hope this helps you out, enjoy your weekend 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants