File tree 9 files changed +101
-9
lines changed
9 files changed +101
-9
lines changed Original file line number Diff line number Diff line change @@ -12,18 +12,29 @@ provisioner:
12
12
idempotency_test : true
13
13
14
14
platforms :
15
+ - name : ubuntu-18.04
15
16
- name : ubuntu-16.04
16
- driver_config :
17
- image : williamyeh/ansible:ubuntu16.04-onbuild
18
- platform : ubuntu
17
+ - name : ubuntu-14.04
18
+ - name : ubuntu-12.04
19
19
20
20
verifier :
21
21
name : serverspec
22
22
23
23
suites :
24
- - name : default
24
+ - name : python3
25
25
driver :
26
- provision_command : export LC_ALL=C
26
+ provision_command :
27
+ - export LC_ALL=C
28
+ - mkdir -p /run/sshd
29
+ verifier :
30
+ default_pattern : true
31
+ bundler_path : ' /usr/local/bin'
32
+ rspec_path : ' /usr/local/bin'
33
+ - name : python2
34
+ driver :
35
+ provision_command :
36
+ - export LC_ALL=C
37
+ - mkdir -p /run/sshd
27
38
verifier :
28
39
default_pattern : true
29
40
bundler_path : ' /usr/local/bin'
Original file line number Diff line number Diff line change
1
+ ---
2
+ sudo : required
3
+ services :
4
+ - docker
5
+
6
+ language : python
7
+ python : " 2.7"
8
+
9
+ env :
10
+ - UBUNTU_VERSION : ubuntu-18
11
+ - UBUNTU_VERSION : ubuntu-16
12
+ - UBUNTU_VERSION : ubuntu-14
13
+ - UBUNTU_VERSION : ubuntu-12
14
+
15
+ cache :
16
+ pip : true
17
+ directories :
18
+ - $HOME/.rvm/gems
19
+
20
+ before_install :
21
+ - sudo apt-get update -qq
22
+ - sleep 5
23
+ - sudo apt-get install -qq python-apt python-pycurl
24
+ - gem install bundler
25
+
26
+ install :
27
+ - bundle install
28
+ - pip install ansible
29
+
30
+ script :
31
+ - ansible --version
32
+ - docker version
33
+ - export LC_ALL=C
34
+ - bundle show
35
+ - bundle exec kitchen test '${UBUNTU_VERSION}' -c
36
+
37
+ notifications :
38
+ email :
39
+ on_success : never
40
+ webhooks : https://galaxy.ansible.com/api/v1/notifications/
Original file line number Diff line number Diff line change 1
1
---
2
2
- name : Install Python 3.x
3
- raw : which python3 || sudo apt-get update && sudo apt-get install -qq -y python3-minimal
3
+ raw : dpkg-query --showformat='${Status}' -W python3 | grep -E "(hold|install) ok installed" || ( sudo apt-get update && sudo apt-get install -qq -y python3)
4
4
register : python_check
5
- changed_when : not python_check.stdout is search('/usr/bin/python3 ')
5
+ changed_when : not python_check.stdout | regex_search('ok installed ')
6
6
when : python_version == 3
7
7
8
8
- name : Install Python 2.x
9
- raw : which python || sudo apt-get update && sudo apt-get install -qq -y python-minimal
9
+ raw : dpkg-query --showformat='${Status}' -W python | grep -E "(hold|install) ok installed" || ( sudo apt-get update && sudo apt-get install -qq -y python)
10
10
register : python_check
11
- changed_when : not python_check.stdout is search('/usr/bin/python ')
11
+ changed_when : not python_check.stdout | regex_search('ok installed ')
12
12
when : python_version == 2
Original file line number Diff line number Diff line change 5
5
gather_facts : false
6
6
roles :
7
7
- { role: ansible-ubuntu-python-raw }
8
+ vars :
9
+ - python_version : 2
Original file line number Diff line number Diff line change
1
+ require_relative 'spec_helper'
2
+
3
+ describe package ( 'python' ) do
4
+ it { should be_installed }
5
+ end
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ ---
2
+ - name : Run setup tasks for testing
3
+ hosts : all
4
+ tasks :
5
+ - name : Check for idempotency flag
6
+ stat : path=/root/.test-kitchen-ran-once
7
+ register : flag
8
+
9
+ - name : Uninstall Python 3.x for testing
10
+ raw : dpkg-query --showformat='${Status}' -W python3 | grep -E "unknown ok not-installed" || sudo apt-get -y remove --purge python3
11
+ register : python_installed
12
+ changed_when : not python_installed.stdout | regex_search('unknown ok not-installed')
13
+ when : not flag.stat.exists
14
+
15
+ - name : Create flag for idempotency tests
16
+ hosts : all
17
+ gather_facts : false
18
+ tasks :
19
+ - copy :
20
+ content : " "
21
+ dest : /root/.test-kitchen-ran-once
22
+ force : yes
23
+ mode : 0644
24
+
25
+ - name : Setup
26
+ hosts : all
27
+ become : yes
28
+ gather_facts : false
29
+ roles :
30
+ - { role: ansible-ubuntu-python-raw }
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ # Encoding: utf-8
2
+ require 'serverspec'
3
+
4
+ set :backend , :exec
You can’t perform that action at this time.
0 commit comments