Skip to content

Commit e857fa6

Browse files
author
Artem
committed
#RI-3974 Final ITests
#RI-4032 increase global timeout #RI-4030 fix telemetry #RI-4031 fix unprintable characters in the error
1 parent 4096a79 commit e857fa6

28 files changed

+704
-12
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ aliases:
8888
- mods-preview # OSS Standalone and all preview modules
8989
- oss-st-6-tls # OSS Standalone v6 with TLS enabled
9090
- oss-st-6-tls-auth # OSS Standalone v6 with TLS auth required
91+
- oss-st-6-tls-auth-ssh # OSS Standalone v6 with TLS auth required through ssh
9192
- oss-clu # OSS Cluster
9293
- oss-clu-tls # OSS Cluster with TLS enabled
9394
- oss-sent # OSS Sentinel

redisinsight/api/config/default.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default {
5555
staticContent: !!process.env.SERVER_STATIC_CONTENT || false,
5656
buildType: process.env.BUILD_TYPE || 'ELECTRON',
5757
appVersion: process.env.APP_VERSION || '2.0.0',
58-
requestTimeout: parseInt(process.env.REQUEST_TIMEOUT, 10) || 10000,
58+
requestTimeout: parseInt(process.env.REQUEST_TIMEOUT, 10) || 25000,
5959
excludeRoutes: [],
6060
excludeAuthRoutes: [],
6161
},

redisinsight/api/src/modules/database/database.analytics.spec.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,11 @@ describe('DatabaseAnalytics', () => {
7979
});
8080

8181
describe('sendInstanceAddedEvent', () => {
82-
it('should emit event with enabled tls and sni', () => {
83-
service.sendInstanceAddedEvent(mockDatabaseWithTlsAuth, mockRedisGeneralInfo);
82+
it('should emit event with enabled tls and sni, and ssh', () => {
83+
service.sendInstanceAddedEvent({
84+
...mockDatabaseWithTlsAuth,
85+
ssh: true,
86+
}, mockRedisGeneralInfo);
8487

8588
expect(sendEventSpy).toHaveBeenCalledWith(
8689
TelemetryEvents.RedisInstanceAdded,
@@ -92,6 +95,7 @@ describe('DatabaseAnalytics', () => {
9295
verifyTLSCertificate: 'enabled',
9396
useTLSAuthClients: 'enabled',
9497
useSNI: 'enabled',
98+
useSSH: 'enabled',
9599
version: mockRedisGeneralInfo.version,
96100
numberOfKeys: mockRedisGeneralInfo.totalKeys,
97101
numberOfKeysRange: '0 - 500 000',
@@ -119,6 +123,7 @@ describe('DatabaseAnalytics', () => {
119123
verifyTLSCertificate: 'disabled',
120124
useTLSAuthClients: 'disabled',
121125
useSNI: 'disabled',
126+
useSSH: 'disabled',
122127
version: mockRedisGeneralInfo.version,
123128
numberOfKeys: mockRedisGeneralInfo.totalKeys,
124129
numberOfKeysRange: '0 - 500 000',
@@ -148,6 +153,7 @@ describe('DatabaseAnalytics', () => {
148153
verifyTLSCertificate: 'enabled',
149154
useTLSAuthClients: 'enabled',
150155
useSNI: 'enabled',
156+
useSSH: 'disabled',
151157
version: mockRedisGeneralInfo.version,
152158
numberOfKeys: undefined,
153159
numberOfKeysRange: undefined,

redisinsight/api/src/modules/database/database.analytics.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export class DatabaseAnalytics extends TelemetryBaseService {
6060
useSNI: instance?.tlsServername
6161
? 'enabled'
6262
: 'disabled',
63+
useSSH: instance?.ssh ? 'enabled' : 'disabled',
6364
version: additionalInfo?.version,
6465
numberOfKeys: additionalInfo?.totalKeys,
6566
numberOfKeysRange: getRangeForNumber(additionalInfo?.totalKeys, TOTAL_KEYS_BREAKPOINTS),
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import { OmitType } from '@nestjs/swagger';
22
import { SshOptions } from 'src/modules/ssh/models/ssh-options';
33

4-
export class CreateBasicSshOptionsDto extends OmitType(SshOptions, ['privateKey', 'passphrase'] as const) {}
4+
export class CreateBasicSshOptionsDto extends OmitType(SshOptions, ['privateKey', 'passphrase', 'id'] as const) {}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import { OmitType } from '@nestjs/swagger';
22
import { SshOptions } from 'src/modules/ssh/models/ssh-options';
33

4-
export class CreateCertSshOptionsDto extends OmitType(SshOptions, ['password'] as const) {}
4+
export class CreateCertSshOptionsDto extends OmitType(SshOptions, ['password', 'id'] as const) {}

redisinsight/api/src/modules/ssh/exceptions/unable-to-create-tunnel.exception.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,15 @@ import { HttpException } from '@nestjs/common';
33
export class UnableToCreateTunnelException extends HttpException {
44
constructor(message = '') {
55
const prepend = 'Unable to create tunnel.';
6+
7+
let msg = message;
8+
9+
if (message.includes('Cannot parse privateKey')) {
10+
msg = 'Cannot parse privateKey';
11+
}
12+
613
super({
7-
message: `${prepend} ${message}`,
14+
message: `${prepend} ${msg}`,
815
name: 'UnableToCreateTunnelException',
916
statusCode: 500,
1017
}, 500);

redisinsight/api/src/modules/ssh/ssh-tunnel.provider.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,15 @@ describe('SshTunnelProvider', () => {
8383
process.nextTick(() => mockClient.emit('ready'));
8484
});
8585
it('should fail due to createServer failed', (done) => {
86-
const mockError = new Error('some not processed error');
86+
const mockError = new Error('Cannot parse privateKey: due to some reason');
8787
createServerSpy.mockReset().mockImplementationOnce(() => {
8888
throw mockError;
8989
});
9090

9191
service.createTunnel(mockDatabaseWithSshBasic)
9292
.catch((e) => {
9393
expect(e).toBeInstanceOf(UnableToCreateTunnelException);
94+
expect(e.message).toEqual('Unable to create tunnel. Cannot parse privateKey');
9495
done();
9596
});
9697

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ describe('POST /databases/import', () => {
561561
});
562562
});
563563
describe('STANDALONE', () => {
564-
requirements('rte.type=STANDALONE');
564+
requirements('rte.type=STANDALONE', '!rte.ssh');
565565
describe('NO TLS', function () {
566566
requirements('!rte.tls');
567567
it('Import standalone (format 0)', async () => {

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const mainCheckFn = getMainCheckFn(endpoint);
5050

5151
let oldDatabase;
5252
let newDatabase;
53-
describe(`PUT /databases/:id`, () => {
53+
describe(`PATCH /databases/:id`, () => {
5454
beforeEach(async () => await localDb.createDatabaseInstances());
5555

5656
describe('Validation', () => {
@@ -117,6 +117,7 @@ describe(`PUT /databases/:id`, () => {
117117
data: {
118118
name: 'new name',
119119
port: 1111,
120+
ssh: false,
120121
},
121122
statusCode: 503,
122123
responseBody: {
@@ -150,7 +151,7 @@ describe(`PUT /databases/:id`, () => {
150151
].map(mainCheckFn);
151152
});
152153
describe('STANDALONE', () => {
153-
requirements('rte.type=STANDALONE');
154+
requirements('rte.type=STANDALONE', '!rte.ssh');
154155
describe('NO AUTH', function () {
155156
requirements('!rte.tls', '!rte.pass');
156157

0 commit comments

Comments
 (0)