Skip to content

Commit ecf0293

Browse files
#RI-5190 - add IT
1 parent c3a8f23 commit ecf0293

File tree

3 files changed

+82
-1
lines changed

3 files changed

+82
-1
lines changed

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

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -920,4 +920,47 @@ describe(`PATCH /databases/:id`, () => {
920920
});
921921
});
922922
});
923+
924+
describe('SENTINEL', () => {
925+
describe('PASS', function () {
926+
requirements('rte.type=SENTINEL', '!rte.tls', 'rte.pass');
927+
it('Should update database without full sentinel master information', async () => {
928+
const dbName = constants.getRandomString();
929+
930+
expect(await localDb.getInstanceByName(dbName)).to.eql(null);
931+
932+
await validateApiCall({
933+
endpoint,
934+
data: {
935+
name: dbName,
936+
sentinelMaster: {
937+
password: constants.TEST_SENTINEL_MASTER_PASS || null,
938+
},
939+
},
940+
});
941+
942+
expect(await localDb.getInstanceByName(dbName)).to.be.an('object');
943+
});
944+
945+
it('Should throw Unauthorized error', async () => {
946+
const dbName = constants.getRandomString();
947+
948+
await validateApiCall({
949+
endpoint,
950+
statusCode: 401,
951+
data: {
952+
name: dbName,
953+
sentinelMaster: {
954+
password: 'incorrect password'
955+
},
956+
},
957+
responseBody: {
958+
statusCode: 401,
959+
message: 'Failed to authenticate, please check the username or password.',
960+
error: 'Unauthorized'
961+
},
962+
});
963+
});
964+
});
965+
});
923966
});

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,4 +563,42 @@ describe(`POST /databases/test/:id`, () => {
563563
});
564564
});
565565
});
566+
describe('SENTINEL', () => {
567+
describe('PASS', function () {
568+
requirements('rte.type=SENTINEL', '!rte.tls', 'rte.pass');
569+
it('Should test connection without full sentinel master information', async () => {
570+
const dbName = constants.getRandomString();
571+
572+
await validateApiCall({
573+
endpoint,
574+
data: {
575+
name: dbName,
576+
sentinelMaster: {
577+
password: constants.TEST_SENTINEL_MASTER_PASS || null,
578+
},
579+
},
580+
});
581+
});
582+
583+
it('Should throw Unauthorized error', async () => {
584+
const dbName = constants.getRandomString();
585+
586+
await validateApiCall({
587+
endpoint,
588+
statusCode: 401,
589+
data: {
590+
name: dbName,
591+
sentinelMaster: {
592+
password: 'incorrect password'
593+
},
594+
},
595+
responseBody: {
596+
statusCode: 401,
597+
message: 'Failed to authenticate, please check the username or password.',
598+
error: 'Unauthorized'
599+
},
600+
});
601+
});
602+
});
603+
});
566604
});

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const databaseSchema = Joi.object().keys({
2424
sentinelMaster: Joi.object({
2525
name: Joi.string().required(),
2626
username: Joi.string().allow(null),
27-
password: Joi.string().allow(null),
27+
password: Joi.boolean().allow(null),
2828
}).allow(null),
2929
nodes: Joi.array().items({
3030
host: Joi.string().required(),

0 commit comments

Comments
 (0)