Skip to content

Commit ea80400

Browse files
authored
Couchbase: add missing exports and fix sonar suggestions (#942)
1 parent bac0fa0 commit ea80400

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

.github/scripts/changed-modules.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ while IFS= read -r file; do
6060
done < <(find "${ROOT_DIR}" -maxdepth 1 -type f -not -name "package.json" -not -name "package-lock.json")
6161

6262
# define an array of modules that won't be part of the build
63-
readonly no_build_modules=("couchbase")
63+
readonly no_build_modules=()
6464

6565
# modules is an array that will store the paths of all the modules in the repository.
6666
modules=()

packages/modules/couchbase/src/bucket-definition.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export class BucketDefinition {
44
private quota = 100;
55
private numOfReplicas = 0;
66

7-
constructor(private name: string) {}
7+
constructor(private readonly name: string) {}
88

99
withReplicas(numOfReplicas: number) {
1010
const minThreshold = 0;

packages/modules/couchbase/src/couchbase-container.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export class CouchbaseContainer extends GenericContainer {
6060

6161
withServiceQuota(service: CouchbaseService, quotaMb: number) {
6262
if (!service.hasQuota()) {
63-
throw new Error(`The provided service (${service}) has no quota to configure`);
63+
throw new Error(`The provided service (${service.getIdentifier()}) has no quota to configure`);
6464
}
6565

6666
if (quotaMb < service.getMinimumQuotaMb()) {
@@ -253,14 +253,14 @@ export class CouchbaseContainer extends GenericContainer {
253253
}
254254

255255
private async setMemoryQuotas(container: StartedTestContainer) {
256-
log.debug(`Custom service memory quotas: ${this.customServiceQuotas}`);
257256
for (const service of this.enabledServices) {
258257
if (!service.hasQuota()) {
259258
continue;
260259
}
261260

262261
const body = new URLSearchParams();
263-
const quota = this.customServiceQuotas.get(service) || service.getMinimumQuotaMb();
262+
const quota = this.customServiceQuotas.get(service) ?? service.getMinimumQuotaMb();
263+
log.debug(`Custom service memory quotas: ${service.getIdentifier()} - ${quota} Mb.`);
264264

265265
if (service.getIdentifier() === CouchbaseService.KV.getIdentifier()) {
266266
body.set("memoryQuota", quota.toString());

packages/modules/couchbase/src/couchbase-service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export class CouchbaseService {
22
constructor(
3-
private identifier: string,
4-
private minimumQuotaMb: number
3+
private readonly identifier: string,
4+
private readonly minimumQuotaMb: number
55
) {}
66

77
static readonly KV = new CouchbaseService("kv", 256);
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
export { BucketDefinition } from "./bucket-definition";
12
export { CouchbaseContainer, StartedCouchbaseContainer } from "./couchbase-container";
3+
export { CouchbaseService } from "./couchbase-service";

0 commit comments

Comments
 (0)