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: Rework transaction test framework capabilities #1603

Merged

Conversation

AndrewSisley
Copy link
Contributor

Relevant issue(s)

Resolves #1602

Description

Instead of a dedicated txn action (like we currently have), we can instead follow a similar pattern to node ids where any action can specify a transaction id. I would like to use this on other actions, most immediately for Lens testing, although it will likely be very useful elsewhere too.

@AndrewSisley AndrewSisley added area/testing Related to any test or testing suite refactor This issue specific to or requires *notable* refactoring of existing codebases and components action/no-benchmark Skips the action that runs the benchmark. labels Jun 29, 2023
@AndrewSisley AndrewSisley added this to the DefraDB v0.6 milestone Jun 29, 2023
@AndrewSisley AndrewSisley requested a review from a team June 29, 2023 15:40
@AndrewSisley AndrewSisley self-assigned this Jun 29, 2023
@AndrewSisley AndrewSisley force-pushed the 1602-txn-test-rework branch from 19b689b to a1b7c0b Compare June 29, 2023 15:43
@AndrewSisley AndrewSisley force-pushed the 1602-txn-test-rework branch from a1b7c0b to 1f9ecd7 Compare June 29, 2023 15:45
action TransactionRequest2,
) []datastore.Txn {
if action.TransactionID >= len(txns) {
txnsPointer *[]datastore.Txn,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

note: The ptr param is quite ugly, but I think it is less ugly than returning txns from every test action handler. At somepoint we should probably just have a test-context object that hold txn, nodes, collections, etc, but not now.

@codecov
Copy link

codecov bot commented Jun 29, 2023

Codecov Report

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

Comparison is base (39931ab) 73.59% compared to head (d908b67) 73.62%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1603      +/-   ##
===========================================
+ Coverage    73.59%   73.62%   +0.03%     
===========================================
  Files          188      188              
  Lines        19608    19608              
===========================================
+ Hits         14429    14435       +6     
+ Misses        4112     4108       -4     
+ Partials      1067     1065       -2     
Flag Coverage Δ
all-tests 73.62% <ø> (+0.03%) ⬆️

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

see 6 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 39931ab...d908b67. Read the comment docs.

Note: A couple of these were broken out of 'grouped' test.  This is because I have no desire to convert all of the others within the same test function, it is a much lower priority to do so, and I have quite a strong dislike of such tests as it makes debugging them much harder than they would be if there was only one test in each test func.
@AndrewSisley AndrewSisley force-pushed the 1602-txn-test-rework branch from 1f9ecd7 to d908b67 Compare June 29, 2023 15:58
Copy link
Contributor

@islamaliev islamaliev left a comment

Choose a reason for hiding this comment

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

LGTM

@AndrewSisley AndrewSisley merged commit 97873c5 into sourcenetwork:develop Jul 4, 2023
@AndrewSisley AndrewSisley deleted the 1602-txn-test-rework branch July 4, 2023 13:42
shahzadlone pushed a commit to shahzadlone/defradb that referenced this pull request Feb 23, 2024
)

## Relevant issue(s)

Resolves sourcenetwork#1602

## Description

Instead of a dedicated txn action (like we currently have), we can
instead follow a similar pattern to node ids where any action can
specify a transaction id. I would like to use this on other actions,
most immediately for Lens testing, although it will likely be very
useful elsewhere too.
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 refactor This issue specific to or requires *notable* refactoring of existing codebases and components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve test action txn capabilities
2 participants