Add CI scripts

Add CI scripts for:
- lint
- syntax 3 and 4
- unit
- beaker

Change-Id: I38dd2000996d20ebe51bd64fb831c5b352439eec
This commit is contained in:
Emilien Macchi 2016-07-20 12:23:17 -04:00
parent 4ac65a2f02
commit 54c4715f1c
5 changed files with 116 additions and 0 deletions

16
functions Normal file
View File

@ -0,0 +1,16 @@
#!/bin/bash
#
# functions - puppet-openstack_spec_helper specific functions
#
install_module() {
if [ -e /usr/zuul-env/bin/zuul-cloner ] ; then
/usr/zuul-env/bin/zuul-cloner --cache-dir /opt/git \
git://git.openstack.org openstack/puppet-openstack-cookiecutter
else
git clone git://git.openstack.org/openstack/puppet-openstack-cookiecutter openstack/puppet-openstack-cookiecutter
fi
cd openstack/puppet-openstack-cookiecutter
source functions
prepare_environment
}

25
run_beaker_tests.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash -ex
# Copyright 2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
export SCRIPT_DIR=$(cd `dirname $0` && pwd -P)
source $SCRIPT_DIR/functions
install_module
# run beaker tests
export BEAKER_set=nodepool-centos7
export BEAKER_debug=yes
export BEAKER_color=no
$GEM_HOME/bin/bundle exec rspec spec/acceptance

22
run_lint_tests.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash -ex
# Copyright 2016 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
export SCRIPT_DIR=$(cd `dirname $0` && pwd -P)
source $SCRIPT_DIR/functions
install_module
# run unit tests
$GEM_HOME/bin/bundle exec rake lint

31
run_syntax_tests.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash -ex
# Copyright 2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
export SCRIPT_DIR=$(cd `dirname $0` && pwd -P)
source $SCRIPT_DIR/functions
export PUPPET_VERSION=${PUPPET_VERSION:-4}
PUPPET_MAJOR_VERSION=`echo $PUPPET_VERSION | cut -c 1`
export PUPPET_GEM_VERSION="~> $PUPPET_MAJOR_VERSION"
if [ "$PUPPET_MAJOR_VERSION" -lt "4" ]; then
export FUTURE_PARSER=${FUTURE_PARSER:-yes}
else
export FUTURE_PARSER=${FUTURE_PARSER:-no}
fi
install_module
# run unit tests
$GEM_HOME/bin/bundle exec rake syntax

22
run_unit_tests.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash -ex
# Copyright 2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
export SCRIPT_DIR=$(cd `dirname $0` && pwd -P)
source $SCRIPT_DIR/functions
install_module
# run unit tests
$GEM_HOME/bin/bundle exec rake spec SPEC_OPTS='--format documentation'