assert(NULL != $gray_id); //rollback assert(0 === $qzk->grayRollback($gray_id)); sleep($waiting_time); //node in gray process $in_val = QConf::getConf($gray_in_path); var_dump($in_val); print_info($in_val == $gray_in_val, __LINE__); //node out of gray process $out_val = QConf::getConf($gray_out_path); var_dump($out_val); print_info($out_val == $gray_out_val, __LINE__); echo_color("[==END==============================]", GREEN); echo_color("[-- clear batch nodes childre: BEGIN --]", BROWN); assert(0 === $qzk->nodeSet("{$prefix}{$batch_path}", "batch node")); $children = $qzk->list("{$prefix}{$batch_path}"); foreach ($children as $node) { assert(0 === $qzk->nodeDelete("{$prefix}{$batch_path}/{$node}")); } echo_color("[-- clear batch nodes childre: END --]", BROWN); echo PHP_EOL; $nodes = $ops = array(); echo_color("0 children node", CYAN); batch_operation($nodes, $ops, $history_nodes, __LINE__, TRUE); echo_color("1 child add", CYAN); $nodes[$bkeys[0]] = "value1_new"; $ops[$bkeys[0]] = OP_NODE_ADD; batch_operation($nodes, $ops, $history_nodes, __LINE__); echo_color("1 child modify", CYAN); $nodes[$bkeys[0]] = "value1"; $ops[$bkeys[0]] = OP_NODE_MODIFY;
unset($services[$cg_service]); assert($services === $zk->servicesGetWithStatus($service_key)); assert(array_keys($services) === $zk->servicesGet($service_key)); //serviceClear assert(0 !== $zk->serviceClear("")); assert(0 !== $zk->serviceClear("/")); assert(0 === $zk->serviceClear($service_key)); assert($services_empty == $zk->servicesGetWithStatus($service_key)); //list listWithValue $children = array("child1" => "value1", "child2" => "value2", "child3" => "value3", "child4" => "value4", "child5" => "value5"); $parent_path = "qconf_manager/demo/1"; foreach ($children as $c_key => $c_val) { assert(0 === $zk->nodeSet("{$parent_path}/{$c_key}", $c_val)); } assert($children === $zk->listWithValue($parent_path)); assert(array_keys($children) === $zk->list($parent_path)); $children = array("child1" => "value1", "child2" => 1, "child3" => "value3", "child4" => "value4", "child5" => "value5"); $parent_path = "qconf_manager/demo/1"; foreach ($children as $c_key => $c_val) { assert(0 === $zk->nodeSet("{$parent_path}/{$c_key}", $c_val)); } $children["child2"] = "1"; assert($children === $zk->listWithValue($parent_path)); assert(array_keys($children) === $zk->list($parent_path)); //gray rollback $gray_nodes = array("qconf_manager/gray/1" => "value1", "/qconf_manager/gray/2/" => "value2", "qconf_manager/gray/3/" => "value3", "qconf_manager/gray/4" => "value4", "qconf_manager/gray/5" => "value5"); foreach ($gray_nodes as $path => $val) { assert(0 === $zk->nodeSet("{$path}", "value")); } $machines = array("HelloDawndeMacBook-Pro.local", "HelloDawndeMacBook-Pro.local1"); $gray_empty = array();