|
| 1 | +Given(/^the barclamp proposal for ceph is deployed$/) do |
| 2 | + json_response = JSON.parse(admin_node.exec!("crowbar ceph show default").output) |
| 3 | + expect(json_response["attributes"]["ceph"]["config"]["osds_in_total"]).not_to be < 2 |
| 4 | +end |
| 5 | + |
| 6 | +When(/^the node with ceph-mon role has been detected successfully$/) do |
| 7 | + @node_list = Hash.new |
| 8 | + json_response = JSON.parse(admin_node.exec!("crowbar ceph show default").output) |
| 9 | + @node_list["ceph-mon"] = json_response["deployment"]["ceph"]["elements"]["ceph-mon"] |
| 10 | + expect(@node_list["ceph-mon"]).not_to be_empty |
| 11 | +end |
| 12 | + |
| 13 | +And(/^the node with ceph-osd role has been detected successfully$/) do |
| 14 | + json_response = JSON.parse(admin_node.exec!("crowbar ceph show default").output) |
| 15 | + @node_list["ceph-osd"] = json_response["deployment"]["ceph"]["elements"]["ceph-osd"] |
| 16 | + expect(@node_list["ceph-osd"]).not_to be_empty |
| 17 | +end |
| 18 | + |
| 19 | +And(/^the package ceph is installed in the controller node$/) do |
| 20 | + node = nodes.find(fqdn: @node_list["ceph-mon"][0]) |
| 21 | + node.exec!("rpm -q ceph") |
| 22 | +end |
| 23 | + |
| 24 | +Then(/^I can check that the overall health of the ceph cluster is OK$/) do |
| 25 | + json_response = JSON.parse(control_node.exec!("ceph status -f json-pretty").output) |
| 26 | + expect(json_response["health"]["overall_status"]).to eq("HEALTH_OK") |
| 27 | +end |
| 28 | + |
| 29 | +And(/^I can get the CRUSH tree of the ceph cluster$/) do |
| 30 | + json_response = JSON.parse(control_node.exec!("ceph osd tree -f json-pretty").output) |
| 31 | + expect(json_response).not_to be_empty |
| 32 | +end |
| 33 | + |
| 34 | +And(/^I can check the status of the placement groups$/) do |
| 35 | + response = control_node.exec!("ceph pg stat --concise").output |
| 36 | + expect(response).not_to be_empty |
| 37 | +end |
| 38 | + |
| 39 | +And(/^I can check if data, metadata and rbd have pools allocated$/) do |
| 40 | + json_response = JSON.parse(control_node.exec!("ceph osd lspools -f json-pretty").output) |
| 41 | + data_exists = metadata_exists = rbd_exists = rgw_exists = false |
| 42 | + json_response.each do |pool_record| |
| 43 | + if pool_record["poolname"] == "data" |
| 44 | + data_exists = true |
| 45 | + end |
| 46 | + if pool_record["poolname"] == "metadata" |
| 47 | + metadata_exists = true |
| 48 | + end |
| 49 | + if pool_record["poolname"] == "rbd" |
| 50 | + rbd_exists = true |
| 51 | + end |
| 52 | + if pool_record["poolname"] == ".rgw" |
| 53 | + rgw_exists = true |
| 54 | + end |
| 55 | + end |
| 56 | + expect(data_exists && metadata_exists && rbd_exists && rgw_exists).to eq(true) |
| 57 | +end |
| 58 | + |
| 59 | +And(/^I can create a block device "([^"]*)" in the data pool$/) do |rbd_name| |
| 60 | + control_node.exec!("rbd create #{rbd_name} --size 1024 --pool data") |
| 61 | + response = control_node.exec!("rbd ls --pool data").output |
| 62 | + obj_list = response.split(/\n/) |
| 63 | + expect(obj_list).to include(rbd_name) |
| 64 | +end |
| 65 | + |
| 66 | +And(/^I can retreive the block device image information or resize it$/) do |
| 67 | + rbd_info = control_node.exec!("rbd info cucumber_rbd --pool data").output |
| 68 | + resize_output = control_node.exec!("rbd resize --size 2048 cucumber_rbd --pool data").output |
| 69 | + rbd_info = control_node.exec!("rbd info cucumber_rbd --pool data").output |
| 70 | + s_expect = "size 2048 MB" |
| 71 | + s1 = "size 1024 MB" |
| 72 | + rbd_info.lines.each do |line| |
| 73 | + if line.match(/size/) |
| 74 | + s1 = line.match(/size 2048 MB/)[0].to_s |
| 75 | + end |
| 76 | + end |
| 77 | + expect(s1).to eq(s_expect) |
| 78 | +end |
| 79 | + |
| 80 | +And(/^I can remove the block device "([^"]*)" in the data pool$/) do |rbd_name| |
| 81 | + control_node.exec!("rbd rm #{rbd_name} --pool data") |
| 82 | + response = control_node.exec!("rbd ls --pool data").output |
| 83 | + obj_list = response.split(/\n/) |
| 84 | + expect(obj_list).not_to include(rbd_name) |
| 85 | +end |
| 86 | + |
| 87 | +Given(/^the node with ceph-radosgw role has been detected successfully$/) do |
| 88 | + json_response = JSON.parse(admin_node.exec!("crowbar ceph show default").output) |
| 89 | + @node_list["ceph-radosgw"] = json_response["deployment"]["ceph"]["elements"]["ceph-radosgw"] |
| 90 | + expect(@node_list["ceph-radosgw"]).not_to be_empty |
| 91 | +end |
| 92 | + |
| 93 | +And(/^the package ceph-radosgw is installed in the controller node$/) do |
| 94 | + node = nodes.find(fqdn: @node_list["ceph-radosgw"][0]) |
| 95 | + node.exec!("rpm -q ceph-radosgw") |
| 96 | +end |
| 97 | + |
| 98 | +Then(/^I can create a radosgw-admin user "([^"]*)"$/) do |rgw_username| |
| 99 | + json_response = JSON.parse(control_node.exec!("radosgw-admin user create --display-name=\"cucumber test\" --uid=cucumber").output) |
| 100 | + expect(json_response["user_id"]).to eq("cucumber") |
| 101 | +end |
| 102 | + |
| 103 | +And(/^I can remove radosgw-admin user "([^"]*)"$/) do |rgw_username| |
| 104 | + control_node.exec!("radosgw-admin user rm --uid=cucumber") |
| 105 | +end |
| 106 | + |
| 107 | +And(/^I can create an object "([^"]*)" in the "([^"]*)" pool and see the object in the list$/) do |obj_name, pool_name| |
| 108 | + control_node.exec!("rados create #{obj_name} --pool #{pool_name}") |
| 109 | + response = control_node.exec!("rados ls --pool #{pool_name}").output |
| 110 | + obj_list = response.split(/\n/) |
| 111 | + expect(obj_list).to include(obj_name) |
| 112 | +end |
| 113 | + |
| 114 | +And(/^I can download the object "([^"]*)" into the file system$/) do |obj_name| |
| 115 | + control_node.exec!("rados get #{obj_name} cucumber.obj --pool data") |
| 116 | + response = control_node.exec!("ls cucumber.obj").output |
| 117 | + obj_list = response.split(/\n/) |
| 118 | + expect(obj_list).to include("cucumber.obj") |
| 119 | +end |
| 120 | + |
| 121 | +And(/^I can delete the object "([^"]*)" from the data pool$/) do |obj_name| |
| 122 | + control_node.exec!("rados rm #{obj_name} --pool data") |
| 123 | + response = control_node.exec!("rados ls --pool data").output |
| 124 | + obj_list = response.split(/\n/) |
| 125 | + expect(obj_list).not_to include(obj_name) |
| 126 | +end |
0 commit comments