[libvirt] [PATCH rust 1/5] fix bug integration test with rust multithreading

Daniel P. Berrangé berrange at redhat.com
Fri Jul 5 08:47:14 UTC 2019


On Thu, Jul 04, 2019 at 12:15:25PM +0200, Sahid Orentino Ferdjaoui wrote:
> The open_auth test cases were randomly failling. It seems that because
> tests are executed in parallel if a sasl connection is open when an
> other happen in same time from the same libvirt connection an error
> happens: "Failed to start SASL negotiation: -4 (SASL(-4): no mechanism
> available: No worthy mechs found)".

This doesn't really make sense. Libvirt itself is fully multi-threaded
so it should be fine to be opening connections in parallel.

If there's a non-deterministic failure happening this suggests a race
condition bug somewhere, which shouldn't just be ignored by changing
the tests to avoid hitting the race,

> 
> Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui at canonical.com>
> ---
>  tests/integration_qemu.rs | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/integration_qemu.rs b/tests/integration_qemu.rs
> index 49e07c4..7db43d5 100644
> --- a/tests/integration_qemu.rs
> +++ b/tests/integration_qemu.rs
> @@ -89,6 +89,16 @@ fn test_create_storage_pool_and_vols() {
>  #[test]
>  #[ignore]
>  fn test_connection_with_auth() {
> +    // Rust is excecuting tests in parallel (threads), if a sasl
> +    // connection is open when an other happen in same time from the
> +    // same libvirt connection an error happens: "Failed to start SASL
> +    // negotiation: -4 (SASL(-4): no mechanism available: No worthy
> +    // mechs found)".
> +    connection_with_auth_ok();
> +    connection_with_auth_wrong();
> +}
> +
> +fn connection_with_auth_ok() {
>      fn callback(creds: &mut Vec<ConnectCredential>) {
>          for cred in creds {
>              match cred.typed {
> @@ -118,10 +128,7 @@ fn test_connection_with_auth() {
>      }
>  }
>  
> -
> -#[test]
> -#[ignore]
> -fn test_connection_with_auth_wrong() {
> +fn connection_with_auth_wrong() {
>      fn callback(creds: &mut Vec<ConnectCredential>) {
>          for cred in creds {
>              match cred.typed {
> -- 
> 2.20.1
> 

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list