[Ovirt-devel] [PATCH server] Feedback Requested.

Jason Guiditta jguiditt at redhat.com
Thu Nov 6 21:28:03 UTC 2008


This is a first attempt at doing some fixes on the unit tests.  I have been having problems getting the full test suite to run on my machines, so I am trying to get this remedied.  I am hoping to do it as a series of small patches, rather than one very large patch, so this is the first of those.  Since I can't run 'rake test:units' right now, I can't really tell if this breaks the whole test suite or not, so I am looking for feedback from someone who _is_ able to run that.  I have added some tests to pool_test.rb and been able to run them successfully with 'ruby test/unit/pool_test.rb', so I know this component is fine, just not what effect it might have on everything else.

Signed-off-by: Jason Guiditta <jguiditt at redhat.com>
---
 src/test/fixtures/pools.yml |   96 ++++++++++++++++++------------------------
 src/test/unit/pool_test.rb  |    8 +++-
 2 files changed, 47 insertions(+), 57 deletions(-)

diff --git a/src/test/fixtures/pools.yml b/src/test/fixtures/pools.yml
index 181a75b..41241f6 100644
--- a/src/test/fixtures/pools.yml
+++ b/src/test/fixtures/pools.yml
@@ -1,100 +1,86 @@
-one:
-  id: 1
+root_dir_pool:
+  name: 'root'
+  type: 'DirectoryPool'
+  lft: 1
+  rgt: 28
+
+hw_dir_pool:
+  name: 'hardware'
+  type: 'DirectoryPool'
+  parent_id: <%= Fixtures.identify(:root_dir_pool) %>
+  lft: 2
+  rgt: 25
+
+smart_dir_pool:
+  name: 'users'
+  type: 'DirectoryPool'
+  parent_id: <%= Fixtures.identify(:root_dir_pool) %>
+  lft: 26
+  rgt: 27
+
+default:
   name: 'default'
   type: 'HardwarePool'
-  parent_id: 12
-  created_at: '2008-02-13 15:42:43.417883'
-  updated_at: '2008-02-14 16:41:42.417883'
+  parent_id: <%= Fixtures.identify(:hw_dir_pool) %>
   lft: 3
   rgt: 24
-two:
-  id: 2
+foobar_hosts:
   name: 'foobar hosts'
   type: 'VmResourcePool'
-  parent_id: 1
+  parent_id: <%= Fixtures.identify(:default) %>
   lft: 4
   rgt: 5
-three:
-  id: 3
+corp_com:
   name: 'corp.com'
   type: 'HardwarePool'
-  parent_id: 1
+  parent_id: <%= Fixtures.identify(:default) %>
   lft: 6
   rgt: 23
-four:
-  id: 4
+corp_com_dev:
   name: 'corp.com dev'
   type: 'HardwarePool'
-  parent_id: 3
+  parent_id: <%= Fixtures.identify(:corp_com) %>
   lft: 7
   rgt: 8
-five:
-  id: 5
+corp_com_qa:
   name: 'corp.com qa'
   type: 'HardwarePool'
-  parent_id: 3
+  parent_id: <%= Fixtures.identify(:corp_com) %>
   lft: 9
   rgt: 20
-six:
-  id: 6
+corp_com_production_vms:
   name: 'corp.com production vms'
   type: 'VmResourcePool'
-  parent_id: 3
+  parent_id: <%= Fixtures.identify(:corp_com) %>
   lft: 21
   rgt: 22
-seven:
-  id: 7
+foobar:
   name: 'foobar'
   type: 'VmResourcePool'
-  parent_id: 5
+  parent_id: <%= Fixtures.identify(:corp_com_qa) %>
   lft: 10
   rgt: 11
-eight:
-  id: 8
+some_foobar_hardware:
   name: 'some foobar hardware'
   type: 'HardwarePool'
-  parent_id: 5
+  parent_id: <%= Fixtures.identify(:corp_com_qa) %>
   lft: 12
   rgt: 15
-nine:
-  id: 9
+some_more_foobar_hardware:
   name: 'some more foobar hardware'
   type: 'HardwarePool'
-  parent_id: 8
+  parent_id: <%= Fixtures.identify(:some_foobar_hardware) %>
   lft: 13
   rgt: 14
-ten:
-  id: 10
+yet_another_pool:
   name: 'yet another pool'
   type: 'VmResourcePool'
-  parent_id: 5
+  parent_id: <%= Fixtures.identify(:corp_com_qa) %>
   lft: 16
   rgt: 17
 prodops_pool:
-  id: 11
   name: 'Production Operations'
   type: 'HardwarePool'
-  parent_id: 5
+  parent_id: <%= Fixtures.identify(:corp_com_qa) %>
   lft: 18
   rgt: 19
-hw_dir_pool:
-  id: 12
-  name: 'hardware'
-  type: 'DirectoryPool'
-  parent_id: 13
-  lft: 2
-  rgt: 25
-root_dir_pool:
-  id: 13
-  name: 'root'
-  type: 'DirectoryPool'
-  lft: 1
-  rgt: 28
-smart_dir_pool:
-  id: 14
-  name: 'hardware'
-  type: 'DirectoryPool'
-  parent_id: 13
-  lft: 26
-  rgt: 27
-
diff --git a/src/test/unit/pool_test.rb b/src/test/unit/pool_test.rb
index c591e58..c0ca7cc 100644
--- a/src/test/unit/pool_test.rb
+++ b/src/test/unit/pool_test.rb
@@ -23,7 +23,11 @@ class PoolTest < Test::Unit::TestCase
   fixtures :pools
 
   # Replace this with your real tests.
-  def test_truth
-    assert true
+  def test_get_name
+    assert_equal(pools(:prodops_pool).name, 'Production Operations')
+  end
+
+  def test_get_parent
+    assert_equal(pools(:prodops_pool).parent.name, 'corp.com qa')
   end
 end
-- 
1.5.6.5




More information about the ovirt-devel mailing list