Skip to content

Commit ccabb0a

Browse files
removed the excess
1 parent f9b999f commit ccabb0a

File tree

4 files changed

+8
-33
lines changed

4 files changed

+8
-33
lines changed

tests/integration/pagination_it/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ add_ydb_test(NAME pagination_it
66
pagination.h
77
LINK_LIBRARIES
88
yutil
9-
library-getopt
109
YDB-CPP-SDK::Table
1110
GTest::gtest_main
1211
public-lib-json_value
Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,28 @@
11
#include "pagination.h"
22

3-
#include <src/library/getopt/last_getopt.h>
43
#include <ydb-cpp-sdk/json_value/ydb_json_value.h>
54

65
#include <gtest/gtest.h>
76

8-
using namespace NLastGetopt;
97
using namespace NYdb;
108

119
const uint32_t MaxPages = 10;
1210

13-
void StopHandler(int) {
14-
exit(1);
15-
}
16-
17-
RunArgs getRunArgs() {
18-
TOpts opts = TOpts::Default();
19-
20-
std::string database = std::getenv( "DATABASE" );
21-
std::string endpoint = std::getenv( "ENDPOINT" );
22-
std::string path;
23-
24-
if (path.empty()) {
25-
path = database;
26-
}
11+
RunArgs GetRunArgs() {
12+
std::string database = std::getenv("YDB_DATABASE");
13+
std::string endpoint = std::getenv("YDB_ENDPOINT");
2714

2815
auto driverConfig = TDriverConfig()
2916
.SetEndpoint(endpoint)
3017
.SetDatabase(database)
3118
.SetAuthToken(std::getenv("YDB_TOKEN") ? std::getenv("YDB_TOKEN") : "");
19+
3220
TDriver driver(driverConfig);
33-
34-
return {driver, path};
21+
return {driver, database};
3522
}
3623

3724
TEST(Integration, Pagination) {
38-
25+
3926
std::vector<std::string> mapPagToJson = {
4027
"{\"address\":\"Кирова, 6\",\"city\":\"Кирс\",\"number\":3}\n{\"address\":\"Урицкого, 21\",\"city\":\"Котельнич\",\"number\":1}\n{\"address\":\"Октябрьская, 109\",\"city\":\"Котельнич\",\"number\":2}\n",
4128
"{\"address\":\"Советская, 153\",\"city\":\"Котельнич\",\"number\":3}\n{\"address\":\"Школьная, 2\",\"city\":\"Котельнич\",\"number\":5}\n{\"address\":\"Октябрьская, 91\",\"city\":\"Котельнич\",\"number\":15}\n",
@@ -45,7 +32,7 @@ TEST(Integration, Pagination) {
4532
""
4633
};
4734

48-
auto [driver, path] = getRunArgs();
35+
auto [driver, path] = GetRunArgs();
4936

5037
TTableClient client(driver);
5138

@@ -62,19 +49,15 @@ TEST(Integration, Pagination) {
6249
uint32_t page = 0;
6350
std::string currentResultSet = " ";
6451

65-
std::cout << "> Pagination, Limit=" << limit << std::endl;
66-
6752
// show first MaxPages=10 pages:
6853
while (!currentResultSet.empty() && page <= MaxPages) {
6954
++page;
70-
std::cout << "> Page " << page << ":" << std::endl;
7155
currentResultSet = SelectPaging(client, path, limit, lastCity, lastNumber);
7256
ASSERT_EQ(mapPagToJson[page - 1], currentResultSet);
7357
}
7458
}
7559
catch (const TYdbErrorException& e) {
7660
std::cerr << "Execution failed due to fatal error:" << std::endl;
77-
PrintStatus(e.Status);
7861
FAIL();
7962
}
8063
}

tests/integration/pagination_it/pagination.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ void ThrowOnError(const TStatus& status) {
1111
}
1212
}
1313

14-
void PrintStatus(const TStatus& status) {
15-
std::cerr << "Status: " << ToString(status.GetStatus()) << std::endl;
16-
status.GetIssues().PrintTo(std::cerr);
17-
}
18-
1914
static std::string JoinPath(const std::string& basePath, const std::string& path) {
2015
if (basePath.empty()) {
2116
return path;
@@ -140,8 +135,7 @@ std::string SelectPaging(TTableClient client, const std::string& path, uint64_t
140135
do {
141136
lastCity = parser.ColumnParser("city").GetOptionalUtf8().value();
142137
lastNumber = parser.ColumnParser("number").GetOptionalUint32().value();
143-
std::cout << lastCity << ", Школа №" << lastNumber << ", Адрес: " << ToString(parser.ColumnParser("address").GetOptionalUtf8()) << std::endl;
144138
} while (parser.TryNextRow());
145-
return FormatResultSetJson(resultSet.value(), EBinaryStringEncoding::Unicode);;
139+
return FormatResultSetJson(resultSet.value(), EBinaryStringEncoding::Unicode);
146140
}
147141

tests/integration/pagination_it/pagination.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,3 @@ void CreateTable(TTableClient client, const std::string& path);
2525
void ThrowOnError(const TStatus& status);
2626
TStatus FillTableDataTransaction(TSession& session, const std::string& path);
2727
std::string SelectPaging(TTableClient client, const std::string& path, uint64_t pageLimit, std::string& lastCity, uint32_t& lastNumber);
28-
void PrintStatus(const TStatus& status);

0 commit comments

Comments
 (0)