From 3627b0f25b048c8dd1c6ff97eb0c93c70a18773b Mon Sep 17 00:00:00 2001 From: Sebastian Sucker Date: Wed, 16 Sep 2015 09:50:50 +0200 Subject: [PATCH 1/2] Reworks onecluster acceptance tests. --- spec/acceptance/onecluster_spec.rb | 101 +++++++++++++++++++-------- spec/acceptance/onedatastore_spec.rb | 37 ---------- 2 files changed, 73 insertions(+), 65 deletions(-) diff --git a/spec/acceptance/onecluster_spec.rb b/spec/acceptance/onecluster_spec.rb index f58c577b..48e0f382 100644 --- a/spec/acceptance/onecluster_spec.rb +++ b/spec/acceptance/onecluster_spec.rb @@ -2,23 +2,61 @@ 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 => 'kvm', + vm_mad => 'kvm', + vn_mad => 'dummy', + status => 'disabled', + } + + onehost { 'host02': + im_mad => 'kvm', + vm_mad => 'kvm', + vn_mad => 'dummy', + status => 'disabled', + } + + 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 { ['Blue LAN', 'Red LAN']: - type => 'fixed', - bridge => 'vbr1', + + 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', } + + #onedatastore { 'system': + # ensure => present, + #} + + #onedatastore { 'default': + # ensure => present, + #} + + #onedatastore { 'files': + # ensure => present, + #} + + EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) end after :all do @@ -26,19 +64,24 @@ class { 'one': onehost { ['host01', 'host02']: ensure => absent, } - onevnet { ['Blue LAN', 'Red LAN']: + + onevnet { ['vnet1', 'vnet2']: + ensure => absent, + } + + onedatastore { ['system', 'default', 'files']: ensure => absent, } EOS apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) end 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) @@ -48,7 +91,6 @@ class { 'one': describe 'when adding a host to a cluster' do it 'should idempotently run' do - skip pp =<<-EOS onecluster { 'production': hosts => 'host01', @@ -62,7 +104,6 @@ class { 'one': describe 'when adding a datastore to a cluster' do it 'should idempotently run' do - skip pp =<<-EOS onecluster { 'production': datastores => 'system', @@ -76,10 +117,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 @@ -90,7 +130,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'], @@ -104,7 +143,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'], @@ -118,10 +156,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 @@ -132,10 +169,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 @@ -146,7 +182,6 @@ class { 'one': describe 'when removing a datastore from a cluster' do it 'should idempotently run' do - skip pp =<<-EOS onecluster { 'production': datastores => 'default', @@ -160,10 +195,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 @@ -174,8 +221,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, diff --git a/spec/acceptance/onedatastore_spec.rb b/spec/acceptance/onedatastore_spec.rb index 4722cdd9..f17b9820 100644 --- a/spec/acceptance/onedatastore_spec.rb +++ b/spec/acceptance/onedatastore_spec.rb @@ -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 From e42250204b576f4ce63da0bef1685b688a29f79d Mon Sep 17 00:00:00 2001 From: Sebastian Sucker Date: Thu, 17 Sep 2015 16:19:09 +0200 Subject: [PATCH 2/2] Adds fixme marker and removes comments. --- spec/acceptance/onecluster_spec.rb | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/spec/acceptance/onecluster_spec.rb b/spec/acceptance/onecluster_spec.rb index 48e0f382..e59e5530 100644 --- a/spec/acceptance/onecluster_spec.rb +++ b/spec/acceptance/onecluster_spec.rb @@ -7,15 +7,15 @@ class { 'one': oned => true, } onehost { 'host01': - im_mad => 'kvm', - vm_mad => 'kvm', + im_mad => 'dummy', + vm_mad => 'dummy', vn_mad => 'dummy', status => 'disabled', } onehost { 'host02': - im_mad => 'kvm', - vm_mad => 'kvm', + im_mad => 'dummy', + vm_mad => 'dummy', vn_mad => 'dummy', status => 'disabled', } @@ -42,21 +42,9 @@ class { 'one': network_address => '10.0.2.0', } - #onedatastore { 'system': - # ensure => present, - #} - - #onedatastore { 'default': - # ensure => present, - #} - - #onedatastore { 'files': - # ensure => present, - #} - - EOS apply_manifest(pp, :catch_failures => true) + #apply_manifest(pp, :catch_changes => true) # FIXME - Hosts can't run idempotently end after :all do @@ -74,6 +62,7 @@ class { 'one': } EOS apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) end describe 'when creating a cluster' do