tests: Make the deployment mutable in test-sysroot.js
authorMatthew Leeds <matthew.leeds@endlessm.com>
Wed, 30 Aug 2017 19:06:45 +0000 (12:06 -0700)
committerAtomic Bot <atomic-devel@projectatomic.io>
Thu, 31 Aug 2017 11:57:46 +0000 (11:57 +0000)
We attempt to make deployments mutable in the test suite (as opposed to
immutable which is the default) to make it easier to chmod and clean up
the tmp files after each test. This is normally accomplished by setting
OSTREE_SYSROOT_DEBUG=mutable-deployments in libtest.sh, but that only
affects the environment variables for that bash instance, not the
process running gjs. So in test-sysroot.js OSTREE_SYSROOT_DEBUG wasn't
set when sysroot.deploy_tree() was called, which means the deployment
was made immutable which eventually causes the test to fail. This only
occurs when the test is run by the root user because for non-root users
_ostree_linuxfs_fd_alter_immutable_flag() would silently fail and the
deployment would be mutable.

This commit fixes this issue by setting the environment variable in
tests/test-sysroot.js.

Closes: #1122
Approved by: cgwalters

tests/test-sysroot.js

index d7d3dab3c68c36a6283aee5d527d1adac3ae94bb..4da55d0fc37667bd90d5b9cbeae509d6da7cc61e 100755 (executable)
@@ -42,6 +42,8 @@ print('1..1')
 
 libtestExec('setup_os_repository archive-z2 syslinux');
 
+GLib.setenv("OSTREE_SYSROOT_DEBUG", "mutable-deployments", true);
+
 let upstreamRepo = OSTree.Repo.new(Gio.File.new_for_path('testos-repo'));
 upstreamRepo.open(null);