mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of https://github.com/arangodb/arangodb into devel
This commit is contained in:
commit
a3032db3b5
|
@ -141,17 +141,6 @@ describe ArangoDB do
|
|||
doc.parsed_response['errorNum'].should eq(1700)
|
||||
end
|
||||
|
||||
it "add user, empty username, old API" do
|
||||
body = "{ \"username\" : \"\", \"passwd\" : \"fox\" }"
|
||||
doc = ArangoDB.log_post("#{prefix}-add", api, :body => body)
|
||||
|
||||
doc.code.should eq(400)
|
||||
doc.headers['content-type'].should eq("application/json; charset=utf-8")
|
||||
doc.parsed_response['error'].should eq(true)
|
||||
doc.parsed_response['code'].should eq(400)
|
||||
doc.parsed_response['errorNum'].should eq(1700)
|
||||
end
|
||||
|
||||
it "add user, empty username" do
|
||||
body = "{ \"user\" : \"\", \"passwd\" : \"fox\" }"
|
||||
doc = ArangoDB.log_post("#{prefix}-add", api, :body => body)
|
||||
|
@ -163,23 +152,6 @@ describe ArangoDB do
|
|||
doc.parsed_response['errorNum'].should eq(1700)
|
||||
end
|
||||
|
||||
it "add user, no passwd, old API" do
|
||||
body = "{ \"username\" : \"users-1\" }"
|
||||
doc = ArangoDB.log_post("#{prefix}-add", api, :body => body)
|
||||
|
||||
doc.code.should eq(201)
|
||||
doc.headers['content-type'].should eq("application/json; charset=utf-8")
|
||||
doc.parsed_response['error'].should eq(false)
|
||||
doc.parsed_response['code'].should eq(201)
|
||||
|
||||
doc = ArangoDB.get(api + "/users-1")
|
||||
doc.code.should eq(200)
|
||||
doc.parsed_response['error'].should eq(false)
|
||||
doc.parsed_response['code'].should eq(200)
|
||||
doc.parsed_response['user'].should eq("users-1")
|
||||
doc.parsed_response['active'].should eq(true)
|
||||
end
|
||||
|
||||
it "add user, no passwd" do
|
||||
body = "{ \"user\" : \"users-1\" }"
|
||||
doc = ArangoDB.log_post("#{prefix}-add", api, :body => body)
|
||||
|
@ -197,23 +169,6 @@ describe ArangoDB do
|
|||
doc.parsed_response['active'].should eq(true)
|
||||
end
|
||||
|
||||
it "add user, username and passwd, old API" do
|
||||
body = "{ \"username\" : \"users-1\", \"passwd\" : \"fox\" }"
|
||||
doc = ArangoDB.log_post("#{prefix}-add", api, :body => body)
|
||||
|
||||
doc.code.should eq(201)
|
||||
doc.headers['content-type'].should eq("application/json; charset=utf-8")
|
||||
doc.parsed_response['error'].should eq(false)
|
||||
doc.parsed_response['code'].should eq(201)
|
||||
|
||||
doc = ArangoDB.get(api + "/users-1")
|
||||
doc.code.should eq(200)
|
||||
doc.parsed_response['error'].should eq(false)
|
||||
doc.parsed_response['code'].should eq(200)
|
||||
doc.parsed_response['user'].should eq("users-1")
|
||||
doc.parsed_response['active'].should eq(true)
|
||||
end
|
||||
|
||||
it "add user, username and passwd" do
|
||||
body = "{ \"user\" : \"users-1\", \"passwd\" : \"fox\" }"
|
||||
doc = ArangoDB.log_post("#{prefix}-add", api, :body => body)
|
||||
|
@ -231,24 +186,6 @@ describe ArangoDB do
|
|||
doc.parsed_response['active'].should eq(true)
|
||||
end
|
||||
|
||||
it "add user, username passwd, active, extra, old API" do
|
||||
body = "{ \"username\" : \"users-2\", \"passwd\" : \"fox\", \"active\" : false, \"extra\" : { \"foo\" : true } }"
|
||||
doc = ArangoDB.log_post("#{prefix}-add", api, :body => body)
|
||||
|
||||
doc.code.should eq(201)
|
||||
doc.headers['content-type'].should eq("application/json; charset=utf-8")
|
||||
doc.parsed_response['error'].should eq(false)
|
||||
doc.parsed_response['code'].should eq(201)
|
||||
|
||||
doc = ArangoDB.get(api + "/users-2")
|
||||
doc.code.should eq(200)
|
||||
doc.parsed_response['error'].should eq(false)
|
||||
doc.parsed_response['code'].should eq(200)
|
||||
doc.parsed_response['user'].should eq("users-2")
|
||||
doc.parsed_response['active'].should eq(false)
|
||||
doc.parsed_response['extra'].should eq({ "foo" => true })
|
||||
end
|
||||
|
||||
it "add user, username passwd, active, extra" do
|
||||
body = "{ \"user\" : \"users-2\", \"passwd\" : \"fox\", \"active\" : false, \"extra\" : { \"foo\" : true } }"
|
||||
doc = ArangoDB.log_post("#{prefix}-add", api, :body => body)
|
||||
|
@ -267,24 +204,6 @@ describe ArangoDB do
|
|||
doc.parsed_response['extra'].should eq({ "foo" => true })
|
||||
end
|
||||
|
||||
it "add user, duplicate username, old API" do
|
||||
body = "{ \"username\" : \"users-1\", \"passwd\" : \"fox\" }"
|
||||
doc = ArangoDB.log_post("#{prefix}-add", api, :body => body)
|
||||
|
||||
doc.code.should eq(201)
|
||||
doc.headers['content-type'].should eq("application/json; charset=utf-8")
|
||||
doc.parsed_response['error'].should eq(false)
|
||||
doc.parsed_response['code'].should eq(201)
|
||||
|
||||
doc = ArangoDB.log_post("#{prefix}-add", api, :body => body)
|
||||
|
||||
doc.code.should eq(400)
|
||||
doc.headers['content-type'].should eq("application/json; charset=utf-8")
|
||||
doc.parsed_response['error'].should eq(true)
|
||||
doc.parsed_response['code'].should eq(400)
|
||||
doc.parsed_response['errorNum'].should eq(1702)
|
||||
end
|
||||
|
||||
it "add user, duplicate username" do
|
||||
body = "{ \"user\" : \"users-1\", \"passwd\" : \"fox\" }"
|
||||
doc = ArangoDB.log_post("#{prefix}-add", api, :body => body)
|
||||
|
|
|
@ -39,17 +39,17 @@ namespace consensus {
|
|||
|
||||
enum JOB_STATUS {TODO, PENDING, FINISHED, FAILED, NOTFOUND};
|
||||
|
||||
static std::string const pendingPrefix = "/Target/Pending/";
|
||||
static std::string const pendingPrefix = "/Target/Pending/";
|
||||
static std::string const failedPrefix = "/Target/Failed/";
|
||||
static std::string const finishedPrefix = "/Target/Finished/";
|
||||
static std::string const failedPrefix = "/Target/Failed/";
|
||||
static std::string const cleanedPrefix = "Target/CleanedServers";
|
||||
static std::string const planColPrefix = "/Plan/Collections/";
|
||||
static std::string const curColPrefix = "/Current/Collections/";
|
||||
static std::string const toDoPrefix = "/Target/ToDo/";
|
||||
static std::string const toDoPrefix = "/Target/ToDo/";
|
||||
static std::string const cleanedPrefix = "Target/CleanedServers";
|
||||
static std::string const planColPrefix = "/Plan/Collections/";
|
||||
static std::string const curColPrefix = "/Current/Collections/";
|
||||
static std::string const blockedServersPrefix = "/Supervision/DBServers/";
|
||||
static std::string const blockedShardsPrefix = "/Supervision/Shards/";
|
||||
static std::string const serverStatePrefix = "/Sync/ServerStates/";
|
||||
static std::string const planVersion = "/Plan/Version";
|
||||
static std::string const planVersion = "/Plan/Version";
|
||||
|
||||
struct JobResult {
|
||||
JobResult() {}
|
||||
|
|
|
@ -265,11 +265,13 @@ void Supervision::run() {
|
|||
|
||||
void Supervision::workJobs() {
|
||||
|
||||
_snapshot = _agent->readDB().get("/");
|
||||
Node::Children const& todos = _snapshot(toDoPrefix).children();
|
||||
Node::Children const& pends = _snapshot(pendingPrefix).children();
|
||||
if (!todos.empty()) {
|
||||
for (auto const& todoEnt : todos) {
|
||||
Node const& job = *todoEnt.second;
|
||||
LOG(WARN) << __FILE__<<__LINE__ << job.toJson();
|
||||
|
||||
std::string jobType = job("type").getString(),
|
||||
jobId = job("jobId").getString(),
|
||||
creator = job("creator").getString();
|
||||
|
@ -280,11 +282,11 @@ void Supervision::workJobs() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Node::Children const& pends = _snapshot(pendingPrefix).children();
|
||||
if (!pends.empty()) {
|
||||
for (auto const& pendEnt : pends) {
|
||||
Node const& job = *pendEnt.second;
|
||||
LOG(WARN) << __FILE__<<__LINE__ << job.toJson();
|
||||
|
||||
std::string jobType = job("type").getString(),
|
||||
jobId = job("jobId").getString(),
|
||||
creator = job("creator").getString();
|
||||
|
|
Loading…
Reference in New Issue