Commit d6860d72 authored by Dorian Krefft's avatar Dorian Krefft

Added kitchen tests in the CI/CD

parent 81b720b8
......@@ -9,14 +9,36 @@ local-tests:
- delivery local verify
coverage: '/Touch\s+Coverage:\s+(\d+\.\d+)%/'
#integration-tests:
# stage: test
# before_script:
# - gem install kitchen-docker
# script:
# - kitchen test -d
# only:
# - master
kitchen-tests:
services:
- docker:dind
stage: test
image: sbernard/arch-kitchen-docker
tags:
- docker
variables:
DOCKER_HOST: tcp://docker:2375
before_script:
# Taken from https://gitlab.com/chef-platform/test-cookbook/raw/master/.gitlab-ci.yml
- bundle install
- mkdir -p /mnt/host
- mount $(df $CI_PROJECT_DIR --output=source | tail -n 1) /mnt/host
- ln -s /mnt/host/lib/modules /lib/modules
- >
if [ ! -e /var/run/docker.sock ]; then
if [ ! -d /var/lib/docker ]; then
mkdir -p $(dirname $CI_PROJECT_DIR)/varlibdocker;
ln -s $(dirname $CI_PROJECT_DIR)/varlibdocker /var/lib/docker
fi;
DOCKER_DRIVER=overlay2 dockerd &
fi
- if ! docker network ls | grep -q "kitchen"; then
docker network create --driver bridge -o "com.docker.network.driver.mtu=1400" kitchen;
fi
script:
- bundle exec kitchen test -d always
only:
- master
release:
stage: deploy
......
---
driver:
name: docker
name: docker_cli
volume: /sys/fs/cgroup:/sys/fs/cgroup:ro
command: /sbin/init
network: kitchen
security_opt: seccomp=unconfined
skip_preparation: true
build_pull: true
transport:
name: docker_cli
provisioner:
name: chef_zero
always_update_cookbooks: true
product_name: chef
install_strategy: skip
channel: current
verifier:
name: inspec
platforms:
- name: ubuntu
driver_config:
image: sbernard/centos-systemd-kitchen
suites:
- name: install
......
# # encoding: utf-8
# Inspec test for recipe intellij::default
# The Inspec reference, with examples and extensive documentation, can be
# found at http://inspec.io/docs/reference/resources/
unless os.windows?
# This is an example test, replace with your own test.
describe user('root'), :skip do
it { should exist }
end
end
# This is an example test, replace it with your own test.
describe port(80), :skip do
it { should_not be_listening }
end
describe file('/home/myuser/IntelliJ/product-info.json') do
it { should exist }
its('content') { should match /"name"\s*:\s+"IntelliJ IDEA",/ }
its('content') { should match /"productCode"\s*:\s+"IC",/ }
its('user') { should cmp 'myuser' }
its('group') { should cmp 'mygroup' }
end
describe directory('/home/myuser/IntelliJ/bin') do
it { should exist }
its('user') { should cmp 'myuser' }
its('group') { should cmp 'mygroup' }
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment