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

Running test in debug mode on Rust Rover #306

Open
invent360 opened this issue Oct 3, 2023 · 2 comments
Open

Running test in debug mode on Rust Rover #306

invent360 opened this issue Oct 3, 2023 · 2 comments
Assignees
Labels
k::api Related to API (application interface) question Further information is requested

Comments

@invent360
Copy link

invent360 commented Oct 3, 2023

Sorry if this is an IDE issue but any clue of running test on debug mode ?
Steps

  1. click on "Debug Test execute"
Screenshot 2023-10-04 at 03 32 15 Screenshot 2023-10-04 at 03 32 04

start_app() basically establishes a db connection and starts a server on a different thread

async fn start_app() {
    let pool = PgPool::connect("postgres://<user>:<password>@localhost:<port>/db")
        .await
        .expect("Failed to connect to database");

    let server = run(pool.clone()).expect("Something terrible happened while starting server");

    let _ = tokio::spawn(server);
}

Result:
DB connection is successfully established and server starts up but the following error is thrown

_Testing started at 03:26 ...
/Users/<local_path>/target/debug/deps/unit_test-28a3ee7b4f33429a execute --format=json --exact -Z unstable-options --show-output
error: unexpected argument 'execute' found

Usage: unit_test-28a3ee7b4f33429a [OPTIONS]

For more information, try '--help'.

Process finished with exit code 2_

Note:
Test runs well without errors when executed on command lines as follows
cargo test -p nubia --test unit_test

@tyranron tyranron added question Further information is requested k::api Related to API (application interface) labels Oct 10, 2023
@tyranron
Copy link
Member

tyranron commented Oct 10, 2023

@invent360 I guess Unit::run() by default tries to parse CLI args, and execute --format=json --exact -Z unstable-options --show-output is not something expected by it. You should specify cli::Args manually in this case, because you're running tests harness = false. See this chapter of the Book, .with_cli() docs and .with_default_cli() docs.

@tyranron
Copy link
Member

Also, similar question was discussed here: #294

@tyranron tyranron self-assigned this Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
k::api Related to API (application interface) question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants