couchbase 4.1.0 → 4.1.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +8 -0
- package/deps/couchbase-cxx-client/.github/workflows/linters.yml +2 -2
- package/deps/couchbase-cxx-client/.github/workflows/sanitizers.yml +18 -2
- package/deps/couchbase-cxx-client/.github/workflows/tests.yml +14 -34
- package/deps/couchbase-cxx-client/.github/workflows/windows.yml +13 -15
- package/deps/couchbase-cxx-client/CMakeLists.txt +6 -1
- package/deps/couchbase-cxx-client/bin/build-tests +3 -0
- package/deps/couchbase-cxx-client/bin/build-tests.rb +3 -0
- package/deps/couchbase-cxx-client/bin/init-cluster +1 -1
- package/deps/couchbase-cxx-client/bin/run-tests +1 -1
- package/deps/couchbase-cxx-client/cmake/StandardProjectSettings.cmake +1 -1
- package/deps/couchbase-cxx-client/couchbase/cluster.hxx +25 -6
- package/deps/couchbase-cxx-client/couchbase/io/mcbp_session.hxx +21 -7
- package/deps/couchbase-cxx-client/couchbase/meta/version.cxx +7 -0
- package/deps/couchbase-cxx-client/couchbase/operations/document_decrement.cxx +0 -3
- package/deps/couchbase-cxx-client/couchbase/operations/document_decrement.hxx +0 -1
- package/deps/couchbase-cxx-client/couchbase/operations/document_increment.cxx +0 -3
- package/deps/couchbase-cxx-client/couchbase/operations/document_increment.hxx +0 -1
- package/deps/couchbase-cxx-client/couchbase/operations/management/analytics_dataset_get_all.cxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/operations/management/analytics_get_pending_mutations.cxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/operations/management/analytics_get_pending_mutations.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/operations/management/query_index_drop.cxx +4 -3
- package/deps/couchbase-cxx-client/couchbase/origin.hxx +10 -0
- package/deps/couchbase-cxx-client/couchbase/protocol/cmd_decrement.cxx +3 -8
- package/deps/couchbase-cxx-client/couchbase/protocol/cmd_decrement.hxx +0 -2
- package/deps/couchbase-cxx-client/couchbase/protocol/cmd_increment.cxx +0 -9
- package/deps/couchbase-cxx-client/couchbase/protocol/cmd_increment.hxx +0 -2
- package/deps/couchbase-cxx-client/couchbase/utils/json_streaming_lexer.cxx +6 -2
- package/deps/couchbase-cxx-client/test/test_integration_collections.cxx +4 -6
- package/deps/couchbase-cxx-client/test/test_integration_connect.cxx +4 -0
- package/deps/couchbase-cxx-client/test/test_integration_management.cxx +194 -138
- package/deps/couchbase-cxx-client/test/test_integration_query.cxx +26 -10
- package/deps/couchbase-cxx-client/test/test_unit_json_streaming_lexer.cxx +119 -0
- package/deps/couchbase-cxx-client/test/utils/integration_test_guard.cxx +1 -1
- package/deps/couchbase-cxx-client/test/utils/server_version.cxx +2 -1
- package/deps/couchbase-cxx-client/test/utils/server_version.hxx +22 -4
- package/deps/couchbase-cxx-client/test/utils/test_context.cxx +11 -1
- package/deps/couchbase-cxx-client/test/utils/test_context.hxx +1 -0
- package/deps/couchbase-transactions-cxx/CMakeLists.txt +2 -2
- package/deps/couchbase-transactions-cxx/deps/couchbase-cxx-client/couchbase/{management/design_document_fmt.hxx → design_document_namespace_fmt.hxx} +5 -5
- package/deps/couchbase-transactions-cxx/deps/couchbase-cxx-client/couchbase/operations/management/query_index_get_all.cxx +26 -16
- package/deps/couchbase-transactions-cxx/include/couchbase/transactions/durability_level.hxx +15 -0
- package/deps/couchbase-transactions-cxx/include/couchbase/transactions.hxx +2 -6
- package/deps/couchbase-transactions-cxx/src/transactions/attempt_context_impl.cxx +1 -1
- package/deps/couchbase-transactions-cxx/src/transactions/logging.cxx +20 -17
- package/deps/couchbase-transactions-cxx/tests/transactions/simple_t.cpp +22 -0
- package/deps/couchbase-transactions-cxx/tests/transactions/transactions_env.h +1 -1
- package/dist/binding.d.ts +0 -2
- package/dist/collection.js +0 -2
- package/dist/httpexecutor.d.ts +1 -0
- package/package.json +1 -1
- package/src/jstocbpp_autogen.hpp +3 -9
- package/deps/couchbase-cxx-client/.github/workflows/benchmarks.yml +0 -94
- package/deps/couchbase-transactions-cxx/deps/couchbase-cxx-client/.github/workflows/benchmarks.yml +0 -94
@@ -53,6 +53,10 @@ TEST_CASE("integration: bucket management", "[integration]")
|
|
53
53
|
{
|
54
54
|
test::utils::integration_test_guard integration;
|
55
55
|
|
56
|
+
if (!integration.cluster_version().supports_bucket_management()) {
|
57
|
+
return;
|
58
|
+
}
|
59
|
+
|
56
60
|
if (!integration.cluster_version().supports_gcccp()) {
|
57
61
|
test::utils::open_bucket(integration.cluster, integration.ctx.bucket);
|
58
62
|
}
|
@@ -377,7 +381,7 @@ TEST_CASE("integration: bucket management", "[integration]")
|
|
377
381
|
SECTION("magma")
|
378
382
|
{
|
379
383
|
{
|
380
|
-
bucket_settings.ram_quota_mb = 256;
|
384
|
+
bucket_settings.ram_quota_mb = integration.cluster_version().is_neo() ? 1'024 : 256;
|
381
385
|
bucket_settings.storage_backend = couchbase::management::cluster::bucket_storage_backend::magma;
|
382
386
|
couchbase::operations::management::bucket_create_request req{ bucket_settings };
|
383
387
|
auto resp = test::utils::execute(integration.cluster, req);
|
@@ -497,6 +501,7 @@ scope_exists(std::shared_ptr<couchbase::cluster> cluster, const std::string& buc
|
|
497
501
|
TEST_CASE("integration: collection management", "[integration]")
|
498
502
|
{
|
499
503
|
test::utils::integration_test_guard integration;
|
504
|
+
test::utils::open_bucket(integration.cluster, integration.ctx.bucket);
|
500
505
|
|
501
506
|
if (!integration.cluster_version().supports_collections()) {
|
502
507
|
return;
|
@@ -509,6 +514,8 @@ TEST_CASE("integration: collection management", "[integration]")
|
|
509
514
|
couchbase::operations::management::scope_create_request req{ integration.ctx.bucket, scope_name };
|
510
515
|
auto resp = test::utils::execute(integration.cluster, req);
|
511
516
|
REQUIRE_FALSE(resp.ctx.ec);
|
517
|
+
auto created = test::utils::wait_until_collection_manifest_propagated(integration.cluster, integration.ctx.bucket, resp.uid);
|
518
|
+
REQUIRE(created);
|
512
519
|
}
|
513
520
|
|
514
521
|
{
|
@@ -529,6 +536,8 @@ TEST_CASE("integration: collection management", "[integration]")
|
|
529
536
|
}
|
530
537
|
auto resp = test::utils::execute(integration.cluster, req);
|
531
538
|
REQUIRE_FALSE(resp.ctx.ec);
|
539
|
+
auto created = test::utils::wait_until_collection_manifest_propagated(integration.cluster, integration.ctx.bucket, resp.uid);
|
540
|
+
REQUIRE(created);
|
532
541
|
}
|
533
542
|
|
534
543
|
{
|
@@ -836,6 +845,10 @@ TEST_CASE("integration: user management", "[integration]")
|
|
836
845
|
{
|
837
846
|
test::utils::integration_test_guard integration;
|
838
847
|
|
848
|
+
if (!integration.cluster_version().supports_user_management()) {
|
849
|
+
return;
|
850
|
+
}
|
851
|
+
|
839
852
|
if (!integration.cluster_version().supports_gcccp()) {
|
840
853
|
test::utils::open_bucket(integration.cluster, integration.ctx.bucket);
|
841
854
|
}
|
@@ -868,7 +881,8 @@ TEST_CASE("integration: user management collections roles", "[integration]")
|
|
868
881
|
test::utils::integration_test_guard integration;
|
869
882
|
test::utils::open_bucket(integration.cluster, integration.ctx.bucket);
|
870
883
|
|
871
|
-
if (!integration.cluster_version().
|
884
|
+
if (!integration.cluster_version().supports_user_management() || !integration.cluster_version().supports_collections() ||
|
885
|
+
integration.cluster_version().is_community()) {
|
872
886
|
return;
|
873
887
|
}
|
874
888
|
|
@@ -947,42 +961,50 @@ TEST_CASE("integration: query index management", "[integration]")
|
|
947
961
|
return;
|
948
962
|
}
|
949
963
|
|
950
|
-
auto bucket_name = test::utils::uniq_id("bucket");
|
951
964
|
auto index_name = test::utils::uniq_id("index");
|
952
965
|
|
953
|
-
{
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
req.bucket.num_replicas = 0;
|
958
|
-
auto resp = test::utils::execute(integration.cluster, req);
|
959
|
-
}
|
966
|
+
if (integration.cluster_version().supports_bucket_management()) {
|
967
|
+
SECTION("primary index")
|
968
|
+
{
|
969
|
+
auto bucket_name = test::utils::uniq_id("bucket");
|
960
970
|
|
961
|
-
|
971
|
+
{
|
972
|
+
couchbase::operations::management::bucket_create_request req;
|
973
|
+
req.bucket.name = bucket_name;
|
974
|
+
req.bucket.bucket_type = couchbase::management::cluster::bucket_type::couchbase;
|
975
|
+
req.bucket.num_replicas = 0;
|
976
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
977
|
+
}
|
962
978
|
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
979
|
+
REQUIRE(!wait_for_bucket_created(integration, bucket_name).ctx.ec);
|
980
|
+
|
981
|
+
{
|
982
|
+
couchbase::operations::management::query_index_create_response resp;
|
983
|
+
bool operation_completed = test::utils::wait_until([&integration, &bucket_name, &resp]() {
|
984
|
+
couchbase::operations::management::query_index_create_request req{};
|
985
|
+
req.bucket_name = bucket_name;
|
986
|
+
req.is_primary = true;
|
987
|
+
resp = test::utils::execute(integration.cluster, req);
|
988
|
+
return resp.ctx.ec != couchbase::error::common_errc::bucket_not_found;
|
989
|
+
});
|
990
|
+
REQUIRE(operation_completed);
|
991
|
+
REQUIRE_FALSE(resp.ctx.ec);
|
992
|
+
}
|
993
|
+
|
994
|
+
{
|
995
|
+
couchbase::operations::management::query_index_get_all_request req{};
|
969
996
|
req.bucket_name = bucket_name;
|
970
|
-
|
971
|
-
resp
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
}
|
997
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
998
|
+
REQUIRE_FALSE(resp.ctx.ec);
|
999
|
+
REQUIRE(resp.indexes.size() == 1);
|
1000
|
+
REQUIRE(resp.indexes[0].name == "#primary");
|
1001
|
+
REQUIRE(resp.indexes[0].is_primary);
|
1002
|
+
}
|
977
1003
|
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
REQUIRE_FALSE(resp.ctx.ec);
|
983
|
-
REQUIRE(resp.indexes.size() == 1);
|
984
|
-
REQUIRE(resp.indexes[0].name == "#primary");
|
985
|
-
REQUIRE(resp.indexes[0].is_primary);
|
1004
|
+
{
|
1005
|
+
couchbase::operations::management::bucket_drop_request req{ bucket_name };
|
1006
|
+
test::utils::execute(integration.cluster, req);
|
1007
|
+
}
|
986
1008
|
}
|
987
1009
|
}
|
988
1010
|
|
@@ -990,11 +1012,11 @@ TEST_CASE("integration: query index management", "[integration]")
|
|
990
1012
|
{
|
991
1013
|
{
|
992
1014
|
couchbase::operations::management::query_index_create_response resp;
|
993
|
-
bool operation_completed = test::utils::wait_until([&integration, &
|
1015
|
+
bool operation_completed = test::utils::wait_until([&integration, &index_name, &resp]() {
|
994
1016
|
couchbase::operations::management::query_index_create_request req{};
|
995
|
-
req.bucket_name =
|
1017
|
+
req.bucket_name = integration.ctx.bucket;
|
996
1018
|
req.index_name = index_name;
|
997
|
-
req.fields = { "field" };
|
1019
|
+
req.fields = { "field", "field2 DESC", "`two words` DESC" };
|
998
1020
|
resp = test::utils::execute(integration.cluster, req);
|
999
1021
|
return resp.ctx.ec != couchbase::error::common_errc::bucket_not_found;
|
1000
1022
|
});
|
@@ -1004,7 +1026,7 @@ TEST_CASE("integration: query index management", "[integration]")
|
|
1004
1026
|
|
1005
1027
|
{
|
1006
1028
|
couchbase::operations::management::query_index_create_request req{};
|
1007
|
-
req.bucket_name =
|
1029
|
+
req.bucket_name = integration.ctx.bucket;
|
1008
1030
|
req.index_name = index_name;
|
1009
1031
|
req.fields = { "field" };
|
1010
1032
|
auto resp = test::utils::execute(integration.cluster, req);
|
@@ -1013,7 +1035,7 @@ TEST_CASE("integration: query index management", "[integration]")
|
|
1013
1035
|
|
1014
1036
|
{
|
1015
1037
|
couchbase::operations::management::query_index_create_request req{};
|
1016
|
-
req.bucket_name =
|
1038
|
+
req.bucket_name = integration.ctx.bucket;
|
1017
1039
|
req.index_name = index_name;
|
1018
1040
|
req.fields = { "field" };
|
1019
1041
|
req.ignore_if_exists = true;
|
@@ -1023,21 +1045,25 @@ TEST_CASE("integration: query index management", "[integration]")
|
|
1023
1045
|
|
1024
1046
|
{
|
1025
1047
|
couchbase::operations::management::query_index_get_all_request req{};
|
1026
|
-
req.bucket_name =
|
1048
|
+
req.bucket_name = integration.ctx.bucket;
|
1027
1049
|
auto resp = test::utils::execute(integration.cluster, req);
|
1028
1050
|
REQUIRE_FALSE(resp.ctx.ec);
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
REQUIRE(
|
1033
|
-
|
1034
|
-
REQUIRE(
|
1035
|
-
REQUIRE(
|
1051
|
+
auto index = std::find_if(
|
1052
|
+
resp.indexes.begin(), resp.indexes.end(), [&index_name](const auto& exp_index) { return exp_index.name == index_name; });
|
1053
|
+
REQUIRE(index != resp.indexes.end());
|
1054
|
+
REQUIRE(index->name == index_name);
|
1055
|
+
REQUIRE_FALSE(index->is_primary);
|
1056
|
+
REQUIRE(index->index_key.size() == 3);
|
1057
|
+
REQUIRE(index->index_key[0] == "`field`");
|
1058
|
+
REQUIRE(index->index_key[1] == "`field2` DESC");
|
1059
|
+
REQUIRE(index->index_key[2] == "`two words` DESC");
|
1060
|
+
REQUIRE(index->bucket_name == integration.ctx.bucket);
|
1061
|
+
REQUIRE(index->state == "online");
|
1036
1062
|
}
|
1037
1063
|
|
1038
1064
|
{
|
1039
1065
|
couchbase::operations::management::query_index_drop_request req{};
|
1040
|
-
req.bucket_name =
|
1066
|
+
req.bucket_name = integration.ctx.bucket;
|
1041
1067
|
req.index_name = index_name;
|
1042
1068
|
auto resp = test::utils::execute(integration.cluster, req);
|
1043
1069
|
REQUIRE_FALSE(resp.ctx.ec);
|
@@ -1045,7 +1071,7 @@ TEST_CASE("integration: query index management", "[integration]")
|
|
1045
1071
|
|
1046
1072
|
{
|
1047
1073
|
couchbase::operations::management::query_index_drop_request req{};
|
1048
|
-
req.bucket_name =
|
1074
|
+
req.bucket_name = integration.ctx.bucket;
|
1049
1075
|
req.index_name = index_name;
|
1050
1076
|
auto resp = test::utils::execute(integration.cluster, req);
|
1051
1077
|
REQUIRE(resp.ctx.ec == couchbase::error::common_errc::index_not_found);
|
@@ -1056,9 +1082,9 @@ TEST_CASE("integration: query index management", "[integration]")
|
|
1056
1082
|
{
|
1057
1083
|
{
|
1058
1084
|
couchbase::operations::management::query_index_create_response resp;
|
1059
|
-
bool operation_completed = test::utils::wait_until([&integration, &
|
1085
|
+
bool operation_completed = test::utils::wait_until([&integration, &index_name, &resp]() {
|
1060
1086
|
couchbase::operations::management::query_index_create_request req{};
|
1061
|
-
req.bucket_name =
|
1087
|
+
req.bucket_name = integration.ctx.bucket;
|
1062
1088
|
req.index_name = index_name;
|
1063
1089
|
req.fields = { "field" };
|
1064
1090
|
req.deferred = true;
|
@@ -1071,29 +1097,33 @@ TEST_CASE("integration: query index management", "[integration]")
|
|
1071
1097
|
|
1072
1098
|
{
|
1073
1099
|
couchbase::operations::management::query_index_get_all_request req{};
|
1074
|
-
req.bucket_name =
|
1100
|
+
req.bucket_name = integration.ctx.bucket;
|
1075
1101
|
auto resp = test::utils::execute(integration.cluster, req);
|
1076
1102
|
REQUIRE_FALSE(resp.ctx.ec);
|
1077
|
-
|
1078
|
-
|
1079
|
-
REQUIRE(resp.indexes
|
1103
|
+
auto index = std::find_if(
|
1104
|
+
resp.indexes.begin(), resp.indexes.end(), [&index_name](const auto& exp_index) { return exp_index.name == index_name; });
|
1105
|
+
REQUIRE(index != resp.indexes.end());
|
1106
|
+
REQUIRE(index->name == index_name);
|
1107
|
+
REQUIRE(index->state == "deferred");
|
1080
1108
|
}
|
1081
1109
|
|
1082
1110
|
{
|
1083
1111
|
couchbase::operations::management::query_index_build_deferred_request req{};
|
1084
|
-
req.bucket_name =
|
1112
|
+
req.bucket_name = integration.ctx.bucket;
|
1085
1113
|
auto resp = test::utils::execute(integration.cluster, req);
|
1086
1114
|
REQUIRE_FALSE(resp.ctx.ec);
|
1087
1115
|
}
|
1088
1116
|
|
1089
|
-
test::utils::wait_until([&integration,
|
1117
|
+
test::utils::wait_until([&integration, &index_name]() {
|
1090
1118
|
couchbase::operations::management::query_index_get_all_request req{};
|
1091
|
-
req.bucket_name =
|
1119
|
+
req.bucket_name = integration.ctx.bucket;
|
1092
1120
|
auto resp = test::utils::execute(integration.cluster, req);
|
1093
1121
|
if (resp.indexes.empty()) {
|
1094
1122
|
return false;
|
1095
1123
|
}
|
1096
|
-
|
1124
|
+
auto index = std::find_if(
|
1125
|
+
resp.indexes.begin(), resp.indexes.end(), [&index_name](const auto& exp_index) { return exp_index.name == index_name; });
|
1126
|
+
return index->state == "online";
|
1097
1127
|
});
|
1098
1128
|
}
|
1099
1129
|
|
@@ -1123,12 +1153,6 @@ TEST_CASE("integration: query index management", "[integration]")
|
|
1123
1153
|
auto resp = test::utils::execute(integration.cluster, req);
|
1124
1154
|
REQUIRE(resp.ctx.ec == couchbase::error::common_errc::bucket_not_found);
|
1125
1155
|
}
|
1126
|
-
|
1127
|
-
// drop any buckets that haven't already been dropped
|
1128
|
-
{
|
1129
|
-
couchbase::operations::management::bucket_drop_request req{ bucket_name };
|
1130
|
-
test::utils::execute(integration.cluster, req);
|
1131
|
-
}
|
1132
1156
|
}
|
1133
1157
|
|
1134
1158
|
TEST_CASE("integration: collections query index management", "[integration]")
|
@@ -1138,45 +1162,41 @@ TEST_CASE("integration: collections query index management", "[integration]")
|
|
1138
1162
|
if (!integration.cluster_version().supports_query_index_management()) {
|
1139
1163
|
return;
|
1140
1164
|
}
|
1165
|
+
|
1141
1166
|
if (!integration.cluster_version().supports_collections()) {
|
1142
1167
|
return;
|
1143
1168
|
}
|
1144
1169
|
|
1145
|
-
auto bucket_name = test::utils::uniq_id("collections_bucket");
|
1146
1170
|
auto index_name = test::utils::uniq_id("collections_index");
|
1147
1171
|
auto scope_name = test::utils::uniq_id("indexscope");
|
1148
1172
|
auto collection_name = test::utils::uniq_id("indexcollection");
|
1149
1173
|
|
1150
|
-
|
1151
|
-
couchbase::operations::management::bucket_create_request req;
|
1152
|
-
req.bucket.name = bucket_name;
|
1153
|
-
req.bucket.bucket_type = couchbase::management::cluster::bucket_type::couchbase;
|
1154
|
-
req.bucket.num_replicas = 0;
|
1155
|
-
auto resp = test::utils::execute(integration.cluster, req);
|
1156
|
-
}
|
1157
|
-
|
1158
|
-
REQUIRE(!wait_for_bucket_created(integration, bucket_name).ctx.ec);
|
1174
|
+
test::utils::open_bucket(integration.cluster, integration.ctx.bucket);
|
1159
1175
|
|
1160
1176
|
// create the scope and collection that we'll do index management on.
|
1161
1177
|
{
|
1162
|
-
couchbase::operations::management::scope_create_request req{
|
1178
|
+
couchbase::operations::management::scope_create_request req{ integration.ctx.bucket, scope_name };
|
1163
1179
|
auto resp = test::utils::execute(integration.cluster, req);
|
1164
1180
|
REQUIRE_FALSE(resp.ctx.ec);
|
1181
|
+
auto created = test::utils::wait_until_collection_manifest_propagated(integration.cluster, integration.ctx.bucket, resp.uid);
|
1182
|
+
REQUIRE(created);
|
1165
1183
|
}
|
1166
1184
|
|
1167
1185
|
{
|
1168
|
-
couchbase::operations::management::collection_create_request req{
|
1186
|
+
couchbase::operations::management::collection_create_request req{ integration.ctx.bucket, scope_name, collection_name };
|
1169
1187
|
auto resp = test::utils::execute(integration.cluster, req);
|
1170
1188
|
REQUIRE_FALSE(resp.ctx.ec);
|
1189
|
+
auto created = test::utils::wait_until_collection_manifest_propagated(integration.cluster, integration.ctx.bucket, resp.uid);
|
1190
|
+
REQUIRE(created);
|
1171
1191
|
}
|
1172
1192
|
|
1173
1193
|
SECTION("primary index")
|
1174
1194
|
{
|
1175
1195
|
{
|
1176
1196
|
couchbase::operations::management::query_index_create_response resp;
|
1177
|
-
bool operation_completed = test::utils::wait_until([&integration, &
|
1197
|
+
bool operation_completed = test::utils::wait_until([&integration, &scope_name, &collection_name, &resp]() {
|
1178
1198
|
couchbase::operations::management::query_index_create_request req{};
|
1179
|
-
req.bucket_name =
|
1199
|
+
req.bucket_name = integration.ctx.bucket;
|
1180
1200
|
req.scope_name = scope_name;
|
1181
1201
|
req.collection_name = collection_name;
|
1182
1202
|
req.is_primary = true;
|
@@ -1189,7 +1209,7 @@ TEST_CASE("integration: collections query index management", "[integration]")
|
|
1189
1209
|
|
1190
1210
|
{
|
1191
1211
|
couchbase::operations::management::query_index_get_all_request req{};
|
1192
|
-
req.bucket_name =
|
1212
|
+
req.bucket_name = integration.ctx.bucket;
|
1193
1213
|
req.scope_name = scope_name;
|
1194
1214
|
req.collection_name = collection_name;
|
1195
1215
|
auto resp = test::utils::execute(integration.cluster, req);
|
@@ -1200,28 +1220,69 @@ TEST_CASE("integration: collections query index management", "[integration]")
|
|
1200
1220
|
}
|
1201
1221
|
}
|
1202
1222
|
|
1223
|
+
SECTION("named primary index")
|
1224
|
+
{
|
1225
|
+
{
|
1226
|
+
couchbase::operations::management::query_index_create_response resp;
|
1227
|
+
bool operation_completed = test::utils::wait_until([&integration, &index_name, &scope_name, &collection_name, &resp]() {
|
1228
|
+
couchbase::operations::management::query_index_create_request req{};
|
1229
|
+
req.bucket_name = integration.ctx.bucket;
|
1230
|
+
req.scope_name = scope_name;
|
1231
|
+
req.collection_name = collection_name;
|
1232
|
+
req.index_name = index_name;
|
1233
|
+
req.is_primary = true;
|
1234
|
+
resp = test::utils::execute(integration.cluster, req);
|
1235
|
+
return resp.ctx.ec != couchbase::error::common_errc::bucket_not_found;
|
1236
|
+
});
|
1237
|
+
REQUIRE(operation_completed);
|
1238
|
+
REQUIRE_FALSE(resp.ctx.ec);
|
1239
|
+
}
|
1240
|
+
|
1241
|
+
{
|
1242
|
+
couchbase::operations::management::query_index_get_all_request req{};
|
1243
|
+
req.bucket_name = integration.ctx.bucket;
|
1244
|
+
req.scope_name = scope_name;
|
1245
|
+
req.collection_name = collection_name;
|
1246
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
1247
|
+
REQUIRE_FALSE(resp.ctx.ec);
|
1248
|
+
REQUIRE(resp.indexes.size() == 1);
|
1249
|
+
REQUIRE(resp.indexes[0].name == index_name);
|
1250
|
+
REQUIRE(resp.indexes[0].is_primary);
|
1251
|
+
}
|
1252
|
+
|
1253
|
+
{
|
1254
|
+
couchbase::operations::management::query_index_drop_request req{};
|
1255
|
+
req.bucket_name = integration.ctx.bucket;
|
1256
|
+
req.index_name = index_name;
|
1257
|
+
req.scope_name = scope_name;
|
1258
|
+
req.is_primary = true;
|
1259
|
+
req.collection_name = collection_name;
|
1260
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
1261
|
+
REQUIRE_FALSE(resp.ctx.ec);
|
1262
|
+
}
|
1263
|
+
}
|
1264
|
+
|
1203
1265
|
SECTION("non primary index")
|
1204
1266
|
{
|
1205
1267
|
{
|
1206
1268
|
couchbase::operations::management::query_index_create_response resp;
|
1207
|
-
bool operation_completed =
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
});
|
1269
|
+
bool operation_completed = test::utils::wait_until([&integration, &index_name, &scope_name, &collection_name, &resp]() {
|
1270
|
+
couchbase::operations::management::query_index_create_request req{};
|
1271
|
+
req.bucket_name = integration.ctx.bucket;
|
1272
|
+
req.index_name = index_name;
|
1273
|
+
req.scope_name = scope_name;
|
1274
|
+
req.collection_name = collection_name;
|
1275
|
+
req.fields = { "field" };
|
1276
|
+
resp = test::utils::execute(integration.cluster, req);
|
1277
|
+
return resp.ctx.ec != couchbase::error::common_errc::bucket_not_found;
|
1278
|
+
});
|
1218
1279
|
REQUIRE(operation_completed);
|
1219
1280
|
REQUIRE_FALSE(resp.ctx.ec);
|
1220
1281
|
}
|
1221
1282
|
|
1222
1283
|
{
|
1223
1284
|
couchbase::operations::management::query_index_create_request req{};
|
1224
|
-
req.bucket_name =
|
1285
|
+
req.bucket_name = integration.ctx.bucket;
|
1225
1286
|
req.index_name = index_name;
|
1226
1287
|
req.scope_name = scope_name;
|
1227
1288
|
req.collection_name = collection_name;
|
@@ -1232,7 +1293,7 @@ TEST_CASE("integration: collections query index management", "[integration]")
|
|
1232
1293
|
|
1233
1294
|
{
|
1234
1295
|
couchbase::operations::management::query_index_create_request req{};
|
1235
|
-
req.bucket_name =
|
1296
|
+
req.bucket_name = integration.ctx.bucket;
|
1236
1297
|
req.index_name = index_name;
|
1237
1298
|
req.scope_name = scope_name;
|
1238
1299
|
req.collection_name = collection_name;
|
@@ -1244,7 +1305,7 @@ TEST_CASE("integration: collections query index management", "[integration]")
|
|
1244
1305
|
|
1245
1306
|
{
|
1246
1307
|
couchbase::operations::management::query_index_get_all_request req{};
|
1247
|
-
req.bucket_name =
|
1308
|
+
req.bucket_name = integration.ctx.bucket;
|
1248
1309
|
req.scope_name = scope_name;
|
1249
1310
|
req.collection_name = collection_name;
|
1250
1311
|
auto resp = test::utils::execute(integration.cluster, req);
|
@@ -1256,13 +1317,13 @@ TEST_CASE("integration: collections query index management", "[integration]")
|
|
1256
1317
|
REQUIRE(resp.indexes[0].index_key[0] == "`field`");
|
1257
1318
|
REQUIRE(resp.indexes[0].collection_name == collection_name);
|
1258
1319
|
REQUIRE(resp.indexes[0].scope_name == scope_name);
|
1259
|
-
REQUIRE(resp.indexes[0].bucket_name ==
|
1320
|
+
REQUIRE(resp.indexes[0].bucket_name == integration.ctx.bucket);
|
1260
1321
|
REQUIRE(resp.indexes[0].state == "online");
|
1261
1322
|
}
|
1262
1323
|
|
1263
1324
|
{
|
1264
1325
|
couchbase::operations::management::query_index_drop_request req{};
|
1265
|
-
req.bucket_name =
|
1326
|
+
req.bucket_name = integration.ctx.bucket;
|
1266
1327
|
req.index_name = index_name;
|
1267
1328
|
req.scope_name = scope_name;
|
1268
1329
|
req.collection_name = collection_name;
|
@@ -1272,7 +1333,7 @@ TEST_CASE("integration: collections query index management", "[integration]")
|
|
1272
1333
|
|
1273
1334
|
{
|
1274
1335
|
couchbase::operations::management::query_index_drop_request req{};
|
1275
|
-
req.bucket_name =
|
1336
|
+
req.bucket_name = integration.ctx.bucket;
|
1276
1337
|
req.index_name = index_name;
|
1277
1338
|
req.scope_name = scope_name;
|
1278
1339
|
req.collection_name = collection_name;
|
@@ -1285,25 +1346,24 @@ TEST_CASE("integration: collections query index management", "[integration]")
|
|
1285
1346
|
{
|
1286
1347
|
{
|
1287
1348
|
couchbase::operations::management::query_index_create_response resp;
|
1288
|
-
bool operation_completed =
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1299
|
-
});
|
1349
|
+
bool operation_completed = test::utils::wait_until([&integration, &index_name, &scope_name, &collection_name, &resp]() {
|
1350
|
+
couchbase::operations::management::query_index_create_request req{};
|
1351
|
+
req.bucket_name = integration.ctx.bucket;
|
1352
|
+
req.index_name = index_name;
|
1353
|
+
req.scope_name = scope_name;
|
1354
|
+
req.collection_name = collection_name;
|
1355
|
+
req.fields = { "field" };
|
1356
|
+
req.deferred = true;
|
1357
|
+
resp = test::utils::execute(integration.cluster, req);
|
1358
|
+
return resp.ctx.ec != couchbase::error::common_errc::bucket_not_found;
|
1359
|
+
});
|
1300
1360
|
REQUIRE(operation_completed);
|
1301
1361
|
REQUIRE_FALSE(resp.ctx.ec);
|
1302
1362
|
}
|
1303
1363
|
|
1304
1364
|
{
|
1305
1365
|
couchbase::operations::management::query_index_get_all_request req{};
|
1306
|
-
req.bucket_name =
|
1366
|
+
req.bucket_name = integration.ctx.bucket;
|
1307
1367
|
req.scope_name = scope_name;
|
1308
1368
|
req.collection_name = collection_name;
|
1309
1369
|
auto resp = test::utils::execute(integration.cluster, req);
|
@@ -1315,16 +1375,16 @@ TEST_CASE("integration: collections query index management", "[integration]")
|
|
1315
1375
|
|
1316
1376
|
{
|
1317
1377
|
couchbase::operations::management::query_index_build_deferred_request req{};
|
1318
|
-
req.bucket_name =
|
1378
|
+
req.bucket_name = integration.ctx.bucket;
|
1319
1379
|
req.scope_name = scope_name;
|
1320
1380
|
req.collection_name = collection_name;
|
1321
1381
|
auto resp = test::utils::execute(integration.cluster, req);
|
1322
1382
|
REQUIRE_FALSE(resp.ctx.ec);
|
1323
1383
|
}
|
1324
1384
|
|
1325
|
-
test::utils::wait_until([&integration,
|
1385
|
+
test::utils::wait_until([&integration, scope_name, collection_name]() {
|
1326
1386
|
couchbase::operations::management::query_index_get_all_request req{};
|
1327
|
-
req.bucket_name =
|
1387
|
+
req.bucket_name = integration.ctx.bucket;
|
1328
1388
|
req.scope_name = scope_name;
|
1329
1389
|
req.collection_name = collection_name;
|
1330
1390
|
auto resp = test::utils::execute(integration.cluster, req);
|
@@ -1338,7 +1398,7 @@ TEST_CASE("integration: collections query index management", "[integration]")
|
|
1338
1398
|
SECTION("create missing collection")
|
1339
1399
|
{
|
1340
1400
|
couchbase::operations::management::query_index_create_request req{};
|
1341
|
-
req.bucket_name =
|
1401
|
+
req.bucket_name = integration.ctx.bucket;
|
1342
1402
|
req.scope_name = scope_name;
|
1343
1403
|
req.collection_name = "missing_collection";
|
1344
1404
|
req.is_primary = true;
|
@@ -1349,7 +1409,7 @@ TEST_CASE("integration: collections query index management", "[integration]")
|
|
1349
1409
|
SECTION("create missing scope")
|
1350
1410
|
{
|
1351
1411
|
couchbase::operations::management::query_index_create_request req{};
|
1352
|
-
req.bucket_name =
|
1412
|
+
req.bucket_name = integration.ctx.bucket;
|
1353
1413
|
req.scope_name = "missing_scope";
|
1354
1414
|
req.collection_name = collection_name;
|
1355
1415
|
req.is_primary = true;
|
@@ -1360,7 +1420,7 @@ TEST_CASE("integration: collections query index management", "[integration]")
|
|
1360
1420
|
SECTION("get missing collection")
|
1361
1421
|
{
|
1362
1422
|
couchbase::operations::management::query_index_get_all_request req{};
|
1363
|
-
req.bucket_name =
|
1423
|
+
req.bucket_name = integration.ctx.bucket;
|
1364
1424
|
req.scope_name = scope_name;
|
1365
1425
|
req.collection_name = "missing_collection";
|
1366
1426
|
auto resp = test::utils::execute(integration.cluster, req);
|
@@ -1371,7 +1431,7 @@ TEST_CASE("integration: collections query index management", "[integration]")
|
|
1371
1431
|
SECTION("drop missing collection")
|
1372
1432
|
{
|
1373
1433
|
couchbase::operations::management::query_index_drop_request req{};
|
1374
|
-
req.bucket_name =
|
1434
|
+
req.bucket_name = integration.ctx.bucket;
|
1375
1435
|
req.scope_name = scope_name;
|
1376
1436
|
req.collection_name = "missing_collection";
|
1377
1437
|
req.is_primary = true;
|
@@ -1382,19 +1442,13 @@ TEST_CASE("integration: collections query index management", "[integration]")
|
|
1382
1442
|
SECTION("drop missing scope")
|
1383
1443
|
{
|
1384
1444
|
couchbase::operations::management::query_index_drop_request req{};
|
1385
|
-
req.bucket_name =
|
1445
|
+
req.bucket_name = integration.ctx.bucket;
|
1386
1446
|
req.scope_name = "missing_scope";
|
1387
1447
|
req.collection_name = collection_name;
|
1388
1448
|
req.is_primary = true;
|
1389
1449
|
auto resp = test::utils::execute(integration.cluster, req);
|
1390
1450
|
REQUIRE(resp.ctx.ec == couchbase::error::common_errc::scope_not_found);
|
1391
1451
|
}
|
1392
|
-
|
1393
|
-
// drop any buckets that haven't already been dropped
|
1394
|
-
{
|
1395
|
-
couchbase::operations::management::bucket_drop_request req{ bucket_name };
|
1396
|
-
test::utils::execute(integration.cluster, req);
|
1397
|
-
}
|
1398
1452
|
}
|
1399
1453
|
|
1400
1454
|
TEST_CASE("integration: analytics index management", "[integration]")
|
@@ -2346,23 +2400,25 @@ TEST_CASE("integration: freeform HTTP request", "[integration]")
|
|
2346
2400
|
REQUIRE(result.is_object());
|
2347
2401
|
}
|
2348
2402
|
|
2349
|
-
|
2350
|
-
|
2351
|
-
|
2352
|
-
|
2403
|
+
if (integration.cluster_version().supports_views()) {
|
2404
|
+
SECTION("view")
|
2405
|
+
{
|
2406
|
+
auto document_name = test::utils::uniq_id("design_document");
|
2407
|
+
auto view_name = test::utils::uniq_id("view");
|
2353
2408
|
|
2354
|
-
|
2355
|
-
|
2356
|
-
|
2357
|
-
|
2358
|
-
|
2359
|
-
|
2360
|
-
|
2361
|
-
|
2362
|
-
|
2363
|
-
|
2364
|
-
|
2365
|
-
|
2409
|
+
couchbase::operations::management::freeform_request req{};
|
2410
|
+
req.type = couchbase::service_type::view;
|
2411
|
+
req.method = "POST";
|
2412
|
+
req.path = fmt::format("/{}/_design/{}/_view/{}", integration.ctx.bucket, document_name, view_name);
|
2413
|
+
req.body = R"({"keys":["foo","bar"]})";
|
2414
|
+
auto resp = test::utils::execute(integration.cluster, req);
|
2415
|
+
REQUIRE_FALSE(resp.ctx.ec);
|
2416
|
+
REQUIRE(resp.status == 404);
|
2417
|
+
REQUIRE_FALSE(resp.body.empty());
|
2418
|
+
auto result = couchbase::utils::json::parse(resp.body);
|
2419
|
+
INFO(resp.body)
|
2420
|
+
REQUIRE(result["error"].get_string() == "not_found");
|
2421
|
+
}
|
2366
2422
|
}
|
2367
2423
|
|
2368
2424
|
SECTION("management")
|