Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reworks onecluster acceptance tests. #201

Merged
merged 2 commits into from
Sep 17, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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',
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific reason why not doing two puppet runs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its still WIP - trying to figure out how to create hosts without making them end up in failed state.

problem:
Notice: /Stage[main]/Main/Onehost[host02]/status: status changed 'init' to 'disabled'
Notice: /Stage[main]/Main/Onehost[host01]/status: status changed 'init' to '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