Skip to content

Commit

Permalink
Merge pull request #201 from endocode/master
Browse files Browse the repository at this point in the history
Reworks onecluster acceptance tests.
  • Loading branch information
sebastiansucker committed Sep 17, 2015
2 parents 6e9d603 + e422502 commit eda17fa
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 64 deletions.
88 changes: 61 additions & 27 deletions spec/acceptance/onecluster_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,62 @@

describe 'onecluster type' do
before :all do
skip
pp = <<-EOS
class { 'one':
oned => true,
}
->
onehost { ['host01', 'host02']:
ensure => present, # FIXME: ensurable should default to :present...
onehost { 'host01':
im_mad => 'dummy',
vm_mad => 'dummy',
vn_mad => 'dummy',
status => 'disabled',
}
onehost { 'host02':
im_mad => 'dummy',
vm_mad => 'dummy',
vn_mad => 'dummy',
status => 'disabled',
}
->
onevnet { ['Blue LAN', 'Red LAN']:
type => 'fixed',
bridge => 'vbr1',
onevnet { 'vnet1':
ensure => present,
bridge => 'basebr0',
phydev => 'br0',
dnsservers => ['8.8.8.8', '4.4.4.4'],
gateway => '10.0.2.1',
vlanid => '1550',
netmask => '255.255.0.0',
network_address => '10.0.2.0',
}
onevnet { 'vnet2':
ensure => present,
bridge => 'basebr0',
phydev => 'br0',
dnsservers => ['8.8.8.8', '4.4.4.4'],
gateway => '10.0.2.1',
vlanid => '1550',
netmask => '255.255.0.0',
network_address => '10.0.2.0',
}
EOS
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
#apply_manifest(pp, :catch_changes => true) # FIXME - Hosts can't run idempotently
end

after :all do
pp = <<-EOS
onehost { ['host01', 'host02']:
ensure => absent,
}
onevnet { ['Blue LAN', 'Red LAN']:
onevnet { ['vnet1', 'vnet2']:
ensure => absent,
}
onedatastore { ['system', 'default', 'files']:
ensure => absent,
}
EOS
Expand All @@ -36,9 +67,10 @@ class { 'one':

describe 'when creating a cluster' do
it 'should idempotently run' do
skip
pp = <<-EOS
onecluster { 'production': }
onecluster { 'production':
ensure => present,
}
EOS

apply_manifest(pp, :catch_failures => true)
Expand All @@ -48,7 +80,6 @@ class { 'one':

describe 'when adding a host to a cluster' do
it 'should idempotently run' do
skip
pp =<<-EOS
onecluster { 'production':
hosts => 'host01',
Expand All @@ -62,7 +93,6 @@ class { 'one':

describe 'when adding a datastore to a cluster' do
it 'should idempotently run' do
skip
pp =<<-EOS
onecluster { 'production':
datastores => 'system',
Expand All @@ -76,10 +106,9 @@ class { 'one':

describe 'when adding a vnet to a cluster' do
it 'should idempotently run' do
skip
pp =<<-EOS
onecluster { 'production':
vnets => 'Blue LAN',
vnets => 'vnet1',
}
EOS

Expand All @@ -90,7 +119,6 @@ class { 'one':

describe 'when adding an array of hosts to a cluster' do
it 'should idempotently run' do
skip
pp =<<-EOS
onecluster { 'production':
hosts => ['host01', 'host02'],
Expand All @@ -104,7 +132,6 @@ class { 'one':

describe 'when adding an array of datastores to a cluster' do
it 'should idempotently run' do
skip
pp =<<-EOS
onecluster { 'production':
datastores => ['system','default','files'],
Expand All @@ -118,10 +145,9 @@ class { 'one':

describe 'when adding an array of vnets to a cluster' do
it 'should idempotently run' do
skip
pp =<<-EOS
onecluster { 'production':
vnets => ['Blue LAN', 'Red LAN'],
vnets => ['vnet1', 'vnet2'],
}
EOS

Expand All @@ -132,10 +158,9 @@ class { 'one':

describe 'when removing a host from a cluster' do
it 'should idempotently run' do
skip
pp =<<-EOS
onecluster { 'production':
hosts => 'host02',
hosts => 'host01',
}
EOS

Expand All @@ -146,7 +171,6 @@ class { 'one':

describe 'when removing a datastore from a cluster' do
it 'should idempotently run' do
skip
pp =<<-EOS
onecluster { 'production':
datastores => 'default',
Expand All @@ -160,10 +184,22 @@ class { 'one':

describe 'when removing a vnet from a cluster' do
it 'should idempotently run' do
skip
pp =<<-EOS
onecluster { 'production':
vnets => ['Red LAN'],
vnets => 'vnet1',
}
EOS

apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
end
end

describe 'when removing all vnets from a cluster' do
it 'should idempotently run' do
pp =<<-EOS
onecluster { 'production':
vnets => [],
}
EOS

Expand All @@ -174,8 +210,6 @@ class { 'one':

describe 'when destroying a cluster' do
it 'should idempotently run' do
skip
pending 'Fail in acceptance tests only???'
pp =<<-EOS
onecluster { 'production':
ensure => absent,
Expand Down
37 changes: 0 additions & 37 deletions spec/acceptance/onedatastore_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,41 +181,4 @@ class { 'one':
end
end

describe 'when assigning a Datastore to a Cluster' do
it 'should work with no errors' do
pp = <<-EOS
onedatastore { 'ds1':
tm_mad => 'shared',
type => 'system_ds',
} ->
onehost { 'host02':
im_mad => 'kvm',
vm_mad => 'kvm',
vn_mad => 'dummy',
} ->
onevnet { 'vnet1':
ensure => present,
bridge => 'basebr0',
phydev => 'br0',
dnsservers => ['8.8.8.8', '4.4.4.4'],
gateway => '10.0.2.1',
vlanid => '1550',
netmask => '255.255.0.0',
network_address => '10.0.2.0',
} ->
onecluster { 'production':
ensure => present,
hosts => 'host02',
vnets => 'vnet1',
datastores => 'ds1',
}
EOS

apply_manifest(pp, :catch_failures => true)
end
end

end

0 comments on commit eda17fa

Please sign in to comment.