Skip to content

feat(load2): add contract tests #4071

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

RodrigoVillar
Copy link
Contributor

@RodrigoVillar RodrigoVillar commented Jul 10, 2025

Why this should be merged

This PR migrates over the existing contract tests from the original load framework into load 2.0. This PR also replaces the type of test used in load 2.0 testing (ZeroTransferTest => RandomTest).

How this works

Migration with the following caveats:

  • Rather than simple transfers having a high probability of being selected, each test has an equal probability of being chosen.
  • Previously, each individual test utilized a random parameter. Now, the parameters of an individual test are now the responsibility of the caller (i.e. parameter can be hard-coded or random).

How this was tested

CI

Need to be documented in RELEASES.md?

N/A

@RodrigoVillar RodrigoVillar self-assigned this Jul 10, 2025
@RodrigoVillar RodrigoVillar added the testing This primarily focuses on testing label Jul 10, 2025
Copy link
Contributor Author

@RodrigoVillar RodrigoVillar left a comment

Choose a reason for hiding this comment

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

Commenting for context.

@@ -48,5 +114,231 @@ func (z ZeroTransferTest) Run(
})
require.NoError(err)

require.NoError(wallet.SendTx(ctx, tx, z.PollFrequency))
require.NoError(wallet.SendTx(ctx, tx, time.Millisecond))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Waiting on #4059 to be merged in to remove PollFrequency parameter.

@RodrigoVillar RodrigoVillar requested a review from Elvis339 July 11, 2025 13:55
@RodrigoVillar RodrigoVillar marked this pull request as ready for review July 11, 2025 13:55
@RodrigoVillar RodrigoVillar requested a review from maru-ava as a code owner July 11, 2025 13:55
@RodrigoVillar RodrigoVillar requested a review from Copilot July 11, 2025 13:55
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR migrates contract tests from the original load framework to load 2.0, replacing the simple ZeroTransferTest with a comprehensive RandomTest that can execute multiple test types with configurable weights.

  • Introduces a new RandomTest struct that uses weighted sampling to select from multiple test types
  • Adds 10 new contract test implementations (ReadTest, WriteTest, StateModificationTest, etc.)
  • Updates the main load generator to deploy a contract and use the new random test selection

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
tests/load2/tests.go Adds RandomTest implementation and 10 contract test types with shared utility functions
tests/load2/main/main.go Updates main function to deploy contract and configure RandomTest with equal weights

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing This primarily focuses on testing
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

1 participant