Skip to content

[SERF-3424] Fix DB connection initialization for test environment #118

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 2 commits into from
Jul 10, 2024

Conversation

Neurostep
Copy link
Contributor

@Neurostep Neurostep commented Jul 9, 2024

Description

During the Go Chassis and Go SDK upgrades in the document-search service, we noticed a broken behavior of the database.NewConnection function when called in the test environment: the following error was raised

 search_test.go:59: 
                Error Trace:    /app/pkg/search/search_test.go:59
                                                        /app/pkg/search/search_test.go:182
                Error:          Expected nil, but got: &errors.errorString{s:"invalid DSN: missing the slash separating the database name"}
                Test:           TestSearchHandlerHasTimeout
--- FAIL: TestSearchHandlerHasTimeout (0.00s)

The issue is due to the fact that we started using sqltrace from the dd-trace-go library to register the driver and initialize the DB connection, but the test-related initialization was still relying on the sql interface from the database/sql package.

In this PR we upgraded the go-txdb to the latest v0.1.9 version and used sqltrace for all environments.

Testing considerations

  • Deploy service with DB connection in the development and/or staging environment and check if all works as expected

Checklist

  • Prefixed the PR title with the JIRA ticket code
  • Performed simple, atomic commits with good commit messages
  • Verified that the commit history is linear and commits are squashed as necessary
  • Thoroughly tested the changes in development and/or staging
  • Updated the README.md as necessary

Related links

@Neurostep Neurostep requested a review from a team as a code owner July 9, 2024 12:59
@Neurostep Neurostep requested a review from helenff July 9, 2024 12:59
laynax
laynax previously approved these changes Jul 9, 2024
Copy link
Contributor

@laynax laynax left a comment

Choose a reason for hiding this comment

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

LGTM

@Neurostep Neurostep force-pushed the maksimt/SERF-3424/fix-database-test-connection branch from 5d702cd to a8155ab Compare July 10, 2024 08:36
Copy link
Contributor

@laynax laynax left a comment

Choose a reason for hiding this comment

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

LGTM

@Neurostep Neurostep merged commit 976f883 into main Jul 10, 2024
@Neurostep Neurostep deleted the maksimt/SERF-3424/fix-database-test-connection branch July 10, 2024 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants