-
Notifications
You must be signed in to change notification settings - Fork 123
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
Remove memory store and increase test coverage #1011
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #1011 +/- ##
===========================================
+ Coverage 72.96% 75.59% +2.62%
===========================================
Files 91 90 -1
Lines 9900 9563 -337
Branches 1928 1897 -31
===========================================
+ Hits 7224 7229 +5
+ Misses 2561 2230 -331
+ Partials 115 104 -11
Continue to review full report at Codecov.
|
This PR is complete for now. I will make a new PR for rosetta test cases to increase the code coverage. |
@rafaelcr I was trying to rebase this PR. However, one of my tests, here, that I added in this PR has been failing. The error shown is
This error is generated as the length of rows for total is 0. |
9d7518a
to
b1deb6d
Compare
src/datastore/postgres-store.ts
Outdated
@@ -2985,6 +2986,7 @@ export class PgDataStore | |||
`, | |||
[limit, offset] | |||
); | |||
console.log('printing results here: ', results); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you remove these debug logs?
src/index.ts
Outdated
@@ -141,11 +140,6 @@ async function init(): Promise<void> { | |||
db = OfflineDummyStore; | |||
} else { | |||
switch (process.env['STACKS_BLOCKCHAIN_API_DB']) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This env variable is now unused. Can you remove it from the entire project?
src/tests/setup.ts
Outdated
@@ -12,9 +12,11 @@ export default async (): Promise<void> => { | |||
process.env.NODE_ENV = 'test'; | |||
} | |||
loadDotEnv(); | |||
process.env.PG_DATABASE = 'postgres'; | |||
const db = await PgDataStore.connect({ skipMigrations: true, usageName: 'setup' }); | |||
const server = await startEventServer({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm not mistaken, this entire global server is never used... Can you try removing it (also removing the db) from here and teardown.ts
to see if tests are at all affected? If not, we should delete it.
src/datastore/postgres-store.ts
Outdated
@@ -2974,6 +2974,7 @@ export class PgDataStore | |||
const total = await client.query<{ count: number }>(` | |||
SELECT block_count AS count FROM chain_tip | |||
`); | |||
console.log('printing total rows here: ', total.rows); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this one too
src/tests-bns/setup.ts
Outdated
if (!process.env.NODE_ENV) { | ||
process.env.NODE_ENV = 'test'; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These lines should be kept
src/tests-rosetta/setup.ts
Outdated
if (!process.env.NODE_ENV) { | ||
process.env.NODE_ENV = 'test'; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep these lines too
src/tests-tokens/setup.ts
Outdated
if (!process.env.NODE_ENV) { | ||
process.env.NODE_ENV = 'test'; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep this
utils/src/index.ts
Outdated
@@ -27,7 +27,7 @@ type TableCellValue = string | number | bigint | undefined; | |||
* @param blockHeight Specific block height at which to query balances | |||
*/ | |||
async function printTopAccountBalances(count: number, blockHeight: number) { | |||
const db = await PgDataStore.connect(true); | |||
const db = await PgDataStore.connect({ skipMigrations: true, usageName: 'tests' }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const db = await PgDataStore.connect({ skipMigrations: true, usageName: 'tests' }); | |
const db = await PgDataStore.connect({ skipMigrations: true, usageName: 'utils' }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Before merging, can you change the PR's title to "Remove memory store and increase test coverage"?
8d3994f
to
48c8e05
Compare
🎉 This PR is included in version 4.0.0-beta.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 4.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Description
This PR increases the test coverage. It adds test cases that were previously not catered.
For details refer to issue #985
Checklist
npm run test
passes