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

VRF-897: refactoring VRF v2 and V2 Plus e2e tests #12208

Conversation

iljapavlovs
Copy link
Collaborator

@iljapavlovs iljapavlovs commented Feb 28, 2024

PR covers multiple tasks:

  • https://smartcontract-it.atlassian.net/browse/VRF-947 - BHS Load Test
    • added TestVRFV2BHSPerformance and TestVRFV2PlusBHSPerformance tests where we:
      • underfund sub
      • perform rand requests continuously for bhs_test_duration
      • wait 256 blocks
      • fund the sub
      • check that all requests are fulfilled
  • https://smartcontract-it.atlassian.net/browse/VRF-897 - run smoke tests against existing env
    • creating SetupVRFV2Universe for v2 and v2plus and adding to each test. If use_existing_env is true, then it will not deploy new contracts, but will use specified vrf coordinator and keyhash
  • https://smartcontract-it.atlassian.net/browse/VRF-948 - isolate tests - each test should create separate sub and consumer
    • added SetupNewConsumersAndSubs to the start of each test so that each test creates its own sub and consumer. Also, removed sub and consumer deployment from the main setup env script
  • ongoing refactoring of VRF V2 and V2Plus tests
    • separating code into separate files for logging, setup_steps, errors in integration-tests/actions/vrf/vrfv2plus/, integration-tests/actions/vrf/vrfv2

Copy link
Contributor

I see that you haven't updated any README files. Would it make sense to do so?

@iljapavlovs iljapavlovs marked this pull request as ready for review February 29, 2024 17:18
@iljapavlovs iljapavlovs requested a review from a team as a code owner February 29, 2024 17:18
)
if err != nil {
return nil, nil, fmt.Errorf("err: %w", err)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

How about killing most of the if-else nesting by reversing the logic:

// just for this case do this...
if *testConfig.VRFv2.General.UseExistingEnv &&  *testConfig.VRFv2.ExistingEnvConfig.ExistingEnvConfig. CreateFundSubsAndAddConsumers {
	consumer, err := env.ContractLoader.LoadVRFv2LoadTestConsumer(*commonExistingEnvConfig.ConsumerAddress)
	if err != nil {
		return nil, nil, fmt.Errorf("err: %w", err)
	}
	consumers = append(consumers, consumer)
	subIDs = append(subIDs, *testConfig.VRFv2.ExistingEnvConfig.SubID)
                     return subIDs, consumers, nil
}

// for all other cases, do this...
consumers, subIDs, err = SetupNewConsumersAndSubs(
	env,
	coordinator,
	testConfig,
	linkToken,
	numberOfConsumerContractsToDeployAndAddToSub,
	numberOfSubToCreate,
	l,
)
if err != nil {
	return nil, nil, fmt.Errorf("err: %w", err)
}
return subIDs, consumers, nil

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah, just I usually prefer the most easiest solution

)
if err != nil {
return nil, nil, fmt.Errorf("err: %w", err)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Remember the comment where I suggested to reorganize the code by flipping the logic? This can be applied here as well.

ibrajer
ibrajer previously approved these changes Mar 20, 2024
Copy link
Contributor

@ibrajer ibrajer left a comment

Choose a reason for hiding this comment

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

LGTM, left some comments, but nothing that can't be addressed later or fixed/updated in the next PR.

@cl-sonarqube-production
Copy link

@kidambisrinivas kidambisrinivas added this pull request to the merge queue Mar 21, 2024
Merged via the queue into develop with commit ad3f5bd Mar 21, 2024
104 checks passed
@kidambisrinivas kidambisrinivas deleted the chore/VRF-897-adjust-e2e-test-to-run-against-existing-env branch March 21, 2024 17:19
kidambisrinivas pushed a commit that referenced this pull request Mar 27, 2024
* VRF-897: refactoring VRF v2 and V2 Plus e2e tests

* VRF-897: fixing test

* VRF-897: refactoring VRF v2 load test

* VRF-897: fixing v2 load test

* VRF-897: adding possibility to run vrf v2 test against existing env

* VRF-897: removing code

* VRF-897: fixing lint issue

* VRF-897: finishing V2 test refactoring

* VRF-897: fixing BHS test

* VRF-897: fixing VRF V2 Basic test

* VRF-897: fixing VRF V2 Basic test

* VRF-897: small refactoring

* VRF-897: fixing lint issues

* VRF-897: fixing VRF v2 test

* VRF-897: fixing VRF v2 test

* VRF-897: fixing VRF v2 test

* VRF-897: fixing VRF v2 test

* VRF-897: fixing VRF v2 test

* VRF-897: adding VRF Owner test

* VRF-897: fixing VRF Owner test

* VRF-897: adding BHS Load Test

* VRF-897: rerun tests

* VRF-897: removing perf test to run setting

* VRF-897: removing logging

* VRF-897: small fix

* VRF-897: fixing compilation issues

* VRF-897: fixing lint issues

* VRF-897: fixing lint issues

* VRF-897: refactoring

* VRF-897: fixing lint

* VRF-897: fixing vrfv2plus test

* VRF-897: fixing vrfv2plus and vrfv2 test

* VRF-897: fixing vrfv2plus and vrfv2 test

* VRF-897: fixing vrfv2plus and vrfv2 test

* VRF-897: fixing vrfv2plus and vrfv2 test

* VRF-897: fixing vrfv2plus

* VRF-897: fixing vrfv2plus test

* VRF-897: fixing vrfv2plus test

* VRF-897: PR comments

* VRF-897: adding default value for bhs load test

* VRF-897: adding default value for bhs load test

* VRF-897: adjusting default value for bhs load test

* VRF-897: fixing load test for existing env

* VRF-897: fixing sub funds return to eoa wallet
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.

3 participants