Skip to content

Commit edf0fe9

Browse files
committed
RSCBC-211: Community version testing
1 parent be0c105 commit edf0fe9

23 files changed

+486
-267
lines changed

.github/workflows/tests.yml

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,17 @@ jobs:
1414

1515
strategy:
1616
matrix:
17-
server:
18-
- 8.0.0-3716
19-
- 7.6.7
20-
- 7.2.7
21-
- 7.1.6
22-
- 7.0.4
23-
17+
server: [ 8.0.0, 7.6.7, 7.2.7, 7.1.6, 7.0.4, community-8.0.0 ]
18+
include:
19+
- server: community-8.0.0
20+
rcbserverVersion: 8.0.0-community
21+
2422
runs-on: ubuntu-latest
2523
steps:
2624
- name: Install cbdinocluster
2725
run: |
2826
mkdir -p "$HOME/bin"
29-
wget -nv -O $HOME/bin/cbdinocluster https://github.com/couchbaselabs/cbdinocluster/releases/download/v0.0.41/cbdinocluster-linux-amd64
27+
wget -nv -O $HOME/bin/cbdinocluster https://github.com/couchbaselabs/cbdinocluster/releases/download/v0.0.89/cbdinocluster-linux-amd64
3028
chmod +x $HOME/bin/cbdinocluster
3129
echo "$HOME/bin" >> $GITHUB_PATH
3230
@@ -50,12 +48,20 @@ jobs:
5048
CBDC_ID=$(cbdinocluster -v alloc --def="${CLUSTERCONFIG}")
5149
cbdinocluster -v buckets add ${CBDC_ID} default --ram-quota-mb=100 --flush-enabled=true --num-replicas=2
5250
cbdinocluster -v collections add ${CBDC_ID} default _default test
53-
CBDC_CONNSTR=$(cbdinocluster -v connstr --tls $CBDC_ID)
5451
CBDC_IP=$(cbdinocluster -v ip $CBDC_ID)
5552
echo "CBDC_ID=$CBDC_ID" >> "$GITHUB_ENV"
56-
echo "CBDC_CONNSTR=$CBDC_CONNSTR" >> "$GITHUB_ENV"
5753
echo "CBDC_IP=$CBDC_IP" >> "$GITHUB_ENV"
5854
55+
- name: Set connection string
56+
run: |
57+
if [[ "${{ matrix.server }}" == community* ]]; then
58+
CBDC_CONNSTR=$(cbdinocluster -v connstr $CBDC_ID)
59+
else
60+
CBDC_CONNSTR=$(cbdinocluster -v connstr --tls $CBDC_ID)
61+
fi
62+
63+
echo "CBDC_CONNSTR=$CBDC_CONNSTR" >> "$GITHUB_ENV"
64+
5965
- name: Create fts index
6066
run: |
6167
curl -XPUT -H "Content-Type: application/json" -u Administrator:password http://${{ env.CBDC_IP }}:8094/api/index/basic_search_index -d '{"type": "fulltext-index","name": "basic_search_index","sourceType": "gocbcore","sourceName": "default","planParams": {"maxPartitionsPerPIndex": 1024,"indexPartitions": 1},"params": {"doc_config": {"docid_prefix_delim": "","docid_regexp": "","mode": "type_field","type_field": "type"},"mapping": {"analysis": {},"default_analyzer": "standard","default_datetime_parser": "dateTimeOptional","default_field": "_all","default_mapping": {"dynamic": true,"enabled": true},"default_type": "_default","docvalues_dynamic": true,"index_dynamic": true,"store_dynamic": true,"type_field": "_type"},"store": {"indexType": "scorch","segmentVersion": 15}},"sourceParams": {}}'
@@ -72,8 +78,13 @@ jobs:
7278
CBDC_CONNSTR: # from above
7379
RCBDINOID: ${{ env.CBDC_ID }}
7480
RCBCONNSTR: ${{ env.CBDC_CONNSTR }}
75-
RCBSERVER_VERSION: ${{ matrix.server }}
7681
run: |
82+
if [[ -z "${{ matrix.rcbserverVersion }}" ]]; then
83+
export RCBSERVER_VERSION=${{ matrix.server }}
84+
else
85+
export RCBSERVER_VERSION=${{ matrix.rcbserverVersion }}
86+
fi
87+
7788
cargo test --color=always --no-fail-fast -- --nocapture
7889
7990
- name: Run allocation tests
@@ -83,8 +94,13 @@ jobs:
8394
CBDC_CONNSTR: # from above
8495
RCBDINOID: ${{ env.CBDC_ID }}
8596
RCBCONNSTR: ${{ env.CBDC_CONNSTR }}
86-
RCBSERVER_VERSION: ${{ matrix.server }}
8797
run: |
98+
if [[ -z "${{ matrix.rcbserverVersion }}" ]]; then
99+
export RCBSERVER_VERSION=${{ matrix.server }}
100+
else
101+
export RCBSERVER_VERSION=${{ matrix.rcbserverVersion }}
102+
fi
103+
88104
cargo test --features dhat-heap --test allocations --color=always --no-fail-fast -- --nocapture
89105
90106
# - name: Collect couchbase logs

sdk/couchbase-core/src/agent_ops.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -274,16 +274,6 @@ impl Agent {
274274
&self,
275275
opts: &CreateCollectionOptions<'_>,
276276
) -> Result<CreateCollectionResponse> {
277-
if opts.history_enabled.is_some() {
278-
return self.run_with_bucket_feature_check(
279-
BucketFeature::NonDedupedHistory,
280-
|| async {
281-
self.inner.mgmt.create_collection(opts).await
282-
},
283-
"History retention is not supported - note that the Magma storage engine must be used",
284-
).await;
285-
}
286-
287277
self.inner.mgmt.create_collection(opts).await
288278
}
289279

@@ -298,16 +288,6 @@ impl Agent {
298288
&self,
299289
opts: &UpdateCollectionOptions<'_>,
300290
) -> Result<UpdateCollectionResponse> {
301-
if opts.history_enabled.is_some() {
302-
return self.run_with_bucket_feature_check(
303-
BucketFeature::NonDedupedHistory,
304-
|| async {
305-
self.inner.mgmt.update_collection(opts).await
306-
},
307-
"History retention is not supported - note that the Magma storage engine must be used",
308-
)
309-
.await;
310-
}
311291
self.inner.mgmt.update_collection(opts).await
312292
}
313293

sdk/couchbase-core/src/memdx/datatype.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,19 @@
1515
* * limitations under the License.
1616
*
1717
*/
18+
use std::convert::From;
1819

1920
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
2021
#[non_exhaustive]
22+
#[derive(Default)]
2123
pub enum DataTypeFlag {
24+
#[default]
2225
None,
2326
Json,
2427
Compressed,
2528
Xattrs,
2629
}
2730

28-
impl Default for DataTypeFlag {
29-
fn default() -> Self {
30-
Self::None
31-
}
32-
}
33-
3431
impl From<DataTypeFlag> for u8 {
3532
fn from(value: DataTypeFlag) -> Self {
3633
match value {

sdk/couchbase-core/tests/common/features.rs

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
*/
1818

19-
use crate::common::node_version::NodeVersion;
19+
use crate::common::node_version::{NodeEdition, NodeVersion};
2020
use crate::common::test_agent::TestAgent;
2121

2222
const SERVER_VERSION_720: NodeVersion = NodeVersion {
@@ -46,6 +46,15 @@ const SERVER_VERSION_762: NodeVersion = NodeVersion {
4646
modifier: None,
4747
};
4848

49+
const SERVER_VERSION_800_COMMUNITY: NodeVersion = NodeVersion {
50+
major: 8,
51+
minor: 0,
52+
patch: 0,
53+
build: 0,
54+
edition: Some(NodeEdition::Community),
55+
modifier: None,
56+
};
57+
4958
#[derive(Debug, PartialEq, Eq, Hash)]
5059
pub enum TestFeatureCode {
5160
KV,
@@ -55,9 +64,11 @@ pub enum TestFeatureCode {
5564
SearchManagement,
5665
SearchManagementCollections,
5766
BucketManagement,
58-
CollectionNoExpiry,
67+
CollectionMaxExpiry,
5968
CollectionUpdates,
6069
HistoryRetention,
70+
UserGroups,
71+
UsersMB69096,
6172
}
6273

6374
impl TestAgent {
@@ -72,12 +83,24 @@ impl TestAgent {
7283
TestFeatureCode::SearchManagementCollections => {
7384
!self.cluster_version.lower(&SERVER_VERSION_762)
7485
}
75-
TestFeatureCode::CollectionNoExpiry => !self.cluster_version.lower(&SERVER_VERSION_762),
86+
TestFeatureCode::CollectionMaxExpiry => {
87+
self.cluster_version.edition != Some(NodeEdition::Community)
88+
&& !self.cluster_version.lower(&SERVER_VERSION_762)
89+
}
7690
TestFeatureCode::CollectionUpdates => {
7791
!self.cluster_version.lower(&SERVER_VERSION_722)
7892
&& !self.cluster_version.equal(&SERVER_VERSION_722)
7993
}
80-
TestFeatureCode::HistoryRetention => !self.cluster_version.lower(&SERVER_VERSION_720),
94+
TestFeatureCode::HistoryRetention => {
95+
self.cluster_version.edition != Some(NodeEdition::Community)
96+
&& !self.cluster_version.lower(&SERVER_VERSION_720)
97+
}
98+
TestFeatureCode::UserGroups => {
99+
self.cluster_version.edition != Some(NodeEdition::Community)
100+
}
101+
TestFeatureCode::UsersMB69096 => {
102+
!self.cluster_version.equal(&SERVER_VERSION_800_COMMUNITY)
103+
}
81104
}
82105
}
83106
}

sdk/couchbase-core/tests/common/helpers.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*
1717
*/
1818

19+
use crate::common::node_version::{NodeEdition, NodeVersion};
1920
use crate::common::test_agent::TestAgent;
2021
use couchbase_core::agent::Agent;
2122
use couchbase_core::error::{Error, ErrorKind};
@@ -262,13 +263,19 @@ where
262263
timeout_at(deadline, f).await.unwrap()
263264
}
264265

265-
pub async fn run_with_std_kv_deadline<Resp, Fut>(f: Fut) -> Result<Resp, Error>
266+
pub async fn run_with_std_kv_deadline<Resp, Fut>(
267+
node_version: &NodeVersion,
268+
f: Fut,
269+
) -> Result<Resp, Error>
266270
where
267271
Fut: std::future::Future<Output = Result<Resp, Error>>,
268272
{
269-
timeout_at(Instant::now().add(Duration::from_millis(2500)), f)
270-
.await
271-
.unwrap()
273+
let timeout = match node_version.edition {
274+
Some(NodeEdition::Community) => Duration::from_millis(10000),
275+
_ => Duration::from_millis(2500),
276+
};
277+
278+
timeout_at(Instant::now().add(timeout), f).await.unwrap()
272279
}
273280

274281
pub async fn run_with_std_mgmt_deadline<Resp, Fut>(f: Fut) -> Result<Resp, Error>

sdk/couchbase-core/tests/common/test_agent.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -82,74 +82,74 @@ impl TestAgent {
8282
}
8383

8484
pub async fn upsert(&self, opts: UpsertOptions<'_>) -> Result<UpsertResult> {
85-
run_with_std_kv_deadline(self.agent.upsert(opts)).await
85+
run_with_std_kv_deadline(&self.cluster_version, self.agent.upsert(opts)).await
8686
}
8787

8888
pub async fn get(&self, opts: GetOptions<'_>) -> Result<GetResult> {
89-
run_with_std_kv_deadline(self.agent.get(opts)).await
89+
run_with_std_kv_deadline(&self.cluster_version, self.agent.get(opts)).await
9090
}
9191

9292
pub async fn get_meta(&self, opts: GetMetaOptions<'_>) -> Result<GetMetaResult> {
93-
run_with_std_kv_deadline(self.agent.get_meta(opts)).await
93+
run_with_std_kv_deadline(&self.cluster_version, self.agent.get_meta(opts)).await
9494
}
9595

9696
pub async fn delete(&self, opts: DeleteOptions<'_>) -> Result<DeleteResult> {
97-
run_with_std_kv_deadline(self.agent.delete(opts)).await
97+
run_with_std_kv_deadline(&self.cluster_version, self.agent.delete(opts)).await
9898
}
9999

100100
pub async fn get_and_lock(&self, opts: GetAndLockOptions<'_>) -> Result<GetAndLockResult> {
101-
run_with_std_kv_deadline(self.agent.get_and_lock(opts)).await
101+
run_with_std_kv_deadline(&self.cluster_version, self.agent.get_and_lock(opts)).await
102102
}
103103

104104
pub async fn get_and_touch(&self, opts: GetAndTouchOptions<'_>) -> Result<GetAndTouchResult> {
105-
run_with_std_kv_deadline(self.agent.get_and_touch(opts)).await
105+
run_with_std_kv_deadline(&self.cluster_version, self.agent.get_and_touch(opts)).await
106106
}
107107

108108
pub async fn unlock(&self, opts: UnlockOptions<'_>) -> Result<UnlockResult> {
109-
run_with_std_kv_deadline(self.agent.unlock(opts)).await
109+
run_with_std_kv_deadline(&self.cluster_version, self.agent.unlock(opts)).await
110110
}
111111

112112
pub async fn touch(&self, opts: TouchOptions<'_>) -> Result<TouchResult> {
113-
run_with_std_kv_deadline(self.agent.touch(opts)).await
113+
run_with_std_kv_deadline(&self.cluster_version, self.agent.touch(opts)).await
114114
}
115115

116116
pub async fn add(&self, opts: AddOptions<'_>) -> Result<AddResult> {
117-
run_with_std_kv_deadline(self.agent.add(opts)).await
117+
run_with_std_kv_deadline(&self.cluster_version, self.agent.add(opts)).await
118118
}
119119

120120
pub async fn replace(&self, opts: ReplaceOptions<'_>) -> Result<ReplaceResult> {
121-
run_with_std_kv_deadline(self.agent.replace(opts)).await
121+
run_with_std_kv_deadline(&self.cluster_version, self.agent.replace(opts)).await
122122
}
123123

124124
pub async fn append(&self, opts: AppendOptions<'_>) -> Result<AppendResult> {
125-
run_with_std_kv_deadline(self.agent.append(opts)).await
125+
run_with_std_kv_deadline(&self.cluster_version, self.agent.append(opts)).await
126126
}
127127

128128
pub async fn prepend(&self, opts: PrependOptions<'_>) -> Result<PrependResult> {
129-
run_with_std_kv_deadline(self.agent.prepend(opts)).await
129+
run_with_std_kv_deadline(&self.cluster_version, self.agent.prepend(opts)).await
130130
}
131131

132132
pub async fn increment(&self, opts: IncrementOptions<'_>) -> Result<IncrementResult> {
133-
run_with_std_kv_deadline(self.agent.increment(opts)).await
133+
run_with_std_kv_deadline(&self.cluster_version, self.agent.increment(opts)).await
134134
}
135135

136136
pub async fn decrement(&self, opts: DecrementOptions<'_>) -> Result<DecrementResult> {
137-
run_with_std_kv_deadline(self.agent.decrement(opts)).await
137+
run_with_std_kv_deadline(&self.cluster_version, self.agent.decrement(opts)).await
138138
}
139139

140140
pub async fn get_collection_id(
141141
&self,
142142
opts: GetCollectionIdOptions<'_>,
143143
) -> Result<GetCollectionIdResult> {
144-
run_with_std_kv_deadline(self.agent.get_collection_id(opts)).await
144+
run_with_std_kv_deadline(&self.cluster_version, self.agent.get_collection_id(opts)).await
145145
}
146146

147147
pub async fn lookup_in(&self, opts: LookupInOptions<'_>) -> Result<LookupInResult> {
148-
run_with_std_kv_deadline(self.agent.lookup_in(opts)).await
148+
run_with_std_kv_deadline(&self.cluster_version, self.agent.lookup_in(opts)).await
149149
}
150150

151151
pub async fn mutate_in(&self, opts: MutateInOptions<'_>) -> Result<MutateInResult> {
152-
run_with_std_kv_deadline(self.agent.mutate_in(opts)).await
152+
run_with_std_kv_deadline(&self.cluster_version, self.agent.mutate_in(opts)).await
153153
}
154154

155155
pub async fn query(&self, opts: QueryOptions) -> Result<QueryResultStream> {

sdk/couchbase-core/tests/common/test_config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub struct EnvTestConfig {
4848
pub username: String,
4949
#[envconfig(from = "RCBPASSWORD", default = "password")]
5050
pub password: String,
51-
#[envconfig(from = "RCBCONNSTR", default = "couchbases://192.168.107.128")]
51+
#[envconfig(from = "RCBCONNSTR", default = "couchbase://192.168.107.132")]
5252
pub conn_string: String,
5353
#[envconfig(from = "RCBBUCKET", default = "default")]
5454
pub default_bucket: String,

sdk/couchbase-core/tests/diagnostics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ fn test_ping() {
3737
run_test(async |mut agent| {
3838
let opts = PingOptions::new()
3939
.kv_timeout(Duration::from_millis(1000))
40-
.query_timeout(Duration::from_millis(1000))
41-
.search_timeout(Duration::from_millis(1000));
40+
.query_timeout(Duration::from_millis(75000))
41+
.search_timeout(Duration::from_millis(75000));
4242

4343
let report = agent.ping(&opts).await.unwrap();
4444

0 commit comments

Comments
 (0)