3 class NodeTest < ActiveSupport::TestCase
4 def ping_node(node_name, ping_data)
5 set_user_from_auth :admin
6 node = nodes(node_name)
7 node.ping({ping_secret: node.info['ping_secret'],
8 ip: node.ip_address}.merge(ping_data))
12 test "pinging a node can add and update stats" do
13 node = ping_node(:idle, {total_cpu_cores: '12', total_ram_mb: '512'})
14 assert_equal(12, node.info['total_cpu_cores'].to_i)
15 assert_equal(512, node.info['total_ram_mb'].to_i)
18 test "stats disappear if not in a ping" do
19 node = ping_node(:idle, {total_ram_mb: '256'})
20 refute_includes(node.info, 'total_cpu_cores')
21 assert_equal(256, node.info['total_ram_mb'].to_i)