kopia lustrzana https://github.com/ukhas/habitat-cpp-connector
Update to use fixed flights view
rodzic
64c18110fd
commit
86ba7e2dcc
|
@ -291,12 +291,12 @@ vector<Json::Value> *Uploader::flights()
|
||||||
const Json::Value &key = row["key"], &doc = row["doc"];
|
const Json::Value &key = row["key"], &doc = row["doc"];
|
||||||
|
|
||||||
bool doc_ok = doc.isObject() && doc.size();
|
bool doc_ok = doc.isObject() && doc.size();
|
||||||
bool key_ok = key.isArray() && key.size() == 3 && key[2u].isIntegral();
|
bool key_ok = key.isArray() && key.size() == 4 && key[3u].isIntegral();
|
||||||
|
|
||||||
if (!key_ok)
|
if (!key_ok)
|
||||||
throw runtime_error("Invalid response: bad key in row");
|
throw runtime_error("Invalid response: bad key in row");
|
||||||
|
|
||||||
bool is_pcfg = key[2u].asBool();
|
bool is_pcfg = key[3u].asBool();
|
||||||
|
|
||||||
if (!is_pcfg)
|
if (!is_pcfg)
|
||||||
{
|
{
|
||||||
|
|
|
@ -753,12 +753,13 @@ class TestCPPConnector:
|
||||||
pcfgs.append({"_id": "nonexistant_{0}".format(i)})
|
pcfgs.append({"_id": "nonexistant_{0}".format(i)})
|
||||||
for i in xrange(100):
|
for i in xrange(100):
|
||||||
payloads = random.sample(pcfgs, random.randint(1, 5))
|
payloads = random.sample(pcfgs, random.randint(1, 5))
|
||||||
doc = {"_id": "flight_{0}", "type": "flight", "i": i,
|
f_id = "flight_{0}".format(i)
|
||||||
|
doc = {"_id": f_id, "type": "flight", "i": i,
|
||||||
"payloads": [p["_id"] for p in payloads]}
|
"payloads": [p["_id"] for p in payloads]}
|
||||||
|
|
||||||
start = self.callbacks.fake_rfc3339(1000 + i)
|
start = self.callbacks.fake_rfc3339(1000 + i)
|
||||||
end = self.callbacks.fake_rfc3339(2000 + i)
|
end = self.callbacks.fake_rfc3339(2000 + i)
|
||||||
rows.append({"id": doc["_id"], "key": [end, start, 0],
|
rows.append({"id": f_id, "key": [end, start, f_id, 0],
|
||||||
"value": None, "doc": doc})
|
"value": None, "doc": doc})
|
||||||
|
|
||||||
expect_payloads = []
|
expect_payloads = []
|
||||||
|
@ -771,7 +772,7 @@ class TestCPPConnector:
|
||||||
else:
|
else:
|
||||||
expect_payloads.append(p)
|
expect_payloads.append(p)
|
||||||
|
|
||||||
rows.append({"id": doc["_id"], "key": [end, start, 1],
|
rows.append({"id": f_id, "key": [end, start, f_id, 1],
|
||||||
"value": {"_id": p_id}, "doc": p})
|
"value": {"_id": p_id}, "doc": p})
|
||||||
|
|
||||||
doc = copy.deepcopy(doc)
|
doc = copy.deepcopy(doc)
|
||||||
|
|
Ładowanie…
Reference in New Issue