Skip to content

Test/database sqlmock - #124

Merged
andrewtavis merged 7 commits into
scribe-org:mainfrom
DeleMike:test/database-sqlmock
Oct 23, 2026
Merged

andrewtavis merged 7 commits into
scribe-org:mainfrom
DeleMike:test/database-sqlmock

Conversation

@DeleMike

@DeleMike DeleMike commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Contributor checklist

  • This pull request is on a separate branch and not the main branch
  • I have ran the ./pre-commit executable as well as make lint and have fixed all reported issues

Description

Adds tests for the database package using go-sqlmock (BSD-3-Clause), so the tests don't need MariaDB.

Also, this PR also fixes a silent bug in GetTableSchema, GetTableData, GetAvailableLanguages and GetLanguageDataTypes. That is, if reading rows failed partway through, they returned partial results without an error. As /api/v1/data/{lang} uses the first two functions, the client could receive an incomplete language pack. They now return an error instead.

Related issue

@DeleMike
DeleMike requested a review from andrewtavis October 22, 2026 10:03
@DeleMike DeleMike self-assigned this Oct 22, 2026
@DeleMike DeleMike added the testing Relates to tests or test coverage label Oct 22, 2026
@andrewtavis
andrewtavis requested a review from ashb155 October 22, 2026 18:26
@andrewtavis

Copy link
Copy Markdown
Member

@ashb155, would you be able to take a first look at this PR? :)

@ashb155

ashb155 commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

will have a look @andrewtavis !

@ashb155 ashb155 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

looks good to me @andrewtavis @DeleMike !

@andrewtavis andrewtavis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

praise: I can't believe we're already to 70% coverage! Amazing work here, @DeleMike, and thanks for the initial review, @ashb155!

@andrewtavis
andrewtavis merged commit 1ab428b into scribe-org:main Oct 23, 2026
3 checks passed
@DeleMike

Copy link
Copy Markdown
Member Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing Relates to tests or test coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add sqlmock-based tests for the database package

3 participants