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

test: Bundle test state into single var #1645

Merged
merged 15 commits into from
Jul 17, 2023

Conversation

AndrewSisley
Copy link
Contributor

Relevant issue(s)

Resolves #1644

Description

Bundles all test state into single var. Stuff was starting to get too messy as the action system expanded. This makes all the stuff consistent, in name and location and removes the need to pass the individual items around as and when needed. All props have been documented.

It also simplifies refreshing state, as return values are no longer needed. It opens the way to making the action system interface-based, which we can look at in the future if we want but not here in this PR.

@AndrewSisley AndrewSisley added area/testing Related to any test or testing suite code quality Related to improving code quality action/no-benchmark Skips the action that runs the benchmark. labels Jul 17, 2023
@AndrewSisley AndrewSisley added this to the DefraDB v0.6 milestone Jul 17, 2023
@AndrewSisley AndrewSisley requested a review from a team July 17, 2023 14:54
@AndrewSisley AndrewSisley self-assigned this Jul 17, 2023
@codecov
Copy link

codecov bot commented Jul 17, 2023

Codecov Report

Patch coverage has no change and project coverage change: +0.02 🎉

Comparison is base (8197795) 75.62% compared to head (85441b9) 75.64%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1645      +/-   ##
===========================================
+ Coverage    75.62%   75.64%   +0.02%     
===========================================
  Files          200      200              
  Lines        20807    20807              
===========================================
+ Hits         15735    15739       +4     
+ Misses        3994     3991       -3     
+ Partials      1078     1077       -1     
Flag Coverage Δ
all-tests 75.64% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 4 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 8197795...85441b9. Read the comment docs.

Copy link
Collaborator

@fredcarle fredcarle left a comment

Choose a reason for hiding this comment

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

LGTM. There is just one change that I can't easily understand why it was done.

case <-allActionsDone:
allActionsAreDone = true
}
for _, node := range getNodes(action.NodeID, s.nodes) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

question: It's not quite clear to me why we now have a for loop here. Could you give a quick explanation please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All of the other actions do this. A test case may involve many nodes, is just this one and a couple of other stragglers hadn't implemented it yet.

Copy link
Collaborator

Choose a reason for hiding this comment

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

But it still worked and didn't affect outcome?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The NodeID property was added along with the loop here. Before it was essentially hardcoded to only ever act on the first node, regardless of the test configuration.

If you look at the commit it should be easier to understand I think.

Copy link
Collaborator

Choose a reason for hiding this comment

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

These test were never meant to have more than one node but it could be useful in the future 👍

&result.GQL,
action,
)
for _, node := range getNodes(action.NodeID, s.nodes) {
Copy link
Member

Choose a reason for hiding this comment

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

todo: Can you write a line here to document what the addition of this for loop enables?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This loop is a copy-paste of the same line in the other 20 or so actions. I don't really think it needs to chew up anymore eyespace. It is not unusual.

@AndrewSisley AndrewSisley merged commit 2f245d8 into sourcenetwork:develop Jul 17, 2023
10 checks passed
shahzadlone pushed a commit to shahzadlone/defradb that referenced this pull request Feb 23, 2024
## Relevant issue(s)

Resolves sourcenetwork#1644

## Description

Bundles all test state into single var. Stuff was starting to get too
messy as the action system expanded. This makes all the stuff
consistent, in name and location and removes the need to pass the
individual items around as and when needed. All props have been
documented.

It also simplifies refreshing state, as return values are no longer
needed. It opens the way to making the action system interface-based,
which we can look at in the future if we want but not here in this PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action/no-benchmark Skips the action that runs the benchmark. area/testing Related to any test or testing suite code quality Related to improving code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Collect integration test state vars into single context-like var
3 participants