From 8a85e68695ad1e6b11acc3943c2f0ffaf6ddc8a1 Mon Sep 17 00:00:00 2001 From: Christoph Hartmann Date: Tue, 17 Nov 2015 22:14:05 +0100 Subject: [PATCH] bugfix: run integration tests on windows --- .../cookbooks/os_prepare/recipes/file.rb | 28 ++++++++------- .../test/integration/default/service_spec.rb | 6 +++- .../test/integration/default/user_spec.rb | 36 ++++++++++++++----- 3 files changed, 48 insertions(+), 22 deletions(-) diff --git a/test/integration/cookbooks/os_prepare/recipes/file.rb b/test/integration/cookbooks/os_prepare/recipes/file.rb index 6f3b92c2e..65b539360 100644 --- a/test/integration/cookbooks/os_prepare/recipes/file.rb +++ b/test/integration/cookbooks/os_prepare/recipes/file.rb @@ -4,18 +4,22 @@ # # prepares a sample file for verification -gid = 'root' -gid = 'wheel' if node['platform_family'] == 'freebsd' +if node['platform_family'] != 'windows' -file '/tmp/file' do - mode '0765' - owner 'root' - group gid - content 'hello world' -end + gid = 'root' + gid = 'wheel' if node['platform_family'] == 'freebsd' + + file '/tmp/file' do + mode '0765' + owner 'root' + group gid + content 'hello world' + end + + directory '/tmp/folder' do + mode '0567' + owner 'root' + group gid + end -directory '/tmp/folder' do - mode '0567' - owner 'root' - group gid end diff --git a/test/integration/test/integration/default/service_spec.rb b/test/integration/test/integration/default/service_spec.rb index d2ce3db16..80050c658 100644 --- a/test/integration/test/integration/default/service_spec.rb +++ b/test/integration/test/integration/default/service_spec.rb @@ -9,10 +9,14 @@ elsif ['debian'].include?(os[:family]) # Debian unavailable_service = 'clamav' available_service = 'ssh' -else +elsif ['ubuntu'].include?(os[:family]) # Ubuntu unavailable_service = 'sshd' available_service = 'ssh' +elsif ['windows'].include?(os[:family]) + # Ubuntu + unavailable_service = 'sshd' + available_service = 'dhcp' end describe service(unavailable_service) do diff --git a/test/integration/test/integration/default/user_spec.rb b/test/integration/test/integration/default/user_spec.rb index 2bcd9c2bb..cad3a55f9 100644 --- a/test/integration/test/integration/default/user_spec.rb +++ b/test/integration/test/integration/default/user_spec.rb @@ -28,17 +28,35 @@ elsif ['freebsd'].include?(os[:family]) shell: '/bin/csh', } +elsif ['windows'].include?(os[:family]) + + userinfo = { + name: 'Administrator', + group: nil, + uid: nil, + gid: nil, + groups: nil, + home: nil, + shell: nil, + } + else userinfo = {} end -describe user(userinfo[:name]) do - it { should exist } - it { should belong_to_group userinfo[:group] } - its('uid') { should eq userinfo[:uid] } - its('gid') { should eq userinfo[:gid] } - its('group') { should eq userinfo[:group] } - its('groups') { should eq userinfo[:groups] } - its('home') { should eq userinfo[:home] } - its('shell') { should eq userinfo[:shell] } +if !os.windows? + describe user(userinfo[:name]) do + it { should exist } + it { should belong_to_group userinfo[:group] } + its('uid') { should eq userinfo[:uid] } + its('gid') { should eq userinfo[:gid] } + its('group') { should eq userinfo[:group] } + its('groups') { should eq userinfo[:groups] } + its('home') { should eq userinfo[:home] } + its('shell') { should eq userinfo[:shell] } + end +else + describe user(userinfo[:name]) do + it { should exist } + end end