This repository has been archived by the owner on Jul 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
domain_administrator_spec.rb
64 lines (58 loc) · 2.06 KB
/
domain_administrator_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# frozen_string_literal: true
require 'spec_helper'
describe 'nuodb::manager::domain_administrator', type: :define do
let :pre_condition do
'class { "nuodb": }'
end
let :facts do
{
os: { family: 'Debian' },
osfamily: 'Debian',
operatingsystem: 'Ubuntu',
architecture: 'x86_64',
lsbdistcodename: 'xenial'
}
end
let :title do
'testadmin1'
end
it do
is_expected.to compile.with_all_deps
is_expected.to contain_exec('create-domain-administrator-testadmin1')
.with_command('/opt/nuodb/bin/nuodbmgr --broker \'localhost\' --password \'ch@ngeMe\' ' \
'--command "create domain administrator user \'testadmin1\' password \'testadmin1\'"')
.with_unless('/opt/nuodb/bin/nuodbmgr --broker \'localhost\' --password \'ch@ngeMe\' ' \
'--command "show domain administrators" | grep -q -Fx \'testadmin1\'')
end
context 'with different parameter values' do
let :params do
{
broker_host: 'dbhost1',
domain_password: 'asecret',
username: 'usr',
password: 'pwd'
}
end
it do
is_expected.to contain_exec('create-domain-administrator-usr')
.with_command('/opt/nuodb/bin/nuodbmgr --broker \'dbhost1\' --password \'asecret\' ' \
'--command "create domain administrator user \'usr\' password \'pwd\'"')
.with_unless('/opt/nuodb/bin/nuodbmgr --broker \'dbhost1\' --password \'asecret\' ' \
'--command "show domain administrators" | grep -q -Fx \'usr\'')
end
end
context 'removing a domain administrator' do
let :params do
{
ensure: 'absent'
}
end
it do
is_expected.to contain_exec('remove-domain-administrator-testadmin1')
.with_command('/opt/nuodb/bin/nuodbmgr --broker \'localhost\' --password \'ch@ngeMe\' ' \
'--command "remove domain administrator user \'testadmin1\'"')
.with_onlyif('/opt/nuodb/bin/nuodbmgr --broker \'localhost\' --password \'ch@ngeMe\' ' \
'--command "show domain administrators" | grep -q -Fx \'testadmin1\'')
end
end
end