[libvirt] [PATCH] tests: Avoid writing into $HOME during virsh-snapshot

Daniel P. Berrangé berrange at redhat.com
Thu Mar 28 09:41:38 UTC 2019


On Wed, Mar 27, 2019 at 01:47:37PM -0500, Eric Blake wrote:
> In a constrained CI environment, where it is intentional that attempts
> to write outside the current directory will fail, virsh-snapshot was
> failing:
> 
> @@ -1,2 +1,3 @@
>  error: invalid argument: parent s3 for snapshot s2 not found
>  error: marker
> +error: Failed to create '/home/travis/.cache/libvirt/virsh': Permission denied
> FAIL virsh-snapshot (exit status: 1)
> 
> But we've already solved the problem in virsh-uriprecedence: tell
> virsh to use XDG locations pointing to somewhere we can write rather
> than its default of falling back to $HOME with the test being at risk
> of breaking due to the user's environment and/or unacceptably altering
> the user's normal cache.  Hoist that solution into test-lib.sh, so
> that all scripts can use it as needed.

Ahhh, I was wondering why other tests didn't fail for the same reason.
In fact I wonder if more virsh tests are triggering this, but simply
ignoring the error.

> 
> Fixes: 280a2b41e
> Reported-by: Daniel P. Berrangé <berrange at redhat.com>
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
>  tests/test-lib.sh         | 13 +++++++++++++
>  tests/virsh-snapshot      |  2 ++
>  tests/virsh-uriprecedence | 12 +-----------
>  3 files changed, 16 insertions(+), 11 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange at redhat.com>


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