Skip to content
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

Unified Storage: Fixes bug with postgres connection string and adds tests #87656

Merged

Conversation

owensmallwood
Copy link
Contributor

We were creating the postgres connection string with quotes around all values. This is different than how core does it, and it was causing US to fail on startup. Refactored things a bit and added some regression tests.

@owensmallwood owensmallwood self-assigned this May 10, 2024
@grafana-delivery-bot grafana-delivery-bot bot added this to the 11.1.x milestone May 10, 2024
@owensmallwood owensmallwood marked this pull request as ready for review May 10, 2024 18:45
@owensmallwood owensmallwood requested a review from a team as a code owner May 10, 2024 18:45
}

connectionString := fmt.Sprintf(
"user='%s' password='%s' host='%s' port='%s' dbname='%s' sslmode='%s'", // sslcert='%s' sslkey='%s' sslrootcert='%s'",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue was the single quotes here. When we parse the db name from the connection string we don't expect there to be quotes around the values.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ugh, that's nasty. It may be a good idea to update that regex to allow quotes, or use something that can parse it properly, but this workaround is fine for now imho

@owensmallwood owensmallwood added no-changelog Skip including change in changelog/release notes no-backport Skip backport of PR labels May 10, 2024
@owensmallwood owensmallwood merged commit 3bf39d6 into main May 13, 2024
12 checks passed
@owensmallwood owensmallwood deleted the owensmallwood/unified-storage-fix-bug-parsing-postgres-dsn branch May 13, 2024 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/backend no-backport Skip backport of PR no-changelog Skip including change in changelog/release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants