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: Add flag to skip network tests #2495

Merged
merged 2 commits into from
Apr 5, 2024

Conversation

nasdf
Copy link
Member

@nasdf nasdf commented Apr 4, 2024

Relevant issue(s)

Resolves #2494

Description

This PR adds a test flag set via an environment variable to skip any tests that involve network actions.

Tasks

  • I made sure the code is well commented, particularly hard-to-understand areas.
  • I made sure the repository-held documentation is changed accordingly.
  • I made sure the pull request title adheres to the conventional commit style (the subset used in the project can be found in tools/configs/chglog/config.yml).
  • I made sure to discuss its limitations such as threats to validity, vulnerability to mistake and misuse, robustness to invalidation of assumptions, resource requirements, ...

How has this been tested?

make test

Specify the platform(s) on which this was tested:

  • MacOS

@nasdf nasdf added the area/testing Related to any test or testing suite label Apr 4, 2024
@nasdf nasdf added this to the DefraDB v0.11 milestone Apr 4, 2024
@nasdf nasdf self-assigned this Apr 4, 2024
Copy link

codecov bot commented Apr 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.63%. Comparing base (0fae207) to head (a90cdbf).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #2495   +/-   ##
========================================
  Coverage    75.62%   75.63%           
========================================
  Files          291      291           
  Lines        28072    28072           
========================================
+ Hits         21229    21230    +1     
+ Misses        5487     5486    -1     
  Partials      1356     1356           
Flag Coverage Δ
all-tests 75.63% <ø> (+<0.01%) ⬆️

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

see 7 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 0fae207...a90cdbf. Read the comment docs.

@nasdf nasdf requested a review from a team April 4, 2024 22:50
// IsNetworkAction returns true if the given action involves the network subsystem.
func IsNetworkAction(act any) bool {
switch act.(type) {
case ConfigureNode:
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: I don't think you need to check all of these? ConfigureNode is required for all P2P tests IIRC. Expecting all future network test actions to consistently be added to this switch seems a little optimistic to me and I would rather avoid the need if we can.

suggestion: If keeping all the actions in the switch, I think collapsing them into a single case might be easier to read:

switch act.(type) {
	case ConfigureNode,
	        ConnectPeers,
	        ConfigureReplicator,
	        etc...:
	      return true
}

Copy link
Member Author

Choose a reason for hiding this comment

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

I simplified it to just check for ConfigureNode.

Copy link
Contributor

@AndrewSisley AndrewSisley left a comment

Choose a reason for hiding this comment

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

LGTM :)

@nasdf nasdf merged commit 9938518 into sourcenetwork:develop Apr 5, 2024
30 of 31 checks passed
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add test flag to disable network tests
2 participants