Skip to content

feat(cli): added cli validator tests#286

Open
PoulavBhowmick03 wants to merge 14 commits intomainfrom
poulav/cmd_validator_tests
Open

feat(cli): added cli validator tests#286
PoulavBhowmick03 wants to merge 14 commits intomainfrom
poulav/cmd_validator_tests

Conversation

@PoulavBhowmick03
Copy link
Copy Markdown
Collaborator

Closes #237

  • Adds ping_test, ping_test, ping_load_test to cli/src/commands/test/validator.rs
  • All tests pass
    odinson charon-rs$pluto alpha test validator
 __      __     _  _      _         _                                     
 \ \    / /    | |(_,    | |       | |                              /\    
  \ \  / /__ _ | | _   __| |  __ _ | |_  ___   _ __                /  \   
   \ \/ // _` || || | / _` | / _` || __|/ _ \ | '__|              / /\ \  
    \  /| (_| || || || (_| || (_| || |_| (_) || |                / ____ \ 
     \/  \__,_||_||_| \__,_| \__,_| \__|\___/ |_|               /_/    \_\

TEST NAME                                                       RESULT

127.0.0.1:3600
Ping                                                            OK
PingMeasure                                                88µs Good
PingLoad                                                    2ms Good

5.0015415s

Comment thread crates/cli/src/commands/test/validator.rs
Comment thread crates/cli/src/commands/test/validator.rs Outdated
Comment thread crates/cli/src/commands/test/validator.rs Outdated
@PoulavBhowmick03 PoulavBhowmick03 changed the title feat: added cli validator tests feat(cli): added cli validator tests Mar 18, 2026
Comment thread crates/cli/src/commands/test/validator.rs Outdated
Comment thread crates/cli/src/commands/test/validator.rs Outdated
Comment thread crates/cli/src/commands/test/validator.rs Outdated
Copy link
Copy Markdown
Collaborator

@emlautarom1 emlautarom1 left a comment

Choose a reason for hiding this comment

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

Couple of small things. Main thing missing are tests for these commands: I did validate them by using nc though and they seem to work as intended.

Either add the tests in this PR, or create an associated PR with the tests (prefer the former).

Comment thread crates/cli/src/commands/test/validator.rs Outdated
Comment thread crates/cli/src/commands/test/validator.rs Outdated
Comment thread crates/cli/src/commands/test/validator.rs Outdated
Comment thread crates/cli/src/commands/test/validator.rs Outdated
Comment thread crates/cli/src/commands/test/validator.rs
Comment thread crates/cli/src/commands/test/validator.rs Outdated
Comment thread crates/cli/src/commands/test/validator.rs Outdated
Comment thread crates/cli/src/commands/test/validator.rs Outdated
Comment thread crates/cli/src/commands/test/validator.rs Outdated
Comment thread crates/cli/src/commands/test/validator.rs Outdated
varex83agent and others added 2 commits April 15, 2026 10:42
- Replace `name()` method with `fmt::Display` impl on `ValidatorTestCase`
- Initialize tracing with `pluto_tracing::init` in `run`
- Move `start_time` immediately before `run_tests_with_timeout`
- Fix `ERR_TIMEOUT_INTERRUPTED` message to `"timeout/interrupted"`
- Replace `checked_add`/`expect` with `Duration::saturating_sub` for timeout tracking
- Remove outer `tokio::spawn` in `ping_load_test`; use a scoped block so the
  `JoinSet` is dropped (aborting workers) on timeout cancellation
- Use `workers.join_all().await` instead of manual `join_next` loop
- Change `ping_continuously` signature to `impl AsRef<str>`
- Remove unnecessary `drop(conn)` before `return`
- Qualify `super::` helper functions instead of importing them directly

Co-Authored-By: Bohdan Ohorodnii <35969035+varex83@users.noreply.github.com>
All entries are transitive dependencies that cannot be immediately
upgraded. None are reachable from Pluto's production code paths.

Co-Authored-By: Bohdan Ohorodnii <35969035+varex83@users.noreply.github.com>
Copy link
Copy Markdown
Collaborator

@varex83agent varex83agent left a comment

Choose a reason for hiding this comment

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

All review comments have been addressed.

Conflict resolutions:
- deny.toml: keep advisory ignores from this branch (superset of main)
- validator.rs: keep full implementation from this branch (main still has stub)
- mod.rs: keep dynamic ValidatorTestCase iterator from this branch;
  adopt beacon::test_case_names() from main

Co-Authored-By: Bohdan Ohorodnii <35969035+varex83@users.noreply.github.com>
Copy link
Copy Markdown
Collaborator

@emlautarom1 emlautarom1 left a comment

Choose a reason for hiding this comment

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

Two small things, then we can merge.

Comment thread deny.toml Outdated
Comment thread crates/cli/src/commands/test/validator.rs Outdated
Comment thread crates/cli/src/commands/test/validator.rs
- Add CancellationToken to validator::run and run_tests_with_timeout;
  use tokio::select! so Ctrl+C (SIGINT) cancels in-progress tests
- Replace ERR_TIMEOUT_INTERRUPTED string const with CliError::TimeoutInterrupted
  and CliError::Other("test case not supported") with CliError::TestCaseNotSupported;
  remove leading underscore from both variants in the error enum
- Remove RUSTSEC advisory ignores added to deny.toml; run cargo update
  instead — all seven advisories are resolved by updated transitive deps

Co-Authored-By: Bohdan Ohorodnii <35969035+varex83@users.noreply.github.com>
@varex83 varex83 requested a review from emlautarom1 April 15, 2026 15:38
Comment on lines +317 to +322
Ok(Err(e)) => {
tracing::warn!(target = %address, error = ?e, "Ping connection attempt failed during load test");
}
Err(e) => {
tracing::warn!(target = %address, error = ?e, "Ping connection attempt timed out during load test");
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

In charon, when dial has error, it will stop the loop

		conn, err := d.DialContext(ctx, "tcp", address)
		if err != nil {
			return
		}

This can affect the score later

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.

Implement cli test validator

5 participants