Integration test times out while debugging

I'm writing an integration test and trying to debug it with the debugger in VSCode. It works but it times out after 60 seconds, which makes it hard to use. It times out with the panic:

my_test' panicked at 'test my_test ... test my_test has been running for over 60 seconds

Is there a way to increase or disable the timeout with a command-line argument?

It's not a timeout, only a warning. The test may succeed if it finishes eventually.

You can add

[profile.test] # fixed
opt-level = 2

to Cargo.toml to have optimized tests, so hopefully it'll run quicker.

1 Like

Thanks @kornel! That solves my immediate problem. I would like to do it without changing my Cargo.toml file. Do you know if it is possible to pass that as an environment variable or a switch on the command-line?

I spoke too soon. It still timed out. I also get the following message:

warning: unused manifest key: profiles

I put the line after the [package] in my Cargo.toml file but it doesn't seem to be used?

It should be profile, not profiles. See docs.

1 Like

Thanks @Riateche! Cargo doesn't complain about the unused manifest key anymore.

I still see the warning the test has been running for over 60 seconds. Do you know if it is a feature in cargo, the test attribute or something else?


cargo test --release

uses release profile for tests.

If your test is really that big/slow, try splitting it into multiple smaller tests. They'll be run in parallel.

AIUI the point is not whether the test is big/slow, but rather that they are stepping through it with an interactive debugger -- artificially slowing it down.

Still, I don't know of any way to remove that warning.

It's hard-coded in the test framework:

1 Like

You're right @cuviper, I'm artificially slowing down the test by stepping through it.

Thanks for finding the code! Too bad it's not an environment variable.