Skip to content

Move integration tests' db initialization to BeforeSuite#76

Merged
gslaughl merged 2 commits intostagingfrom
extract-db-creation-integration-tests
Dec 17, 2019
Merged

Move integration tests' db initialization to BeforeSuite#76
gslaughl merged 2 commits intostagingfrom
extract-db-creation-integration-tests

Conversation

@gslaughl
Copy link
Copy Markdown
Contributor

@gslaughl gslaughl commented Dec 17, 2019

This is just a proof of concept applied to a couple integration test files-- wanted to get eyes on it before proceeding further.

This PR fixes a "too many connections" error when we run our integration tests, and I think it's a solid change for reducing duplication and improving performance as well. The main issue I'm encountering is that GoLand doesn't seem to know db and blockChain (from integration_tests_suite_test.go) are in scope for the integration tests, which is weird because those vars are being declared in the same package.

Interested to hear people's thoughts and suggestions. If this issue is solvable or acceptable, I'll move on with this approach. Otherwise we'll have to find a different way of solving the "too many connections" error. For the time being, I think this approach is the best path forward, although the red squiggles are definitely annoying.

@gslaughl gslaughl force-pushed the extract-db-creation-integration-tests branch from c02fe4a to 53b6668 Compare December 17, 2019 18:05
@gslaughl gslaughl force-pushed the extract-db-creation-integration-tests branch from 53b6668 to 3196a59 Compare December 17, 2019 18:07
@gslaughl gslaughl changed the title Move integration tests' db initialization to BeforeSuite WIP Move integration tests' db initialization to BeforeSuite Dec 17, 2019
Copy link
Copy Markdown
Contributor

@rmulhol rmulhol left a comment

Choose a reason for hiding this comment

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

👍 to reducing duplication and improving performance 🎉

imo totally worth the red squiggles - especially given that we're hitting that too many connection error.

Would propose putting a story on the board to figure out what's going on with GoLand - there's gotta be a way we can fix that.

@gslaughl
Copy link
Copy Markdown
Contributor Author

Update incoming that fixes red squiggles by renaming the integration test files to end with a _test. Not sure why it works but it seems to do the trick

Copy link
Copy Markdown
Contributor

@yaoandrew yaoandrew left a comment

Choose a reason for hiding this comment

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

Cool.. yeah I think that test file convention in go is what goland is leaning on. I bet this fixes a bunch of things like the ability to run tests for the package from within each file.

@gslaughl gslaughl merged commit 8bb30be into staging Dec 17, 2019
@gslaughl gslaughl deleted the extract-db-creation-integration-tests branch December 17, 2019 21:31
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.

3 participants