Skip to content

Commit 151b461

Browse files
jrawsthorneavsej
authored andcommitted
SDKQE-2596: Search query testing for CB++
1 parent c388df5 commit 151b461

13 files changed

+755
-31
lines changed

test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ integration_test(arithmetic)
1111
integration_test(collections)
1212
integration_test(subdoc)
1313
integration_test(analytics)
14+
integration_test(search)
1415

1516
unit_test(connection_string)
1617
unit_test(utils)

test/data/search_beers_dataset.json

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"four_peaks_brewing-abbey_normal_ale": {
3+
"name": "Abbey Normal Ale",
4+
"abv": 0.0,
5+
"ibu": 0.0,
6+
"srm": 0.0,
7+
"upc": 0,
8+
"type": "beer",
9+
"brewery_id": "four_peaks_brewing",
10+
"updated": "2010-07-22 20:00:20",
11+
"description": "A Belgian Double Abbey.",
12+
"style": "Other Belgian-Style Ales",
13+
"category": "Belgian and French Ale"
14+
},
15+
"avery_brewing_company-reverend_the": {
16+
"name": "Reverend, The",
17+
"abv": 10.0,
18+
"ibu": 0.0,
19+
"srm": 0.0,
20+
"upc": 0,
21+
"type": "beer",
22+
"brewery_id": "avery_brewing_company",
23+
"updated": "2010-07-22 20:00:20",
24+
"description": "Belgian-Style Quadrupel Ale",
25+
"style": "Belgian-Style Quadrupel",
26+
"category": "Belgian and French Ale"
27+
},
28+
"dragonmead_microbrewery-dubbel_dragon": {
29+
"name": "Dubbel Dragon",
30+
"abv": 7.2,
31+
"ibu": 0.0,
32+
"srm": 0.0,
33+
"upc": 0,
34+
"type": "beer",
35+
"brewery_id": "dragonmead_microbrewery",
36+
"updated": "2010-07-22 20:00:20",
37+
"description": "This Dubbel style Belgian beer is created in the great Belgian tradition. Pale Malt, Caramel and Special B Malts impart a unique sweetness to this beer. The traditional Belgian yeast fully ferments the Belgian Candi Sugar to give a satisfying taste that is twice what a Belgian pale delivers.",
38+
"style": "Other Belgian-Style Ales",
39+
"category": "Belgian and French Ale"
40+
},
41+
"f_x_matt_brewing-saranac_belgian_ale": {
42+
"name": "Saranac Belgian Ale",
43+
"abv": 5.9,
44+
"ibu": 0.0,
45+
"srm": 0.0,
46+
"upc": 0,
47+
"type": "beer",
48+
"brewery_id": "f_x_matt_brewing",
49+
"updated": "2010-07-22 20:00:20",
50+
"description": "Saranac Belgian Ale is Deliciously Fruity. It is brewed with a generous amount of Belgian Aromatic Malt, Hand selected hops, and a traditional Belgian ale yeast. Brewed in the \"Trappist Style\".",
51+
"style": "Other Belgian-Style Ales",
52+
"category": "Belgian and French Ale"
53+
},
54+
"bear_republic_brewery-red_rocket_ale": {
55+
"name": "Red Rocket Ale",
56+
"abv": 6.8,
57+
"ibu": 0.0,
58+
"srm": 0.0,
59+
"upc": 0,
60+
"type": "beer",
61+
"brewery_id": "bear_republic_brewery",
62+
"updated": "2010-08-22 20:00:20",
63+
"description": "The brew of choice for mountain bikers, and adventurous types worldwide. (Are you excited now!) This fiery red ale is not for the weak at heart. It originally started out as a Scottish red ale but has taken on flavors of its own. This is a very complex recipe using five different grains to achieve its unique flavor. The caramel malt used is a mixture of Belgian Caravienne and Hugh Bairds Crystal malts. Red Rocket is a full bodied, hoppy brew which finishes on the pallet with caramel malts. Centennial and Cascade hops are used for bittering and aroma.2004 L.A. Commercial Brewing Competition, Gold Medal Winner; 2004 West Coast Commercial Brewers Competition, First Place; 2003 California State Fair, Gold MedalWinner; 2002 California State Fair, Silver Medal Winner; 2001 California State Fair Gold Medal Winner; 2001 Real Ale Festival, Chicago, Bronze Medal Winner; 2000 California State Fair, Bronze Medal Winner; 1999 Great American Beer Festival, Silver Medal Winner; 1998 Great American Beer Festival, Silver Medal Winner - og 1.067, ABV 6.8%, IBU 65+.",
64+
"style": "American-Style Amber/Red Ale",
65+
"category": "North American Ale"
66+
}
67+
}
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
{
2+
"doc_config": {
3+
"docid_prefix_delim": "",
4+
"docid_regexp": "",
5+
"mode": "type_field",
6+
"type_field": "type"
7+
},
8+
"mapping": {
9+
"default_analyzer": "standard",
10+
"default_datetime_parser": "dateTimeOptional",
11+
"default_field": "_all",
12+
"default_mapping": {
13+
"dynamic": true,
14+
"enabled": false
15+
},
16+
"default_type": "_default",
17+
"docvalues_dynamic": true,
18+
"index_dynamic": false,
19+
"store_dynamic": false,
20+
"type_field": "_type",
21+
"types": {
22+
"beer": {
23+
"dynamic": false,
24+
"enabled": true,
25+
"properties": {
26+
"category": {
27+
"enabled": true,
28+
"dynamic": false,
29+
"fields": [
30+
{
31+
"docvalues": true,
32+
"include_in_all": true,
33+
"include_term_vectors": true,
34+
"index": true,
35+
"name": "category",
36+
"store": true,
37+
"type": "text"
38+
}
39+
]
40+
},
41+
"description": {
42+
"enabled": true,
43+
"dynamic": false,
44+
"fields": [
45+
{
46+
"docvalues": true,
47+
"include_in_all": true,
48+
"include_term_vectors": true,
49+
"index": true,
50+
"name": "description",
51+
"store": true,
52+
"type": "text"
53+
}
54+
]
55+
},
56+
"type": {
57+
"enabled": true,
58+
"dynamic": false,
59+
"fields": [
60+
{
61+
"docvalues": true,
62+
"include_in_all": true,
63+
"include_term_vectors": true,
64+
"index": true,
65+
"name": "type",
66+
"store": true,
67+
"type": "text"
68+
}
69+
]
70+
},
71+
"abv": {
72+
"enabled": true,
73+
"dynamic": false,
74+
"fields": [
75+
{
76+
"docvalues": true,
77+
"include_in_all": true,
78+
"include_term_vectors": true,
79+
"index": true,
80+
"name": "abv",
81+
"store": true,
82+
"type": "number"
83+
}
84+
]
85+
},
86+
"updated": {
87+
"enabled": true,
88+
"dynamic": false,
89+
"fields": [
90+
{
91+
"docvalues": true,
92+
"include_in_all": true,
93+
"include_term_vectors": true,
94+
"index": true,
95+
"name": "updated",
96+
"store": true,
97+
"type": "datetime"
98+
}
99+
]
100+
}
101+
}
102+
}
103+
}
104+
},
105+
"store": {
106+
"indexType": "scorch"
107+
}
108+
}

test/test_helper.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@
2020
#define CATCH_CONFIG_MAIN
2121

2222
#include "utils/test_context.hxx"
23-
#include "utils/uniq_id.hxx"
23+
#include "utils/test_data.hxx"
2424

2525
#include <catch2/catch.hpp>

test/test_integration_management.cxx

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2277,30 +2277,6 @@ TEST_CASE("integration: search index management", "[integration]")
22772277
}
22782278
}
22792279

2280-
bool
2281-
wait_for_search_pindexes_ready(test::utils::integration_test_guard& integration, const std::string& index_name)
2282-
{
2283-
return test::utils::wait_until(
2284-
[&integration, &index_name]() {
2285-
couchbase::operations::management::search_index_stats_request req{};
2286-
auto resp = test::utils::execute(integration.cluster, req);
2287-
if (resp.ctx.ec || resp.stats.empty()) {
2288-
return false;
2289-
}
2290-
auto stats = couchbase::utils::json::parse(resp.stats);
2291-
const auto* num_pindexes_actual = stats.find(fmt::format("{}:{}:num_pindexes_actual", integration.ctx.bucket, index_name));
2292-
if (num_pindexes_actual == nullptr || !num_pindexes_actual->is_number()) {
2293-
return false;
2294-
}
2295-
const auto* num_pindexes_target = stats.find(fmt::format("{}:{}:num_pindexes_target", integration.ctx.bucket, index_name));
2296-
if (num_pindexes_target == nullptr || !num_pindexes_target->is_number()) {
2297-
return false;
2298-
}
2299-
return num_pindexes_actual->get_unsigned() == num_pindexes_target->get_unsigned();
2300-
},
2301-
std::chrono::minutes(3));
2302-
}
2303-
23042280
TEST_CASE("integration: search index management analyze document", "[integration]")
23052281
{
23062282
test::utils::integration_test_guard integration;
@@ -2323,7 +2299,7 @@ TEST_CASE("integration: search index management analyze document", "[integration
23232299
REQUIRE_FALSE(resp.ctx.ec);
23242300
}
23252301

2326-
REQUIRE(wait_for_search_pindexes_ready(integration, index_name));
2302+
REQUIRE(test::utils::wait_for_search_pindexes_ready(integration.cluster, integration.ctx.bucket, index_name));
23272303

23282304
couchbase::operations::management::search_index_analyze_document_response resp;
23292305
bool operation_completed = test::utils::wait_until([&integration, &index_name, &resp]() {

0 commit comments

Comments
 (0)