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

Revisiting tests to have reusable mocks #256

Merged
merged 2 commits into from
Aug 19, 2020

Conversation

gauravgahlot
Copy link
Contributor

@gauravgahlot gauravgahlot commented Aug 18, 2020

Description

The PR restructures mocking based on the suggestion by @gianarb in this thread.

Why is this needed

To write more flexible and|or reusable mocks.

How Has This Been Tested?

The changes include unit tests only.

Coverage

➜ go test -coverprofile coverage.out
➜ go tool cover -func coverage.out | grep tinkerbell.go
github.com/tinkerbell/tink/grpc-server/tinkerbell.go:29:	GetWorkflowContexts	0.0%
github.com/tinkerbell/tink/grpc-server/tinkerbell.go:49:	GetWorkflowContextList	100.0%
github.com/tinkerbell/tink/grpc-server/tinkerbell.go:72:	GetWorkflowActions	100.0%
github.com/tinkerbell/tink/grpc-server/tinkerbell.go:81:	ReportActionStatus	100.0%
github.com/tinkerbell/tink/grpc-server/tinkerbell.go:138:	UpdateWorkflowData	100.0%
github.com/tinkerbell/tink/grpc-server/tinkerbell.go:155:	GetWorkflowData		100.0%
github.com/tinkerbell/tink/grpc-server/tinkerbell.go:168:	GetWorkflowMetadata	100.0%
github.com/tinkerbell/tink/grpc-server/tinkerbell.go:177:	GetWorkflowDataVersion	100.0%
github.com/tinkerbell/tink/grpc-server/tinkerbell.go:185:	getWorkflowsForWorker	100.0%
github.com/tinkerbell/tink/grpc-server/tinkerbell.go:196:	getWorkflowActions	100.0%
github.com/tinkerbell/tink/grpc-server/tinkerbell.go:206:	isApplicableToSend	100.0%
github.com/tinkerbell/tink/grpc-server/tinkerbell.go:233:	isLastAction		100.0%

How are existing users impacted? What migration steps/scripts do we need?

No impact.

Checklist:

I have:

  • updated the documentation and/or roadmap (if required)
  • added unit or e2e tests
  • provided instructions on how to upgrade

@gauravgahlot gauravgahlot requested a review from gianarb August 18, 2020 11:42
@gauravgahlot gauravgahlot self-assigned this Aug 18, 2020
@gianarb
Copy link
Contributor

gianarb commented Aug 18, 2020

Yep! That's the right direciton!! Thank you for doing it @gauravgahlot

@gauravgahlot gauravgahlot added do-not-merge Signal to Mergify to block merging of the PR. added-tests and removed do-not-merge Signal to Mergify to block merging of the PR. labels Aug 18, 2020
@gauravgahlot gauravgahlot added size/L estimate of the amount of work to address the issue priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Aug 19, 2020
@gianarb
Copy link
Contributor

gianarb commented Aug 19, 2020

Can you squash your commits please?

@gauravgahlot gauravgahlot force-pushed the revisiting-tests branch 3 times, most recently from eb7d402 to af4f210 Compare August 19, 2020 14:10
Signed-off-by: Gaurav Gahlot <[email protected]>
Signed-off-by: Gaurav Gahlot <[email protected]>
@codecov
Copy link

codecov bot commented Aug 19, 2020

Codecov Report

Merging #256 into master will increase coverage by 1.45%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #256      +/-   ##
==========================================
+ Coverage   10.90%   12.36%   +1.45%     
==========================================
  Files           7        7              
  Lines        1165     1165              
==========================================
+ Hits          127      144      +17     
+ Misses       1019     1010       -9     
+ Partials       19       11       -8     
Impacted Files Coverage Δ
grpc-server/tinkerbell.go 90.83% <0.00%> (+12.97%) ⬆️

Continue to review full report at Codecov.

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

@gianarb gianarb added the ready-to-merge Signal to Mergify to merge the PR. label Aug 19, 2020
@mergify mergify bot merged commit 1d8884a into tinkerbell:master Aug 19, 2020
@gauravgahlot gauravgahlot deleted the revisiting-tests branch August 19, 2020 14:31
@mmlb mmlb removed the ready-to-merge Signal to Mergify to merge the PR. label Jan 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. size/L estimate of the amount of work to address the issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants