Skip to content
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

persistence/client/factory.go test coverage #5859

Merged
merged 4 commits into from
Apr 8, 2024

Conversation

Groxx
Copy link
Member

@Groxx Groxx commented Apr 4, 2024

Our ability to cover this file is rather harshly limited due to it directly calling funcs in other packages that try to make network connections... but thankfully the DataStore-based stuff can be intercepted. So I've at least tested those branches.

More generally this package is yet another strong argument in favor of leaning more on go.uber.org/fx for dependency injection. Very little of this has to be (or should be) hard-coded in this file. It feels like Java's "Service Locator" pattern, but even worse because the language doesn't allow test controls of globals like Java does... so I doubt it's a coincidence that there's a bean.go file in here.

Copy link

codecov bot commented Apr 4, 2024

Codecov Report

Merging #5859 (8b88b9c) into master (c7d1957) will decrease coverage by 1.67%.
The diff coverage is n/a.

❗ Current head 8b88b9c differs from pull request most recent head 367989f. Consider uploading reports for the commit 367989f to get more accurate results

Additional details and impacted files
Files Coverage Δ
common/persistence/client/factory.go 53.38% <ø> (ø)

... and 25 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c7d1957...367989f. Read the comment docs.

@coveralls
Copy link

coveralls commented Apr 4, 2024

Pull Request Test Coverage Report for Build 018ebf5a-5f3f-4557-b52c-6a13a84b8ace

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • 32 unchanged lines in 7 files lost coverage.
  • Overall coverage increased (+0.01%) to 67.346%

Files with Coverage Reduction New Missed Lines %
common/task/weighted_round_robin_task_scheduler.go 2 88.56%
service/history/task/transfer_active_task_executor.go 2 72.7%
service/matching/matcher.go 2 90.72%
service/history/queue/timer_gate.go 3 95.83%
common/task/fifo_task_scheduler.go 4 83.51%
common/persistence/nosql/nosql_task_store.go 5 61.95%
service/history/execution/mutable_state_task_refresher.go 14 68.99%
Totals Coverage Status
Change from base Build 018ebf28-b480-46f3-ab45-c31b1c93bdd9: 0.01%
Covered Lines: 98158
Relevant Lines: 145751

💛 - Coveralls

@@ -18,6 +18,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

//go:generate mockgen -package $GOPACKAGE -source $GOFILE -destination factory_mock.go
Copy link
Member Author

@Groxx Groxx Apr 4, 2024

Choose a reason for hiding this comment

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

unfortunately mockgen doesn't seem to allow choosing the interfaces.
I only need the DataStoreFactory.

Comment on lines -37 to -41
if testing.Verbose() {
logger, err := loggerimpl.NewDevelopment()
require.NoError(t, err)
return logger
}
Copy link
Member Author

@Groxx Groxx Apr 4, 2024

Choose a reason for hiding this comment

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

This is a very problematic thing to do in general, and almost certainly should never have been written or approved in the first place.

Verbose test mode already streams the outputs of every t.Log, and they are nicely contained within the test that produced the log if you use a t.Log-based logger. This just spams stdout, interleaving everything with no way to correlate outputs (if concurrent).


Since CI runs tests verbosely this might lead to more race failures in tests, as it touches *testing.T more than it did before, and there are quite a lot of async logging goroutines that are not cleanly shut down across this repo.

If that happens and proves onerous to fix or work around, we could undo this. So far I haven't seen other tests fail due to this change though.

@Groxx Groxx enabled auto-merge (squash) April 8, 2024 20:16
@Groxx Groxx merged commit 604b55c into cadence-workflow:master Apr 8, 2024
18 checks passed
@Groxx Groxx deleted the factory-coverage branch April 8, 2024 21:34
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