← Back to team overview

cloud-init-dev team mailing list archive

Re: [Merge] ~powersj/cloud-init:create-centos-tests into cloud-init:master

 


Diff comments:

> diff --git a/tools/test-centos-run.sh b/tools/test-centos-run.sh
> new file mode 100755
> index 0000000..13cde62
> --- /dev/null
> +++ b/tools/test-centos-run.sh
> @@ -0,0 +1,47 @@
> +#!/bin/bash

do we want to run this under set -e ?  I see a mix of error catching for some things, but not for others.

> +# This file is part of cloud-init. See LICENSE file for license information.
> +set -ux
> +
> +version=${1:-7}    

70? whats convention we'll use for the point releases?

> +name="cloud-init-centos-$version"
> +src="images:centos/$version"
> +tarball='cloud-init.tar.gz'
> +user='centos'
> +
> +error() { echo "$@" 1>&2; }
> +fail() { [ $# -eq 0 ] || error "$@"; exit 1; }
> +info() { echo "$@"; }
> +
> +# Create tarball of current directory, with git info
> +cd "$(git rev-parse --show-toplevel)" ||
> +    fail "failed: changing to top level directory"
> +tar_folder=${PWD##*/}
> +cd ..
> +tar -czvf "$tarball" "$tar_folder" || 
> +    fail "failed: creating tarball"
> +cd "$tar_folder/tools" ||
> +    fail "failed: changing directory"
> +
> +lxc stop "$name" && lxc delete "$name"
> +lxc launch "$src" "$name"
> +
> +# need to wait for networking
> +sleep 10

this seems unfortunate... are we in a container?  what's the environment?

> +
> +lxc exec "$name" -- useradd "$user"
> +lxc exec "$name" -- /bin/sh <test-centos-setup.sh ||
> +    fail "failed: setting up container"
> +lxc file push "../../$tarball" "$name"/home/"$user"/
> +lxc exec "$name" -- chown "$user:$user" $tarball
> +lxc exec "$name" -- su "$user" -c "cd /home/$user; tar xvfz /home/$user/$tarball" ||

tar -C /home/$user -xzf /home/$user/$tarball

tar can cd for you, and dropping the verbose should speed things up;  as long as we retain the tarball in artifacts, we can expand contents later for debugging

> +    fail "failed: extracting tarball"
> +
> +lxc exec "$name" -- su "$user" -c "cd /home/$user/$tar_folder; nosetests tests/unittests"
> +exit_1=$?
> +lxc exec "$name" -- su "$user" -c "cd /home/$user/$tar_folder; ./packages/brpm -v"
> +exit_2=0
> +
> +lxc stop "$name"
> +lxc delete "$name"
> +
> +! (( exit_1 || exit_2 ))


-- 
https://code.launchpad.net/~powersj/cloud-init/+git/cloud-init/+merge/324982
Your team cloud-init commiters is requested to review the proposed merge of ~powersj/cloud-init:create-centos-tests into cloud-init:master.


References