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(i): Fix the nodes ID/index bug in tests #3162

Merged

Conversation

shahzadlone
Copy link
Member

@shahzadlone shahzadlone commented Oct 20, 2024

Relevant issue(s)

Resolves #3076

Description

  • Fix the getNodes bug
  • Fix the temporary duplications in some actions
  • Remove the getNodesCollection

@shahzadlone shahzadlone added bug Something isn't working area/testing Related to any test or testing suite code quality Related to improving code quality labels Oct 20, 2024
@shahzadlone shahzadlone added this to the DefraDB v0.15 milestone Oct 20, 2024
@shahzadlone shahzadlone self-assigned this Oct 20, 2024
@shahzadlone shahzadlone requested a review from a team October 20, 2024 23:03
@shahzadlone shahzadlone force-pushed the lone/test/improve-get-nodes branch from 9ca479a to fb558ab Compare October 20, 2024 23:04
@shahzadlone shahzadlone changed the title test(i): Fix the nodes indexing bug in tests test(i): Fix the nodes ID/index bug in tests Oct 20, 2024
Copy link

codecov bot commented Oct 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.01%. Comparing base (47d38a8) to head (fb558ab).
Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #3162      +/-   ##
===========================================
- Coverage    78.10%   78.01%   -0.10%     
===========================================
  Files          354      354              
  Lines        34660    34660              
===========================================
- Hits         27071    27038      -33     
- Misses        5972     5996      +24     
- Partials      1617     1626       +9     
Flag Coverage Δ
all-tests 78.01% <ø> (-0.10%) ⬇️

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

see 13 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 47d38a8...fb558ab. Read the comment docs.

Copy link
Member

@nasdf nasdf left a comment

Choose a reason for hiding this comment

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

LGTM

// greater than 0. For example if requesting a node with nodeID=2 then the resulting output will contain only
// one element (at index 0) caller might accidentally assume that this node belongs to node 0. Therefore, the
// caller should always use the returned IDs, instead of guessing the IDs based on node indexes.
func getNodesWithIDs(nodeID immutable.Option[int], nodes []clients.Client) ([]int, []clients.Client) {
Copy link
Member

Choose a reason for hiding this comment

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

thought: this could be a custom iterator https://pkg.go.dev/iter that returns nodeID and node.

Copy link
Member Author

Choose a reason for hiding this comment

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

Can do so in future if others feel strongly for it.

@shahzadlone shahzadlone merged commit 27146cb into sourcenetwork:develop Oct 21, 2024
44 checks passed
@shahzadlone shahzadlone deleted the lone/test/improve-get-nodes branch October 21, 2024 15:37
ChrisBQu pushed a commit to ChrisBQu/defradb that referenced this pull request Feb 21, 2025
## Relevant issue(s)
Resolves sourcenetwork#3076 

## Description
- Fix the `getNodes` bug
- Fix the temporary duplications in some actions
- Remove the `getNodesCollection`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/testing Related to any test or testing suite bug Something isn't working code quality Related to improving code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve getNodes in test utils to return the correct indexes with the relevant nodes
2 participants