diff options
author | Jaymala Sinha <jsinha@chef.io> | 2019-06-03 12:20:01 -0400 |
---|---|---|
committer | Jaymala Sinha <jsinha@chef.io> | 2019-06-04 17:12:02 -0400 |
commit | 763aa2ea6f0e76cd0b67a0c78aba085340031901 (patch) | |
tree | 1ec01fde00f6aadc32b192d12590b1b7cf05bbe7 | |
parent | c75acb8512b290e8531b33787b76789afdfaa435 (diff) | |
download | chef-763aa2ea6f0e76cd0b67a0c78aba085340031901.tar.gz |
Enable All BK verification tests
Signed-off-by: Jaymala Sinha <jsinha@chef.io>
-rw-r--r-- | .expeditor/verify.pipeline.yml | 350 | ||||
-rw-r--r-- | kitchen-tests/kitchen.yml | 2 | ||||
-rwxr-xr-x | scripts/bk_tests/bk_dokken_install.sh | 35 | ||||
-rwxr-xr-x | scripts/bk_tests/bk_install.sh | 2 | ||||
-rwxr-xr-x | scripts/bk_tests/bk_linux_exec.sh | 45 | ||||
-rw-r--r-- | spec/functional/resource/ifconfig_spec.rb | 2 |
6 files changed, 352 insertions, 84 deletions
diff --git a/.expeditor/verify.pipeline.yml b/.expeditor/verify.pipeline.yml index 86ff934af0..8db4226bd1 100644 --- a/.expeditor/verify.pipeline.yml +++ b/.expeditor/verify.pipeline.yml @@ -1,39 +1,43 @@ +--- +expeditor: + defaults: + buildkite: + timeout_in_minutes: 40 + steps: ######################################################################### # Tests Ruby 2.6 ######################################################################### -# - label: "Integration Specs :ruby: 2.6" -# commands: -# - /workdir/scripts/bk_tests/bk_install.sh -# - sed '/ip6/d' /etc/hosts > /etc/hosts.noip6 -# - cp /etc/hosts.noip6 /etc/hosts -# - cd /workdir; bundle install --without docgen integration omnibus_package --frozen -# - bundle exec rake spec:integration -# expeditor: -# executor: -# docker: -# environment: -# - FORCE_FFI_YAJL=ext -# - CHEF_LICENSE=accept-no-persist -# - INTEGRATION_SPECS_26=1 -# - BUNDLE_GEMFILE=/workdir/Gemfile -# -# - label: "Functional Specs :ruby: 2.6" -# commands: -# - /workdir/scripts/bk_tests/bk_install.sh -# - sed '/ip6/d' /etc/hosts > /etc/hosts.noip6 -# - cp /etc/hosts.noip6 /etc/hosts -# - cd /workdir; bundle install --without docgen integration omnibus_package --frozen -# - bundle exec rake spec:functional -# expeditor: -# executor: -# docker: -# environment: -# - FORCE_FFI_YAJL=ext -# - CHEF_LICENSE=accept-no-persist -# - FUNCTIONAL_SPECS_26=1 +- label: "Integration Specs :ruby: 2.6" + commands: + - /workdir/scripts/bk_tests/bk_install.sh + - cd /workdir; bundle install --without docgen integration omnibus_package --frozen --path vendor/bundle + - bundle exec rake spec:integration + expeditor: + executor: + docker: + privileged: true + environment: + - FORCE_FFI_YAJL=ext + - CHEF_LICENSE=accept-no-persist + - INTEGRATION_SPECS_26=1 + - BUNDLE_GEMFILE=/workdir/Gemfile + +- label: "Functional Specs :ruby: 2.6" + commands: + - /workdir/scripts/bk_tests/bk_install.sh + - cd /workdir; bundle install --without docgen integration omnibus_package --frozen --path vendor/bundle + - bundle exec rake spec:functional + expeditor: + executor: + docker: + privileged: true + environment: + - FORCE_FFI_YAJL=ext + - CHEF_LICENSE=accept-no-persist + - FUNCTIONAL_SPECS_26=1 - label: "Unit Specs :ruby: 2.6" commands: @@ -106,17 +110,6 @@ steps: environment: - TEST_GEM=chefspec/chefspec -# - label: "Test poise/halite gem :ruby: 2.6" -# commands: -# - /workdir/scripts/bk_tests/bk_install.sh -# - bundle install --jobs=3 --retry=3 --deployment --path=vendor/bundle -# - bundle exec tasks/bin/run_external_test poise/halite master rake spec -# expeditor: -# executor: -# docker: -# environment: -# - TEST_GEM=poise/halite - - label: "Test knife-windows gem :ruby: 2.6" commands: - /workdir/scripts/bk_tests/bk_install.sh @@ -132,37 +125,35 @@ steps: # Tests Ruby 2.5 ######################################################################### -# - label: "Integration Specs :ruby: 2.5" -# commands: -# - /workdir/scripts/bk_tests/bk_install.sh -# - asdf local ruby 2.5.5 -# - sed '/ip6/d' /etc/hosts > /etc/hosts.noip6 -# - cp /etc/hosts.noip6 /etc/hosts -# - bundle install --without docgen integration omnibus_package --frozen -# - bundle exec rake spec:integration -# expeditor: -# executor: -# docker: -# environment: -# - FORCE_FFI_YAJL=ext -# - CHEF_LICENSE=accept-no-persist -# - INTEGRATION_SPECS_25=1 +- label: "Integration Specs :ruby: 2.5" + commands: + - /workdir/scripts/bk_tests/bk_install.sh + - asdf local ruby 2.5.5 + - bundle install --without docgen integration omnibus_package --frozen + - bundle exec rake spec:integration + expeditor: + executor: + docker: + privileged: true + environment: + - FORCE_FFI_YAJL=ext + - CHEF_LICENSE=accept-no-persist + - INTEGRATION_SPECS_25=1 # -# - label: "Functional Specs :ruby: 2.5" -# commands: -# - asdf local ruby 2.5.5 -# - /workdir/scripts/bk_tests/bk_install.sh -# - sed '/ip6/d' /etc/hosts > /etc/hosts.noip6 -# - cp /etc/hosts.noip6 /etc/hosts -# - bundle install --without docgen integration omnibus_package --frozen -# - bundle exec rake spec:functional -# expeditor: -# executor: -# docker: -# environment: -# - FORCE_FFI_YAJL=ext -# - CHEF_LICENSE=accept-no-persist -# - FUNCTIONAL_SPECS_25=1 +- label: "Functional Specs :ruby: 2.5" + commands: + - asdf local ruby 2.5.5 + - /workdir/scripts/bk_tests/bk_install.sh + - bundle install --without docgen integration omnibus_package --frozen + - bundle exec rake spec:functional + expeditor: + executor: + docker: + privileged: true + environment: + - FORCE_FFI_YAJL=ext + - CHEF_LICENSE=accept-no-persist + - FUNCTIONAL_SPECS_25=1 - label: "Unit Specs :ruby: 2.5" commands: @@ -183,19 +174,214 @@ steps: # START TEST KITCHEN ONLY ######################################################################### -# - label: "Kitchen Tests :ruby: 2.5" +- label: "Kitchen Tests :amazon: 2 :ruby: 2.5" + commands: + - scripts/bk_tests/bk_linux_exec.sh + - cd kitchen-tests + - ~/.asdf/shims/bundle exec kitchen test end-to-end-amazonlinux-2 + artifact_paths: + - $PWD/.kitchen/logs/kitchen.log + env: + AMAZON: "2" + KITCHEN_YAML: kitchen.yml + expeditor: + executor: + linux: + privileged: true + single-use: true + +- label: "Kitchen Tests :amazon: 201X :ruby: 2.5" + commands: + - scripts/bk_tests/bk_linux_exec.sh + - cd kitchen-tests + - ~/.asdf/shims/bundle exec kitchen test end-to-end-amazonlinux-2 + artifact_paths: + - $PWD/.kitchen/logs/kitchen.log + env: + AMAZON: 201X + KITCHEN_YAML: kitchen.yml + expeditor: + executor: + linux: + privileged: true + single-use: true + +- label: "Kitchen Tests :ubuntu: 16.04 :ruby: 2.5" + commands: + - scripts/bk_tests/bk_linux_exec.sh + - cd kitchen-tests + - ~/.asdf/shims/bundle exec kitchen test end-to-end-ubuntu-1604 + artifact_paths: + - $PWD/.kitchen/logs/kitchen.log + env: + UBUNTU: "16.04" + KITCHEN_YAML: kitchen.yml + expeditor: + executor: + linux: + privileged: true + single-use: true + +- label: "Kitchen Tests :ubuntu: 18.04 :ruby: 2.5" + commands: + - scripts/bk_tests/bk_linux_exec.sh + - cd kitchen-tests + - ~/.asdf/shims/bundle exec kitchen test end-to-end-ubuntu-1804 + artifact_paths: + - $PWD/.kitchen/logs/kitchen.log + env: + UBUNTU: "18.04" + KITCHEN_YAML: kitchen.yml + expeditor: + executor: + linux: + privileged: true + single-use: true + +- label: "Kitchen Tests :debian: 8 :ruby: 2.5" + commands: + - scripts/bk_tests/bk_linux_exec.sh + - cd kitchen-tests + - ~/.asdf/shims/bundle exec kitchen test end-to-end-debian-8 + artifact_paths: + - $PWD/.kitchen/logs/kitchen.log + env: + DEBIAN: "8" + KITCHEN_YAML: kitchen.yml + expeditor: + executor: + linux: + privileged: true + single-use: true + +- label: "Kitchen Tests :debian: 9 :ruby: 2.5" + commands: + - scripts/bk_tests/bk_linux_exec.sh + - cd kitchen-tests + - ~/.asdf/shims/bundle exec kitchen test end-to-end-debian-9 + artifact_paths: + - $PWD/.kitchen/logs/kitchen.log + env: + DEBIAN: "9" + KITCHEN_YAML: kitchen.yml + expeditor: + executor: + linux: + privileged: true + single-use: true + +- label: "Kitchen Tests :debian: 10 :ruby: 2.5" + commands: + - scripts/bk_tests/bk_linux_exec.sh + - cd kitchen-tests + - ~/.asdf/shims/bundle exec kitchen test end-to-end-debian-10 + artifact_paths: + - $PWD/.kitchen/logs/kitchen.log + env: + DEBIAN: "10" + KITCHEN_YAML: kitchen.yml + expeditor: + executor: + linux: + privileged: true + single-use: true + +- label: "Kitchen Tests :centos: 6 :ruby: 2.5" + commands: + - scripts/bk_tests/bk_linux_exec.sh + - cd kitchen-tests + - ~/.asdf/shims/bundle exec kitchen test end-to-end-centos-6 + artifact_paths: + - $PWD/.kitchen/logs/kitchen.log + env: + CENTOS: "6" + KITCHEN_YAML: kitchen.yml + expeditor: + executor: + linux: + privileged: true + single-use: true + +- label: "Kitchen Tests :centos: 7 :ruby: 2.5" + commands: + - scripts/bk_tests/bk_linux_exec.sh + - cd kitchen-tests + - ~/.asdf/shims/bundle exec kitchen test end-to-end-centos-7 + artifact_paths: + - $PWD/.kitchen/logs/kitchen.log + env: + CENTOS: "7" + KITCHEN_YAML: kitchen.yml + expeditor: + executor: + linux: + privileged: true + single-use: true + +- label: "Kitchen Tests :fedora: latest :ruby: 2.5" + commands: + - scripts/bk_tests/bk_linux_exec.sh + - cd kitchen-tests + - ~/.asdf/shims/bundle exec kitchen test end-to-end-fedora-latest + artifact_paths: + - $PWD/.kitchen/logs/kitchen.log + env: + FEDORA: "latest" + KITCHEN_YAML: kitchen.yml + expeditor: + executor: + linux: + privileged: true + single-use: true + +- label: "Kitchen Tests OPENSUSELEAP: 42 :ruby: 2.5" + commands: + - scripts/bk_tests/bk_linux_exec.sh + - cd kitchen-tests + - ~/.asdf/shims/bundle exec kitchen test end-to-end-opensuse-leap + artifact_paths: + - $PWD/.kitchen/logs/kitchen.log + env: + OPENSUSELEAP: "42" + KITCHEN_YAML: kitchen.yml + expeditor: + executor: + linux: + privileged: true + single-use: true + +######################################################################### + # RSpec Tests +######################################################################### +# - label: "Kitchen Tests :rspec: :centos: 7 :ruby: 2.5" +# commands: +# - scripts/bk_tests/bk_linux_exec.sh +# - cd kitchen-tests +# - ~/.asdf/shims/bundle exec kitchen test rspec-centos-7 +# artifact_paths: +# - $PWD/.kitchen/logs/kitchen.log +# env: +# RSPEC_CENTOS: "7" +# KITCHEN_YAML: kitchen.yml +# expeditor: +# executor: +# linux: +# privileged: true +# single-use: true + +# - label: "Kitchen Tests :rspec: OPENSUSELEAP: 42 :ruby: 2.5" # commands: -# - /workdir/scripts/bk_tests/bk_install.sh -# - asdf local ruby 2.5.5 -# - sed '/ip6/d' /etc/hosts > /etc/hosts.noip6 -# - cp /etc/hosts.noip6 /etc/hosts -# - cd /workdir/kitchen-tests -# - bundle install --jobs=3 --retry=3 --path=vendor/bundle -# - bundle exec kitchen test end-to-end-amazonlinux-2 +# - /workdir/scripts/bk_tests/bk_dokken_install.sh +# - bundle install --without docgen integration omnibus_package --frozen --path vendor/bundle +# - bundle exec rspec +# artifact_paths: +# - $PWD/.kitchen/logs/kitchen.log # expeditor: # executor: # docker: +# image: "dokken/opensuse-leap" # environment: -# - AMAZON=2 -# - KITCHEN_YAML=/workdir/kitchen-tests/kitchen.bk.yml -# - BUNDLE_GEMFILE=/workdir/kitchen-tests/Gemfile +# - RSPEC_OPENSUSELEAP="42" +# - FORCE_FFI_YAJL=ext +# - CHEF_LICENSE="accept-silent" +# - PATH=~/.asdf/shims:/opt/asdf/bin:/opt/asdf/shims:/opt/omnibus-toolchain/embedded/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
\ No newline at end of file diff --git a/kitchen-tests/kitchen.yml b/kitchen-tests/kitchen.yml index ee157926f6..944767eada 100644 --- a/kitchen-tests/kitchen.yml +++ b/kitchen-tests/kitchen.yml @@ -21,7 +21,7 @@ lifecycle: - remote: /opt/chef/embedded/bin/ohai -v - remote: /opt/chef/embedded/bin/gem install appbundler appbundle-updater - remote: /opt/chef/embedded/bin/appbundle-updater chef ohai <%= File.readlines('../Gemfile.lock', File.expand_path(File.dirname(__FILE__))).find { |l| l =~ /^\s+ohai \((\d+\.\d+\.\d+)\)/ }; 'v' + $1 %> --tarball --github chef/ohai - - remote: /opt/chef/embedded/bin/appbundle-updater chef chef <%= ENV['TRAVIS_COMMIT'] || %x(git rev-parse HEAD).chomp %> --tarball --github chef/chef + - remote: /opt/chef/embedded/bin/appbundle-updater chef chef <%= ENV['BUILDKITE_COMMIT'] || %x(git rev-parse HEAD).chomp %> --tarball --github chef/chef - remote: echo "Installed Chef / Ohai release:" - remote: /opt/chef/embedded/bin/chef-client -v - remote: /opt/chef/embedded/bin/ohai -v diff --git a/scripts/bk_tests/bk_dokken_install.sh b/scripts/bk_tests/bk_dokken_install.sh new file mode 100755 index 0000000000..3dd03deecf --- /dev/null +++ b/scripts/bk_tests/bk_dokken_install.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# Install omnibus-toolchain for git bundler and gem +curl -fsSL https://chef.io/chef/install.sh | sudo bash -s -- -P omnibus-toolchain + +# Set Environment Variables +export BUNDLE_GEMFILE=$PWD/kitchen-tests/Gemfile +export FORCE_FFI_YAJL=ext +export CHEF_LICENSE="accept-silent" +export PATH=/opt/asdf/bin:/opt/asdf/shims:/opt/omnibus-toolchain/embedded/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + +# Install Dev tools +sudo yum install -y gcc gcc-c++ openssl-devel readline-devel zlib-devel iptables +sudo zypper install -y gcc gcc-c++ openssl-devel readline-devel zlib-devel iptables + +# Install ASDF software manager +echo "--- Installing ASDF software version manager from master" +sudo /opt/omnibus-toolchain/embedded/bin/git clone https://github.com/asdf-vm/asdf.git /opt/asdf +. /opt/asdf/asdf.sh +. /opt/asdf/completions/asdf.bash + +echo "--- Installing Ruby ASDF plugin" +/opt/asdf/bin/asdf plugin-add ruby https://github.com/asdf-vm/asdf-ruby.git + +echo "--- Installing Ruby 2.5.5" +/opt/asdf/bin/asdf install ruby 2.5.5 +/opt/asdf/bin/asdf global ruby 2.5.5 + +# Update Gems +gem update --system $(grep rubygems omnibus_overrides.rb | cut -d'"' -f2) +gem install bundler -v $(grep :bundler omnibus_overrides.rb | cut -d'"' -f2) --force --no-document +sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER ) +ruby --version +which bundle +bundle install --jobs=3 --retry=3 --path=vendor/bundle
\ No newline at end of file diff --git a/scripts/bk_tests/bk_install.sh b/scripts/bk_tests/bk_install.sh index de74af151c..e8fefc2d02 100755 --- a/scripts/bk_tests/bk_install.sh +++ b/scripts/bk_tests/bk_install.sh @@ -1,3 +1,5 @@ +apt-get update -y && apt-get install -y net-tools iproute2 +touch /etc/network/interfaces gem update --system $(grep rubygems omnibus_overrides.rb | cut -d'"' -f2) gem --version gem uninstall bundler -a -x || true diff --git a/scripts/bk_tests/bk_linux_exec.sh b/scripts/bk_tests/bk_linux_exec.sh new file mode 100755 index 0000000000..fee73aa6bb --- /dev/null +++ b/scripts/bk_tests/bk_linux_exec.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +# Enable IPv6 in docker +sudo systemctl stop docker +echo "Enabling IPv6 in Docker config" +dockerd_config="/etc/docker/daemon.json" +sudo echo "$(jq '. + {"ipv6": true, "fixed-cidr-v6": "2001:2019:6002::/80", "ip-forward": false}' $dockerd_config)" > $dockerd_config +sudo systemctl start docker + +# Verify Docker Is Running +docker version +sudo service docker status + +# Install C and C++ +sudo yum install -y gcc gcc-c++ openssl-devel readline-devel zlib-devel + +# Install omnibus-toolchain for git bundler and gem +curl -fsSL https://chef.io/chef/install.sh | sudo bash -s -- -P omnibus-toolchain + +# Set Environment Variables +export BUNDLE_GEMFILE=$PWD/kitchen-tests/Gemfile +export FORCE_FFI_YAJL=ext +export CHEF_LICENSE="accept-silent" +export PATH=$PATH:~/.asdf/shims:/opt/asdf/bin:/opt/asdf/shims:/opt/omnibus-toolchain/embedded/bin + +# Install ASDF software manager +echo "--- Installing ASDF software version manager from master" +sudo git clone https://github.com/asdf-vm/asdf.git /opt/asdf +. /opt/asdf/asdf.sh +. /opt/asdf/completions/asdf.bash + +echo "--- Installing Ruby ASDF plugin" +/opt/asdf/bin/asdf plugin-add ruby https://github.com/asdf-vm/asdf-ruby.git + +echo "--- Installing Ruby 2.5.5" +/opt/asdf/bin/asdf install ruby 2.5.5 +/opt/asdf/bin/asdf global ruby 2.5.5 + +# Update Gems +gem update --system $(grep rubygems omnibus_overrides.rb | cut -d'"' -f2) +gem install bundler -v $(grep :bundler omnibus_overrides.rb | cut -d'"' -f2) --force --no-document +sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER ) +ruby --version +which bundle +bundle install --jobs=3 --retry=3 --path=vendor/bundle
\ No newline at end of file diff --git a/spec/functional/resource/ifconfig_spec.rb b/spec/functional/resource/ifconfig_spec.rb index c52a4c0694..10ebcaf8b6 100644 --- a/spec/functional/resource/ifconfig_spec.rb +++ b/spec/functional/resource/ifconfig_spec.rb @@ -53,7 +53,7 @@ describe Chef::Resource::Ifconfig, :requires_root, :skip_travis, external: inclu end def fetch_first_interface_name - shell_out("ip link list |grep UP|grep -vi loop|head -1|cut -d':' -f 2").stdout.strip + shell_out("ip link list |grep UP|grep -vi loop|head -1|cut -d':' -f 2 |cut -d'@' -f 1").stdout.strip end # **Caution: any updates to core interfaces can be risky. |