diff --git a/tests/compose.sh b/tests/compose.sh index 1f388262..ebe316ad 100755 --- a/tests/compose.sh +++ b/tests/compose.sh @@ -47,18 +47,49 @@ if [ ! -d compose-cache ]; then rm -rf manifests/ popd # config - if ! has_compose_privileges; then - # Unlike cosa, we don't need as much flexibility since we don't e.g. build - # images. So just create the supermin appliance and root now so each test - # doesn't have to build it. - mkdir -p supermin.{prepare,build} - # we just import the strict minimum here that rpm-ostree needs - rpms="rpm-ostree bash rpm-build coreutils selinux-policy-targeted dhcp-client util-linux" - # shellcheck disable=SC2086 - supermin --prepare --use-installed -o supermin.prepare $rpms - # the reason we do a heredoc here is so that the var substition takes - # place immediately instead of having to proxy them through to the VM - cat > init < config/cache.repo + + pushd config + python3 -c ' +import sys, json +y = json.load(sys.stdin) +y["repos"] = ["cache"] +y["postprocess"] = [] +y.pop("lockfile-repos", None) +json.dump(y, sys.stdout)' < manifest.json > manifest.json.new + mv manifest.json{.new,} + git add . + git -c user.email="composetest@localhost.com" -c user.name="composetest" \ + commit -am 'modifications for tests' + popd # config + + popd # compose-cache +fi + +if ! has_compose_privileges; then + pushd compose-cache + + # Unlike cosa, we don't need as much flexibility since we don't e.g. build + # images. So just create the supermin appliance and root now so each test + # doesn't have to build it. + mkdir -p supermin.{prepare,build} + # we just import the strict minimum here that rpm-ostree needs + rpms="rpm-ostree bash rpm-build coreutils selinux-policy-targeted dhcp-client util-linux" + # shellcheck disable=SC2086 + supermin --prepare --use-installed -o supermin.prepare $rpms + # the reason we do a heredoc here is so that the var substition takes + # place immediately instead of having to proxy them through to the VM + cat > init < config/cache.repo - - pushd config - python3 -c ' -import sys, json -y = json.load(sys.stdin) -y["repos"] = ["cache"] -y["postprocess"] = [] -y.pop("lockfile-repos", None) -json.dump(y, sys.stdout)' < manifest.json > manifest.json.new - mv manifest.json{.new,} - git add . - git -c user.email="composetest@localhost.com" -c user.name="composetest" \ - commit -am 'modifications for tests' - popd # config + chmod a+x init + tar -czf supermin.prepare/init.tar.gz --remove-files init + supermin --build "${fixtures}/supermin.prepare" --size 5G -f ext2 -o supermin.build popd # compose-cache fi