[Ovirt-devel] [PATCH server] Correct errors in fixtures.

Jason Guiditta jason.guiditta at gmail.com
Wed Apr 1 14:15:30 UTC 2009


These errors were killing all the tests.  Currently
there should only be one remaining error on storage_volume_test,
which will be fixed in a subsequent patch.
---
 src/test/fixtures/networks.yml   |   30 ++++++++++++++++++++++++++++++
 src/test/fixtures/nics.yml       |   12 ++++++------
 src/test/unit/ip_address_test.rb |    4 +++-
 src/test/unit/nic_test.rb        |    7 ++++---
 4 files changed, 43 insertions(+), 10 deletions(-)

diff --git a/src/test/fixtures/networks.yml b/src/test/fixtures/networks.yml
index f78d1b4..fa32f0f 100644
--- a/src/test/fixtures/networks.yml
+++ b/src/test/fixtures/networks.yml
@@ -21,11 +21,41 @@ static_physical_network_one:
   name: Static Physical Network 1
   boot_type: boot_type_static_ip
 
+mail_network_one:
+  type: PhysicalNetwork
+  name: DHCP Mail Network 1
+  boot_type: boot_type_dhcp
+
+mail_network_two:
+  type: PhysicalNetwork
+  name: DHCP Mail Network 2
+  boot_type: boot_type_dhcp
+
+fileserver_network:
+  type: PhysicalNetwork
+  name: DHCP Fileserver Network
+  boot_type: boot_type_dhcp
+
+mediaserver_network_one:
+  type: PhysicalNetwork
+  name: DHCP Mediaserver Network 1
+  boot_type: boot_type_dhcp
+
+mediaserver_network_two:
+  type: PhysicalNetwork
+  name: DHCP Mediaserver Network 2
+  boot_type: boot_type_dhcp
+
 dhcp_physical_network_one:
   type: PhysicalNetwork
   name: DHCP Physical Network 1
   boot_type: boot_type_dhcp
 
+dhcp_physical_network_two:
+  type: PhysicalNetwork
+  name: DHCP Physical Network 2
+  boot_type: boot_type_dhcp
+
 bootp_physical_network_one:
   type: PhysicalNetwork
   name: BOOTP Physical Network 1
diff --git a/src/test/fixtures/nics.yml b/src/test/fixtures/nics.yml
index b8bb6c7..1cf3223 100644
--- a/src/test/fixtures/nics.yml
+++ b/src/test/fixtures/nics.yml
@@ -3,21 +3,21 @@ mailserver_nic_one:
   usage_type: 1
   bandwidth: 100
   host: mailservers_managed_node
-  physical_network: dhcp_physical_network_one
+  physical_network: mail_network_one
 
 mailserver_nic_two:
   mac: 22:11:33:66:44:55
   usage_type: 1
   bandwidth: 100
   host: mailservers_managed_node
-  physical_network: dhcp_physical_network_one
+  physical_network: mail_network_two
 
 fileserver_nic_one:
   mac: 00:99:00:99:13:07
   usage_type: 1
   bandwidth: 100
   host: fileserver_managed_node
-  physical_network: dhcp_physical_network_one
+  physical_network: fileserver_network
 
 ldapserver_nic_one:
   mac: 00:03:02:00:09:06
@@ -39,18 +39,18 @@ buildserver_nic_two:
   usage_type: 1
   bandwidth: 100
   host: buildserver_managed_node
-  physical_network: static_physical_network_one
+  physical_network: static_physical_network_two
 
 mediaserver_nic_one:
   mac: 07:17:19:65:03:32
   usage_type: 1
   bandwidth: 100
   host: mediaserver_managed_node
-  physical_network: dhcp_physical_network_one
+  physical_network: mediaserver_network_one
 
 mediaserver_nic_two:
   mac: 07:17:19:65:03:31
   usage_type: 1
   bandwidth: 100
   host: mediaserver_managed_node
-  physical_network: dhcp_physical_network_one
+  physical_network: mediaserver_network_two
diff --git a/src/test/unit/ip_address_test.rb b/src/test/unit/ip_address_test.rb
index 4cfc694..89972ad 100644
--- a/src/test/unit/ip_address_test.rb
+++ b/src/test/unit/ip_address_test.rb
@@ -13,6 +13,8 @@ class IpAddressTest < ActiveSupport::TestCase
 
   def test_valid_fails_without_foreign_entity
      @ip_address = IpAddress.new
-     flunk "Ip Address must be associated with network, nic, or bonding" if @ip_address.valid?
+#    FIXME: this is a temporary fix.  Validations were dropped in models while
+#    this networking is in flux.  Revisit this test once that stabilizes.
+     flunk "Ip Address must be associated with network, nic, or bonding" unless @ip_address.valid?
   end
 end
diff --git a/src/test/unit/nic_test.rb b/src/test/unit/nic_test.rb
index 2644148..07f54c6 100644
--- a/src/test/unit/nic_test.rb
+++ b/src/test/unit/nic_test.rb
@@ -60,10 +60,11 @@ class NicTest < Test::Unit::TestCase
     flunk 'Nic must have a host' if @nic.valid?
   end
 
-  def test_valid_fails_without_physical_network
-    @nic.physical_network = nil
+  def test_valid_fails_without_unique_physical_network
+    @nic.host = hosts(:ldapserver_managed_node)
 
-    flunk 'Nic must have a physical network' if @nic.valid?
+    assert_equal false, @nic.valid?, 'This nic is not valid'
+    flunk 'This physical network is already used on this host.' if @nic.valid?
   end
 
   def test_valid_fails_with_invalid_bandwidth
-- 
1.6.0.6




More information about the ovirt-devel mailing list