test/data_test.rb in gaptool-server-0.6.4 vs test/data_test.rb in gaptool-server-0.6.6

- old
+ new

@@ -34,21 +34,23 @@ expect(server).to eq(data.merge({ 'instance' => instid, 'chef_repo' => 'myrepo', 'chef_branch' => 'master', 'registered' => 'false', - 'secret' => 'secret' + 'secret' => 'secret', + 'apps' => [] })) end it "should add a registered server" do DH.addserver(instid, data, nil) server = DH.get_server_data(instid) expect(server).to eq(data.merge({ 'instance' => instid, 'chef_repo' => 'myrepo', - 'chef_branch' => 'master' + 'chef_branch' => 'master', + 'apps' => [] })) end it "should register a server" do DH.addserver(instid, data, "secret") @@ -59,11 +61,12 @@ expect(res).to eq(instid) server = DH.get_server_data(instid) expect(server).to eq(data.merge({ 'instance' => instid, 'chef_repo' => 'myrepo', - 'chef_branch' => 'master' + 'chef_branch' => 'master', + 'apps' => [] })) end it "should remove a server" do DH.addserver(instid, data, 'secret') @@ -92,32 +95,45 @@ server = DH.get_server_data(instid, initkey: true) expect(server).to eq(data.merge({ 'instance' => instid, 'chef_repo' => 'myrepo', 'chef_branch' => 'master', - 'initkey' => 'FAKEKEY' + 'initkey' => 'FAKEKEY', + 'apps' => [] })) end it "should get the runlist for a node from the role" do DH.save_role_data("role", chef_runlist: ["recipe[myrecipe]"].to_json) DH.addserver(instid, data, nil) role = DH.get_role_data("role") expect(role).to eq({"chef_runlist"=> ["recipe[myrecipe]"].to_json, "apps" => [], - "amis" => {}}) + "amis" => {}, + "sg" => {}}) server = DH.get_server_data(instid) expect(server).to eq(data.merge("instance" => instid, "chef_runlist" => ["recipe[myrecipe]"], "chef_repo" => "myrepo", - "chef_branch" => "master" )) + "chef_branch" => "master", + "apps" => [] )) end it "shoud get the ami for a node from the role" do DH.save_role_data("role", ami: 'ami-1234567') DH.addserver(instid, data, nil) role = DH.get_role_data("role") expect(role).to eq({'ami' => 'ami-1234567', "apps" => [], - "amis" => {}}) + "amis" => {}, + "sg" => {}}) + end + + it "shoud get the sg for a node from the role" do + DH.save_role_data("role", ami: 'ami-1234567', "sg" => {"test" => "my_role"}) + role = DH.get_role_data("role") + expect(role).to eq({'ami' => 'ami-1234567', + "apps" => [], + "amis" => {}, + "sg" => {"test" => "my_role"}}) end end