8000 added test (#4840) · mnemosdev/arangodb@ed84399 · GitHub
[go: up one dir, main page]

Skip to content

Commit ed84399

Browse files
authored
added test (arangodb#4840)
1 parent 2f9324d commit ed84399

File tree

3 files changed

+82
-36
lines changed

3 files changed

+82
-36
lines changed

arangosh/Benchmark/BenchFeature.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ void BenchFeature::collectOptions(std::shared_ptr<ProgramOptions> options) {
115115
new BooleanParameter(&_waitForSync));
116116

117117
std::unordered_set<std::string> cases = {"version",
118+
"stream-cursor",
118119
"document",
119120
"collection",
120121
"import-document",

arangosh/Benchmark/test-cases.h

Lines changed: 76 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ static bool CreateIndex(SimpleHttpClient*, std::string const&,
3838
struct VersionTest : public BenchmarkOperation {
3939
VersionTest() : BenchmarkOperation() { _url = "/_api/version"; }
4040

41-
~VersionTest() {}
42-
4341
bool setUp(SimpleHttpClient* client) override { return true; }
4442

4543
void tearDown() override {}
@@ -70,8 +68,6 @@ struct VersionTest : public BenchmarkOperation {
7068
struct DocumentCrudAppendTest : public BenchmarkOperation {
7169
DocumentCrudAppendTest() : BenchmarkOperation() {}
7270

73-
~DocumentCrudAppendTest() {}
74-
7571
bool setUp(SimpleHttpClient* client) override {
7672
return DeleteCollection(client, ARANGOBENCH->collection()) &&
7773
CreateCollection(client, ARANGOBENCH->collection(), 2);
@@ -162,8 +158,6 @@ struct DocumentCrudAppendTest : public BenchmarkOperation {
162158
struct DocumentCrudWriteReadTest : public BenchmarkOperation {
163159
DocumentCrudWriteReadTest() : BenchmarkOperation() {}
164160

165-
~DocumentCrudWriteReadTest() {}
166-
167161
bool setUp(SimpleHttpClient* client) override {
168162
return DeleteCollection(client, ARANGOBENCH->collection()) &&
169163
CreateCollection(client, ARANGOBENCH->collection(), 2);
@@ -240,8 +234,6 @@ struct DocumentCrudWriteReadTest : public BenchmarkOperation {
240234
struct ShapesTest : public BenchmarkOperation {
241235
ShapesTest() : BenchmarkOperation() {}
242236

243-
~ShapesTest() {}
244-
245237
bool setUp(SimpleHttpClient* client) override {
246238
return DeleteCollection(client, ARANGOBENCH->collection()) &&
247239
CreateCollection(client, ARANGOBENCH->collection(), 2);
@@ -327,8 +319,6 @@ struct ShapesTest : public BenchmarkOperation {
327319
struct ShapesAppendTest : public BenchmarkOperation {
328320
ShapesAppendTest() : BenchmarkOperation() {}
329321

330-
~ShapesAppendTest() {}
331-
332322
bool setUp(SimpleHttpClient* client) override {
333323
return DeleteCollection(client, ARANGOBENCH->collection()) &&
334324
CreateCollection(client, ARANGOBENCH->collection(), 2);
@@ -413,8 +403,6 @@ struct RandomShapesTest : public BenchmarkOperation {
413403
_randomValue = RandomGenerator::interval(UINT32_MAX);
414404
}
415405

416-
~RandomShapesTest() {}
417-
418406
bool setUp(SimpleHttpClient* client) override {
419407
return DeleteCollection(client, ARANGOBENCH->collection()) &&
420408
CreateCollection(client, ARANGOBENCH->collection(), 2);
@@ -505,8 +493,6 @@ struct RandomShapesTest : public BenchmarkOperation {
505493
struct DocumentCrudTest : public BenchmarkOperation {
506494
DocumentCrudTest() : BenchmarkOperation() {}
507495

508-
~DocumentCrudTest() {}
509-
510496
bool setUp(SimpleHttpClient* client) override {
511497
return DeleteCollection(client, ARANGOBENCH->collection()) &&
512498
CreateCollection(client, ARANGOBENCH->collection(), 2);
@@ -599,8 +585,6 @@ struct DocumentCrudTest : public BenchmarkOperation {
599585
struct EdgeCrudTest : public BenchmarkOperation {
600586
EdgeCrudTest() : BenchmarkOperation() {}
601587

602-
~EdgeCrudTest() {}
603-
604588
bool setUp(SimpleHttpClient* client) override {
605589
return DeleteCollection(client, ARANGOBENCH->collection()) &&
606590
CreateCollection(client, ARANGOBENCH->collection(), 3);
@@ -710,8 +694,6 @@ struct EdgeCrudTest : public BenchmarkOperation {
710694
struct SkiplistTest : public BenchmarkOperation {
711695
SkiplistTest() : BenchmarkOperation() {}
712696

713-
~SkiplistTest() {}
714-
715697
bool setUp(SimpleHttpClient* client) override {
716698
return DeleteCollection(client, ARANGOBENCH->collection()) &&
717699
CreateCollection(client, ARANGOBENCH->collection(), 2) &&
@@ -795,8 +777,6 @@ struct SkiplistTest : public BenchmarkOperation {
795777
struct HashTest : public BenchmarkOperation {
796778
HashTest() : BenchmarkOperation() {}
797779

798-
~HashTest() {}
799-
800780
bool setUp(SimpleHttpClient* client) override {
801781
return DeleteCollection(client, ARANGOBENCH->collection()) &&
802782
CreateCollection(client, ARANGOBENCH->collection(), 2) &&
@@ -994,8 +974,6 @@ struct CollectionCreationTest : public BenchmarkOperation {
994974
_url = "/_api/collection";
995975
}
996976

997-
~CollectionCreationTest() {}
998-
999977
bool setUp(SimpleHttpClient* client) override { return true; }
1000978

1001979
void tearDown() override {}
@@ -1045,8 +1023,6 @@ std::atomic<uint64_t> CollectionCreationTest::_counter(0);
10451023
struct TransactionAqlTest : public BenchmarkOperation {
10461024
TransactionAqlTest() : BenchmarkOperation() {}
10471025

1048-
~TransactionAqlTest() {}
1049-
10501026
bool setUp(SimpleHttpClient* client) override {
10511027
_c1 = std::string(ARANGOBENCH->collection() + "1");
10521028
_c2 = std::string(ARANGOBENCH->collection() + "2");
@@ -1138,8 +1114,6 @@ struct TransactionAqlTest : public BenchmarkOperation {
11381114
struct TransactionCountTest : public BenchmarkOperation {
11391115
TransactionCountTest() : BenchmarkOperation() {}
11401116

1141-
~TransactionCountTest() {}
1142-
11431117
bool setUp(SimpleHttpClient* client) override {
11441118
return DeleteCollection(client, ARANGOBENCH->collection()) &&
11451119
CreateCollection(client, ARANGOBENCH->collection(), 2);
@@ -1187,8 +1161,6 @@ struct TransactionCountTest : public BenchmarkOperation {
11871161
struct TransactionDeadlockTest : public BenchmarkOperation {
11881162
TransactionDeadlockTest() : BenchmarkOperation() {}
11891163

1190-
~TransactionDeadlockTest() {}
1191-
11921164
bool setUp(SimpleHttpClient* client) override {
11931165
_c1 = std::string(ARANGOBENCH->collection() + "1");
11941166
_c2 = std::string(ARANGOBENCH->collection() + "2");
@@ -1255,8 +1227,6 @@ struct TransactionDeadlockTest : public BenchmarkOperation {
12551227
struct TransactionMultiTest : public BenchmarkOperation {
12561228
TransactionMultiTest() : BenchmarkOperation() {}
12571229

1258-
~TransactionMultiTest() {}
1259-
12601230
bool setUp(SimpleHttpClient* client) override {
12611231
_c1 = std::string(ARANGOBENCH->collection() + "1");
12621232
_c2 = std::string(ARANGOBENCH->collection() + "2");
@@ -1338,8 +1308,6 @@ struct TransactionMultiTest : public BenchmarkOperation {
13381308
struct TransactionMultiCollectionTest : public BenchmarkOperation {
13391309
TransactionMultiCollectionTest() : BenchmarkOperation() {}
13401310

1341-
~TransactionMultiCollectionTest() {}
1342-
13431311
bool setUp(SimpleHttpClient* client) override {
13441312
_c1 = std::string(ARANGOBENCH->collection() + "1");
13451313
_c2 = std::string(ARANGOBENCH->collection() + "2");
@@ -1410,11 +1378,82 @@ struct TransactionMultiCollectionTest : public BenchmarkOperation {
14101378
std::string _c2;
14111379
};
14121380

1381+
struct StreamCursorTest : public BenchmarkOperation {
1382+
StreamCursorTest() : BenchmarkOperation() {}
1383+
1384+
bool setUp(SimpleHttpClient* client) override {
1385+
return DeleteCollection(client, ARANGOBENCH->collection()) &&
1386+
CreateCollection(client, ARANGOBENCH->collection(), 2);
1387+
}
1388+
1389+
void tearDown() override {}
1390+
1391+
std::string url(int const threadNumber, size_t const threadCounter,
1392+
size_t const globalCounter) override {
1393+
return std::string("/_api/cursor");
1394+
}
1395+
1396+
rest::RequestType type(int const threadNumber, size_t const threadCounter,
1397+
size_t const globalCounter) override {
1398+
return rest::RequestType::POST;
1399+
}
1400+
1401+
char const* payload(size_t* length, int const threadNumber,
1402+
size_t const threadCounter, size_t const globalCounter,
1403+
bool* mustFree) override {
1404+
1405+
TRI_string_buffer_t* buffer;
1406+
buffer = TRI_CreateSizedStringBuffer(256);
1407+
1408+
size_t const mod = globalCounter % 2;
1409+
1410+
if (globalCounter == 0) {
1411+
TRI_AppendStringStringBuffer(buffer,
1412+
"{\"query\":\"FOR i IN 1..500 INSERT { _key: TO_STRING(i)");
1413+
1414+
uint64_t const n = ARANGOBENCH->complexity();
1415+
for (uint64_t i = 1; i <= n; ++i) {
1416+
TRI_AppendStringStringBuffer(buffer, ",\\\"value");
1417+
TRI_AppendUInt64StringBuffer(buffer, i);
1418+
TRI_AppendStringStringBuffer(buffer, "\\\":true");
1419+
}
1420+
1421+
TRI_AppendStringStringBuffer(buffer, " } INTO ");
1422+
TRI_AppendStringStringBuffer(buffer, ARANGOBENCH->collection().c_str());
1423+
TRI_AppendStringStringBuffer(buffer, "\"}"); //OPTIONS { ignoreErrors: true }");
1424+
} else if (mod == 0) {
1425+
TRI_AppendStringStringBuffer(buffer,
1426+
"{\"query\":\"UPDATE { _key: \\\"1\\\" } W EED3 ITH { \\\"foo\\\":1");
1427+
1428+
uint64_t const n = ARANGOBENCH->complexity();
1429+
for (uint64_t i = 1; i <= n; ++i) {
1430+
TRI_AppendStringStringBuffer(buffer, ",\\\"value");
1431+
TRI_AppendUInt64StringBuffer(buffer, i);
1432+
TRI_AppendStringStringBuffer(buffer, "\\\":true");
1433+
}
1434+
1435+
TRI_AppendStringStringBuffer(buffer, " } INTO ");
1436+
TRI_AppendStringStringBuffer(buffer, ARANGOBENCH->collection().c_str());
1437+
TRI_AppendStringStringBuffer(buffer, " OPTIONS { ignoreErrors: true }\"}");
1438+
} else {
1439+
TRI_AppendStringStringBuffer(buffer,
1440+
"{\"query\":\"FOR doc IN ");
1441+
TRI_AppendStringStringBuffer(buffer, ARANGOBENCH->collection().c_str());
1442+
TRI_AppendStringStringBuffer(buffer, " RETURN doc\",\"options\":{\"stream\":true}}");
1443+
}
1444+
1445+
*length = TRI_LengthStringBuffer(buffer);
1446+
*mustFree = true;
1447+
char* ptr = TRI_StealStringBuffer(buffer);
1448+
TRI_FreeStringBuffer(buffer);
1449+
1450+
return (char const*)ptr;
1451+
}
1452+
};
1453+
14131454
struct AqlInsertTest : public BenchmarkOperation {
14141455
AqlInsertTest() : BenchmarkOperation() {}
14151456

1416-
~AqlInsertTest() {}
1417-
14181457
bool setUp(SimpleHttpClient* client) override {
14191458
return DeleteCollection(client, ARANGOBENCH->collection()) &&
14201459
CreateCollection(client, ARANGOBENCH->collection(), 2);
@@ -1466,8 +1505,6 @@ struct AqlInsertTest : public BenchmarkOperation {
14661505
struct AqlV8Test : public BenchmarkOperation {
14671506
AqlV8Test() : BenchmarkOperation() {}
14681507

1469-
~AqlV8Test() {}
1470-
14711508
bool setUp(SimpleHttpClient* client) override {
14721509
return DeleteCollection(client, ARANGOBENCH->collection()) &&
14731510
CreateCollection(client, ARANGOBENCH->collection(), 2);
@@ -1701,6 +1738,9 @@ static BenchmarkOperation* GetTestCase(std::string const& name) {
17011738
if (name == "aqlv8") {
17021739
return new AqlV8Test();
17031740
}
1741+
if (name == "stream-cursor") {
1742+
return new StreamCursorTest();
1743+
}
17041744

17051745
return nullptr;
17061746
}

js/client/modules/@arangodb/testsuites/arangobench.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ const benchTodos = [{
6464
'concurrency': '1',
6565
'test-case': 'version',
6666
'async': 'true'
67+
}, {
68+
'requests': '10000',
69+
'concurrency': '3',
70+
'test-case': 'stream-cursor',
71+
'complexity': '4'
6772
}, {
6873
'requests': '100000',
6974
'concurrency': '2',

0 commit comments

Comments
 (0)
0