Skip to content

Commit 73c08c0

Browse files
committed
#RI-4145 - fix api integration tests
1 parent cbe9437 commit 73c08c0

File tree

7 files changed

+12
-1
lines changed

7 files changed

+12
-1
lines changed

redisinsight/api/test/api/database/GET-databases.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const responseSchema = Joi.array().items(Joi.object().keys({
1414
provider: Joi.string().required(),
1515
new: Joi.boolean().allow(null).required(),
1616
timeout: Joi.number().integer().required(),
17+
compressor: Joi.string().valid('NONE', 'LZ4', 'GZIP', 'ZSTD', 'SNAPPY').allow(null),
1718
connectionType: Joi.string().valid('STANDALONE', 'SENTINEL', 'CLUSTER', 'NOT CONNECTED').required(),
1819
lastConnection: Joi.string().isoDate().allow(null).required(),
1920
modules: Joi.array().items(Joi.object().keys({

redisinsight/api/test/api/database/PATCH-databases-id.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const dataSchema = Joi.object({
2424
username: Joi.string().allow(null),
2525
password: Joi.string().allow(null),
2626
timeout: Joi.number().integer().allow(null),
27+
compressor: Joi.string().valid('NONE', 'LZ4', 'GZIP', 'ZSTD', 'SNAPPY').allow(null),
2728
tls: Joi.boolean().allow(null),
2829
tlsServername: Joi.string().allow(null),
2930
verifyServerCert: Joi.boolean().allow(null),
@@ -176,6 +177,7 @@ describe(`PATCH /databases/:id`, () => {
176177
host: constants.TEST_REDIS_HOST,
177178
port: constants.TEST_REDIS_PORT,
178179
timeout: constants.TEST_REDIS_TIMEOUT,
180+
compressor: constants.TEST_REDIS_COMPRESSOR,
179181
username: null,
180182
password: null,
181183
connectionType: constants.STANDALONE,
@@ -186,7 +188,7 @@ describe(`PATCH /databases/:id`, () => {
186188
after: async () => {
187189
newDatabase = await localDb.getInstanceById(constants.TEST_INSTANCE_ID_3);
188190
expect(newDatabase).to.contain({
189-
..._.omit(oldDatabase, ['modules', 'provider', 'lastConnection', 'new', 'timeout']),
191+
..._.omit(oldDatabase, ['modules', 'provider', 'lastConnection', 'new', 'timeout', 'compressor']),
190192
host: constants.TEST_REDIS_HOST,
191193
port: constants.TEST_REDIS_PORT,
192194
});

redisinsight/api/test/api/database/POST-databases-test.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const dataSchema = Joi.object({
2222
username: Joi.string().allow(null),
2323
password: Joi.string().allow(null),
2424
timeout: Joi.number().integer().allow(null),
25+
compressor: Joi.string().valid('NONE', 'LZ4', 'GZIP', 'ZSTD', 'SNAPPY').allow(null),
2526
tls: Joi.boolean().allow(null),
2627
tlsServername: Joi.string().allow(null),
2728
verifyServerCert: Joi.boolean().allow(null),

redisinsight/api/test/api/database/POST-databases.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const dataSchema = Joi.object({
2323
username: Joi.string().allow(null),
2424
password: Joi.string().allow(null),
2525
timeout: Joi.number().integer().allow(null),
26+
compressor: Joi.string().valid('NONE', 'LZ4', 'GZIP', 'ZSTD', 'SNAPPY').allow(null),
2627
tls: Joi.boolean().allow(null),
2728
tlsServername: Joi.string().allow(null),
2829
verifyServerCert: Joi.boolean().allow(null),
@@ -55,6 +56,7 @@ const baseDatabaseData = {
5556
host: constants.TEST_REDIS_HOST,
5657
port: constants.TEST_REDIS_PORT,
5758
timeout: constants.TEST_REDIS_TIMEOUT,
59+
compressor: constants.TEST_REDIS_COMPRESSOR,
5860
username: constants.TEST_REDIS_USER || undefined,
5961
password: constants.TEST_REDIS_PASSWORD || undefined,
6062
}

redisinsight/api/test/api/database/PUT-databases-id.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const dataSchema = Joi.object({
2424
username: Joi.string().allow(null),
2525
password: Joi.string().allow(null),
2626
timeout: Joi.number().integer().allow(null),
27+
compressor: Joi.string().valid('NONE', 'LZ4', 'GZIP', 'ZSTD', 'SNAPPY').allow(null),
2728
tls: Joi.boolean().allow(null),
2829
tlsServername: Joi.string().allow(null),
2930
verifyServerCert: Joi.boolean().allow(null),
@@ -42,6 +43,7 @@ const baseDatabaseData = {
4243
host: constants.TEST_REDIS_HOST,
4344
port: constants.TEST_REDIS_PORT,
4445
timeout: constants.TEST_REDIS_TIMEOUT,
46+
compressor: constants.TEST_REDIS_COMPRESSOR,
4547
username: constants.TEST_REDIS_USER || undefined,
4648
password: constants.TEST_REDIS_PASSWORD || undefined,
4749
}

redisinsight/api/test/api/database/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export const databaseSchema = Joi.object().keys({
1111
username: Joi.string().allow(null),
1212
password: Joi.string().allow(null),
1313
timeout: Joi.number().integer().required(),
14+
compressor: Joi.string().valid('NONE', 'LZ4', 'GZIP', 'ZSTD', 'SNAPPY').required(),
1415
nameFromProvider: Joi.string().allow(null),
1516
lastConnection: Joi.string().isoDate().allow(null),
1617
provider: Joi.string().valid('LOCALHOST', 'UNKNOWN', 'RE_CLOUD', 'RE_CLUSTER'),

redisinsight/api/test/helpers/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as path from 'path';
33
import { randomBytes } from 'crypto';
44
import { getASCIISafeStringFromBuffer, getBufferFromSafeASCIIString } from "src/utils/cli-helper";
55
import { RECOMMENDATION_NAMES } from 'src/constants';
6+
import { Compressor } from 'src/modules/database/entities/database.entity';
67

78
const API = {
89
DATABASES: 'databases',
@@ -66,6 +67,7 @@ export const constants = {
6667
TEST_REDIS_HOST: process.env.TEST_REDIS_HOST || 'localhost',
6768
TEST_REDIS_PORT: parseInt(process.env.TEST_REDIS_PORT) || 6379,
6869
TEST_REDIS_TIMEOUT: 30_000,
70+
TEST_REDIS_COMPRESSOR: Compressor.NONE,
6971
TEST_REDIS_DB_INDEX: 7,
7072
TEST_REDIS_USER: process.env.TEST_REDIS_USER,
7173
TEST_REDIS_PASSWORD: process.env.TEST_REDIS_PASSWORD,

0 commit comments

Comments
 (0)