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

Missing Control API Unit Tests #473

Merged
merged 13 commits into from
Jan 2, 2025
Merged

Missing Control API Unit Tests #473

merged 13 commits into from
Jan 2, 2025

Conversation

jordan-rash
Copy link
Contributor

No description provided.

jordan-rash and others added 9 commits December 27, 2024 12:44
Signed-off-by: Jordan Rash <jordan@synadia.com>
Signed-off-by: Jordan Rash <jordan@synadia.com>
Signed-off-by: Jordan Rash <jordan@synadia.com>
Signed-off-by: Jordan Rash <jordan@synadia.com>
Signed-off-by: Jordan Rash <jordan@synadia.com>
Signed-off-by: Jordan Rash <jordan@synadia.com>
Signed-off-by: Jordan Rash <jordan@synadia.com>
Signed-off-by: Jordan Rash <jordan@synadia.com>
@jordan-rash jordan-rash marked this pull request as ready for review December 30, 2024 18:29
@jordan-rash jordan-rash requested a review from a team as a code owner December 30, 2024 18:29
Signed-off-by: Jordan Rash <jordan@synadia.com>
Copy link
Contributor

@bruth bruth left a comment

Choose a reason for hiding this comment

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

The bulk of the review are comments on a handful of practices to improve the testing structure which will help simplify the tests and remove some redundancy.

api/nodecontrol/client_test.go Outdated Show resolved Hide resolved
api/nodecontrol/client_test.go Outdated Show resolved Hide resolved
api/nodecontrol/client_test.go Outdated Show resolved Hide resolved
api/nodecontrol/client_test.go Show resolved Hide resolved
api/nodecontrol/client_test.go Outdated Show resolved Hide resolved
api/nodecontrol/client_test.go Show resolved Hide resolved
api/nodecontrol/client_test.go Outdated Show resolved Hide resolved
models/node_options.go Outdated Show resolved Hide resolved
api/nodecontrol/client_test.go Outdated Show resolved Hide resolved
api/nodecontrol/client_test.go Outdated Show resolved Hide resolved
Signed-off-by: Jordan Rash <jordan@synadia.com>
Signed-off-by: Jordan Rash <jordan@synadia.com>
Copy link
Contributor

@bruth bruth left a comment

Choose a reason for hiding this comment

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

LGTM. My only other comment would be whether it would make sense to consolidate some of the tests as subtests to remove the need to spin up all the boilerplate each time for the simpler interactions. For example, Ping and DirectPing are not state changing, so those could combined as subtests. As another example, the only difference between the AuctionDeployAnd* tests is finding the workload vs. listing, but all the other boilerplate is the same. The CopyWorkload test could also be a subtest.

@jordan-rash
Copy link
Contributor Author

jordan-rash commented Jan 2, 2025

LGTM. My only other comment would be whether it would make sense to consolidate some of the tests as subtests to remove the need to spin up all the boilerplate each time for the simpler interactions. For example, Ping and DirectPing are not state changing, so those could combined as subtests. As another example, the only difference between the AuctionDeployAnd* tests is finding the workload vs. listing, but all the other boilerplate is the same. The CopyWorkload test could also be a subtest.

Now that there is an assertion lib in there, I agree with this. I thought before subtest made it too difficult to read....let me see if I can clean it up

EDIT: I think what I am going to do is merge this and move to the subtest approach in the next few weeks

Copy link

github-actions bot commented Jan 2, 2025

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/synadia-io/nex/api/nodecontrol 75.44% (+75.44%) 🌟
github.com/synadia-io/nex/api/nodecontrol/gen 0.00% (ø)
github.com/synadia-io/nex/cmd/nex 0.00% (ø)
github.com/synadia-io/nex/models 27.01% (+21.98%) 🌟
github.com/synadia-io/nex/node 9.23% (ø)
github.com/synadia-io/nex/node/internal/actors 12.91% (+0.46%) 👍

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/synadia-io/nex/api/nodecontrol/client.go 75.44% (+75.44%) 171 129 (+129) 42 (-129) 🌟
github.com/synadia-io/nex/api/nodecontrol/gen/node_info_response.go 0.00% (ø) 0 0 0
github.com/synadia-io/nex/api/nodecontrol/gen/node_ping_response.go 0.00% (ø) 0 0 0
github.com/synadia-io/nex/cmd/nex/node.go 0.00% (ø) 0 0 0
github.com/synadia-io/nex/models/node.go 0.00% (ø) 0 0 0
github.com/synadia-io/nex/models/node_options.go 21.62% (+12.10%) 148 (+43) 32 (+22) 116 (+21) 🎉
github.com/synadia-io/nex/node/internal/actors/control_api.go 0.00% (ø) 298 (-35) 0 298 (-35)
github.com/synadia-io/nex/node/internal/actors/control_api_conversions.go 0.00% (ø) 24 (-1) 0 24 (-1)
github.com/synadia-io/nex/node/node.go 8.07% (ø) 347 28 319

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/synadia-io/nex/api/nodecontrol/client_test.go

@jordan-rash jordan-rash merged commit f21b68e into main Jan 2, 2025
8 checks passed
@jordan-rash jordan-rash deleted the test/control_api branch January 2, 2025 15:01
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