Skip to content

Commit aed5662

Browse files
authored
Merge pull request #42 from eole/feature/test-platform-debian-9-2018.3-py2
Feature/test platform debian 9 2018.3 py2
2 parents 81a0eb9 + dccc589 commit aed5662

File tree

9 files changed

+68
-14
lines changed

9 files changed

+68
-14
lines changed

.travis.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ env:
3131
# - INSTANCE: default-centos-7-2019-2-py3
3232
# - INSTANCE: default-fedora-29-2019-2-py3
3333
# - INSTANCE: default-opensuse-leap-15-2019-2-py3
34-
# - INSTANCE: default-debian-9-2018-3-py2
34+
- INSTANCE: default-debian-9-2018-3-py2
3535
# - INSTANCE: default-ubuntu-1604-2018-3-py2
3636
- INSTANCE: default-centos-7-2018-3-py2
3737
# - INSTANCE: default-fedora-29-2018-3-py2
@@ -46,12 +46,11 @@ env:
4646
# - INSTANCE: default-fedora-28-2017-7-py2
4747
# - INSTANCE: default-opensuse-leap-42-2017-7-py2
4848

49+
script:
50+
- bundle exec kitchen verify ${INSTANCE}
51+
4952
jobs:
5053
include:
51-
# Define the test stage
52-
- stage: test
53-
name: "Kitchen tests"
54-
script: bundle exec kitchen verify ${INSTANCE}
5554
# Define the commitlint stage
5655
- stage: commitlint
5756
language: node_js

pillar.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
libvirt:
22
#lookup:
33
# - override map.jinja and defaults.yml
4-
daemon_opts:
5-
libvirtd_opts: '-d'
4+
#daemon_opts:
5+
# libvirtd_opts: '-d'
66

77
libvirtd:
88
listen_tls: 0

test/integration/default/controls/config_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
control 'Libvirt configuration' do
2323
title 'verify applied configuration'
2424

25-
describe file('/etc/sysconfig/libvirtd') do
25+
describe libvirt.daemon_config_file do
2626
it { should exist }
2727
its('content') { should match %r{This\sfile\sis\smanaged\sby\sSalt} }
2828
end

test/integration/default/controls/pkgs_spec.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@
44
# Author: Daniel Dehennin <[email protected]>
55
# Copyright © 2019 Pôle de Compétences Logiciels Libres <[email protected]>
66
#
7-
packages = {
8-
'libvirt' => ['libvirt'],
9-
'qemu' => ['qemu-kvm'],
10-
'extra' => ['libguestfs'],
11-
'python' => ['libvirt-python'],
12-
}
7+
packages = libvirt.packages
138

149
control 'Libvirt packages' do
1510
title 'verify installed packages'

test/integration/default/inspec.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ maintainer: Daniel Dehennin
44
license: Apache-2.0
55
summary: Verify that the libvirt formula is setup and configured correctly
66
supports:
7+
- os-name: debian
78
- os-name: centos
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# coding: utf-8
2+
#
3+
# libvirt.rb -- Libvirt InSpec resources
4+
# Author: Daniel Dehennin <[email protected]>
5+
# Copyright © 2019 Pôle de Compétences Logiciels Libres <[email protected]>
6+
#
7+
class LibvirtResource < Inspec.resource(1)
8+
name 'libvirt'
9+
10+
supports platform_name: 'debian'
11+
supports platform_name: 'centos'
12+
13+
def initialize
14+
@packages = get_packages
15+
end
16+
17+
def daemon_config_dir
18+
return case inspec.os[:family]
19+
when 'debian'
20+
'/etc/default/'
21+
when 'redhat'
22+
'/etc/sysconfig'
23+
else
24+
raise Inspec::Exceptions::ResourceSkipped,
25+
"OS family #{inspec.os[:family]} not supported"
26+
end
27+
end
28+
29+
def daemon_config_file
30+
return inspec.file(File.join(daemon_config_dir, 'libvirtd'))
31+
end
32+
33+
def packages
34+
return @packages
35+
end
36+
37+
def get_packages
38+
# defaults.yaml
39+
packages = {
40+
'libvirt' => ['libvirt'],
41+
'qemu' => ['qemu-kvm'],
42+
'extra' => ['libguestfs'],
43+
'python' => ['libvirt-python'],
44+
}
45+
46+
# osfamily.yaml / osmap.yaml
47+
case inspec.os[:family]
48+
when 'debian'
49+
packages['libvirt'] = ['libvirt-daemon-system']
50+
packages['extra'] = ['libguestfs0', 'libguestfs-tools', 'gnutls-bin', 'virt-top']
51+
packages['python'] = ['python-libvirt']
52+
end
53+
54+
return packages
55+
end
56+
end

test/integration/default/libraries/libvirt_socket_admin.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
class LibvirtSocketAdminResource < Inspec.resource(1)
88
name 'libvirt_socket_admin'
99

10+
supports platform_name: 'debian'
1011
supports platform_name: 'centos'
1112

1213
def initialize

test/integration/default/libraries/libvirt_socket_ro.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
class LibvirtSocketRoResource < Inspec.resource(1)
88
name 'libvirt_socket_ro'
99

10+
supports platform_name: 'debian'
1011
supports platform_name: 'centos'
1112

1213
def initialize

test/integration/default/libraries/libvirt_socket_rw.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
class LibvirtSocketRwResource < Inspec.resource(1)
88
name 'libvirt_socket_rw'
99

10+
supports platform_name: 'debian'
1011
supports platform_name: 'centos'
1112

1213
def initialize

0 commit comments

Comments
 (0)