Merge branch 'master' into 3618-column-ordering
[arvados.git] / services / api / test / unit / node_test.rb
index 5a9a057696041ab76a505977bdd3659b6e2daa94..37e95db0e18cfb555de27a7b127d1d90cf132052 100644 (file)
@@ -11,13 +11,19 @@ class NodeTest < ActiveSupport::TestCase
 
   test "pinging a node can add and update stats" do
     node = ping_node(:idle, {total_cpu_cores: '12', total_ram_mb: '512'})
-    assert_equal(12, node.info['total_cpu_cores'].to_i)
-    assert_equal(512, node.info['total_ram_mb'].to_i)
+    assert_equal(12, node.properties['total_cpu_cores'])
+    assert_equal(512, node.properties['total_ram_mb'])
   end
 
   test "stats disappear if not in a ping" do
     node = ping_node(:idle, {total_ram_mb: '256'})
-    refute_includes(node.info, 'total_cpu_cores')
-    assert_equal(256, node.info['total_ram_mb'].to_i)
+    refute_includes(node.properties, 'total_cpu_cores')
+    assert_equal(256, node.properties['total_ram_mb'])
+  end
+
+  test "worker state is down for node with no slot" do
+    node = nodes(:was_idle_now_down)
+    assert_nil node.slot_number, "fixture is not what I expected"
+    assert_equal 'down', node.crunch_worker_state, "wrong worker state"
   end
 end