Skip to content

VDB-1058 Speedup tests#50

Merged
m0ar merged 2 commits intostagingfrom
vdb-1058-speedup-tests
Dec 10, 2019
Merged

VDB-1058 Speedup tests#50
m0ar merged 2 commits intostagingfrom
vdb-1058-speedup-tests

Conversation

@m0ar
Copy link
Copy Markdown
Contributor

@m0ar m0ar commented Dec 10, 2019

🏎️

@m0ar m0ar self-assigned this Dec 10, 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.

🏃 ✂️ 🎉

Really awesome that we can speed up tests this way! I feel like I've run into trouble in the past when values were assigned in var declarations rather than a BeforeEach, but not w/r/t db initialization and the tests here are passing, so 👍

"github.com/makerdao/vulcanizedb/pkg/datastore/postgres"
"io/ioutil"
"testing"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you remove spaces between imports in this file and then run goimports -w transformers/component_tests/queries/queries_suite_test.go

@m0ar
Copy link
Copy Markdown
Contributor Author

m0ar commented Dec 10, 2019

@rmulhol I think the issue has been that we have initialised a completely new connection per test, which we hadn't explicitly closed until you added your AfterEach things. Now, there is only one connection per suite and it should be fine :)

@m0ar m0ar merged commit e0cb141 into staging Dec 10, 2019
@m0ar m0ar deleted the vdb-1058-speedup-tests branch December 10, 2019 17:29
@rmulhol
Copy link
Copy Markdown
Contributor

rmulhol commented Dec 10, 2019

👍 definitely no problems here - mostly just noting since the pattern of:

var name type
BeforeEach(func() {
     name = type{}
})

is usually pretty bulletproof, so all things being equal I wouldn't abandon it without a good reason (which we definitely have here).

I think I've seen issues where:

var name = func()

can sometimes result in zero-valued vars (though I could be misremembering - thought I had seen that when the function depended on other vars/functions that may not have been evaluated in time to make a successful assignment 🤔).

Also could be that I'm confusing things in a var declaration with implicitly defined vars, e.g.

Describe("thing", func() {
     name := func()
     It("does something", func() {
          ...
     })
})

(with no var declaration)

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.

2 participants