Skip to content

Commit 86ff1a5

Browse files
committed
Merge remote-tracking branch 'origin/feature/RI-3238/prepare_for_docker'
# Conflicts: # redisinsight/ui/src/slices/instances/instances.ts # redisinsight/ui/src/slices/tests/instances/instances.spec.ts
2 parents 55499ab + 9621020 commit 86ff1a5

File tree

427 files changed

+9284
-6162
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

427 files changed

+9284
-6162
lines changed

.circleci/config.yml

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ aliases:
9191
- oss-clu # OSS Cluster
9292
- oss-clu-tls # OSS Cluster with TLS enabled
9393
- oss-sent # OSS Sentinel
94+
- oss-sent-tls-auth # OSS Sentinel with TLS auth
9495
- re-st # Redis Enterprise with Standalone inside
9596
- re-clu # Redis Enterprise with Cluster inside
9697
- re-crdt # Redis Enterprise with active-active database inside
@@ -99,6 +100,7 @@ aliases:
99100
- oss-st-6-tls-auth # OSS Standalone v6 with TLS auth required
100101
- oss-clu-tls # OSS Cluster with TLS enabled
101102
- re-crdt # Redis Enterprise with active-active database inside
103+
- oss-sent-tls-auth # OSS Sentinel with TLS auth
102104
guides-filter: &guidesFilter
103105
filters:
104106
branches:
@@ -875,29 +877,30 @@ workflows:
875877
jobs:
876878
- unit-tests-ui:
877879
name: UTest - UI
878-
filters:
879-
branches:
880-
only:
881-
- /^fe/feature.*/
882-
- /^fe/bugfix.*/
880+
# filters:
881+
# branches:
882+
# only:
883+
# - /^fe/feature.*/
884+
# - /^fe/bugfix.*/
883885
# BE Unit + Integration (limited RTEs) tests for "be/feature" or "be/bugfix" branches only
884886
backend-tests:
885887
jobs:
886888
- unit-tests-api:
887889
name: UTest - API
888-
filters:
889-
branches:
890-
only:
891-
- /^be/feature.*/
892-
- /^be/bugfix.*/
890+
# filters:
891+
# branches:
892+
# only:
893+
# - /^be/feature.*/
894+
# - /^be/bugfix.*/
893895
- integration-tests-run:
894896
matrix:
895897
alias: itest-code
896898
parameters:
897-
rte: *iTestsNamesShort
899+
rte: *iTestsNames
900+
# rte: *iTestsNamesShort
898901
name: ITest - << matrix.rte >> (code)
899-
requires:
900-
- UTest - API
902+
# requires:
903+
# - UTest - API
901904
# E2E tests for "e2e/feature" or "e2e/bugfix" branches only
902905
e2e-tests:
903906
jobs:

redisinsight/api/config/ormconfig.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import { TypeOrmModuleOptions } from '@nestjs/typeorm';
2-
import { AgreementsEntity } from 'src/modules/core/models/agreements.entity';
3-
import { CaCertificateEntity } from 'src/modules/core/models/ca-certificate.entity';
4-
import { ClientCertificateEntity } from 'src/modules/core/models/client-certificate.entity';
5-
import { DatabaseInstanceEntity } from 'src/modules/core/models/database-instance.entity';
6-
import { ServerEntity } from 'src/modules/core/models/server.entity';
7-
import { SettingsEntity } from 'src/modules/core/models/settings.entity';
2+
import { ServerEntity } from 'src/modules/server/entities/server.entity';
83
import { CommandExecutionEntity } from 'src/modules/workbench/entities/command-execution.entity';
94
import { PluginStateEntity } from 'src/modules/workbench/entities/plugin-state.entity';
105
import { NotificationEntity } from 'src/modules/notification/entities/notification.entity';
116
import { DatabaseAnalysisEntity } from 'src/modules/database-analysis/entities/database-analysis.entity';
127
import { DataSource } from 'typeorm';
8+
import { AgreementsEntity } from 'src/modules/settings/entities/agreements.entity';
9+
import { SettingsEntity } from 'src/modules/settings/entities/settings.entity';
10+
import { CaCertificateEntity } from 'src/modules/certificate/entities/ca-certificate.entity';
11+
import { ClientCertificateEntity } from 'src/modules/certificate/entities/client-certificate.entity';
12+
import { DatabaseEntity } from 'src/modules/database/entities/database.entity';
1313
import migrations from '../migration';
1414
import * as config from '../src/utils/config';
1515

@@ -24,7 +24,7 @@ const ormConfig = {
2424
AgreementsEntity,
2525
CaCertificateEntity,
2626
ClientCertificateEntity,
27-
DatabaseInstanceEntity,
27+
DatabaseEntity,
2828
ServerEntity,
2929
SettingsEntity,
3030
CommandExecutionEntity,

redisinsight/api/config/stack.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ export default {
44
server: {
55
excludeRoutes: [
66
'redis-enterprise/*',
7-
'instance/redis-enterprise-dbs',
8-
'instance/redis-cloud-dbs',
9-
'instance/sentinel-masters',
10-
{ path: 'instance', method: RequestMethod.POST },
11-
{ path: 'instance', method: RequestMethod.DELETE },
12-
{ path: 'instance/:id', method: RequestMethod.DELETE },
7+
'redis-sentinel/*',
8+
{ path: 'databases', method: RequestMethod.POST },
9+
{ path: 'databases', method: RequestMethod.DELETE },
10+
{ path: 'databases/:id', method: RequestMethod.DELETE },
1311
],
1412
},
1513
};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { MigrationInterface, QueryRunner } from "typeorm";
2+
3+
export class database1667477693934 implements MigrationInterface {
4+
name = 'database1667477693934'
5+
6+
public async up(queryRunner: QueryRunner): Promise<void> {
7+
await queryRunner.query(`CREATE TABLE "temporary_database_instance" ("id" varchar PRIMARY KEY NOT NULL, "host" varchar NOT NULL, "port" integer NOT NULL, "name" varchar NOT NULL, "username" varchar, "password" varchar, "tls" boolean, "verifyServerCert" boolean, "lastConnection" datetime, "caCertId" varchar, "clientCertId" varchar, "connectionType" varchar NOT NULL DEFAULT ('STANDALONE'), "nodes" varchar DEFAULT ('[]'), "nameFromProvider" varchar, "sentinelMasterName" varchar, "sentinelMasterUsername" varchar, "sentinelMasterPassword" varchar, "provider" varchar DEFAULT ('UNKNOWN'), "modules" varchar NOT NULL DEFAULT ('[]'), "db" integer, "encryption" varchar, "tlsServername" varchar, CONSTRAINT "FK_d1bc747b5938e22b4b708d8e9a5" FOREIGN KEY ("caCertId") REFERENCES "ca_certificate" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_3b9b625266c00feb2d66a9f36e4" FOREIGN KEY ("clientCertId") REFERENCES "client_certificate" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)`);
8+
await queryRunner.query(`INSERT INTO "temporary_database_instance"("id", "host", "port", "name", "username", "password", "tls", "verifyServerCert", "lastConnection", "caCertId", "clientCertId", "connectionType", "nodes", "nameFromProvider", "sentinelMasterName", "sentinelMasterUsername", "sentinelMasterPassword", "provider", "modules", "db", "encryption", "tlsServername") SELECT "id", "host", "port", "name", "username", "password", "tls", "verifyServerCert", "lastConnection", "caCertId", "clientCertId", "connectionType", "nodes", "nameFromProvider", "sentinelMasterName", "sentinelMasterUsername", "sentinelMasterPassword", "provider", "modules", "db", "encryption", "tlsServername" FROM "database_instance"`);
9+
await queryRunner.query(`DROP TABLE "database_instance"`);
10+
await queryRunner.query(`ALTER TABLE "temporary_database_instance" RENAME TO "database_instance"`);
11+
}
12+
13+
public async down(queryRunner: QueryRunner): Promise<void> {
14+
await queryRunner.query(`ALTER TABLE "database_instance" RENAME TO "temporary_database_instance"`);
15+
await queryRunner.query(`CREATE TABLE "database_instance" ("id" varchar PRIMARY KEY NOT NULL, "host" varchar NOT NULL, "port" integer NOT NULL, "name" varchar NOT NULL, "username" varchar, "password" varchar, "tls" boolean NOT NULL, "verifyServerCert" boolean NOT NULL, "lastConnection" datetime, "caCertId" varchar, "clientCertId" varchar, "connectionType" varchar NOT NULL DEFAULT ('STANDALONE'), "nodes" varchar, "nameFromProvider" varchar, "sentinelMasterName" varchar, "sentinelMasterUsername" varchar, "sentinelMasterPassword" varchar, "provider" varchar DEFAULT ('UNKNOWN'), "modules" varchar NOT NULL DEFAULT ('[]'), "db" integer, "encryption" varchar, "tlsServername" varchar, CONSTRAINT "FK_d1bc747b5938e22b4b708d8e9a5" FOREIGN KEY ("caCertId") REFERENCES "ca_certificate" ("id") ON DELETE SET NULL ON UPDATE NO ACTION, CONSTRAINT "FK_3b9b625266c00feb2d66a9f36e4" FOREIGN KEY ("clientCertId") REFERENCES "client_certificate" ("id") ON DELETE SET NULL ON UPDATE NO ACTION)`);
16+
await queryRunner.query(`INSERT INTO "database_instance"("id", "host", "port", "name", "username", "password", "tls", "verifyServerCert", "lastConnection", "caCertId", "clientCertId", "connectionType", "nodes", "nameFromProvider", "sentinelMasterName", "sentinelMasterUsername", "sentinelMasterPassword", "provider", "modules", "db", "encryption", "tlsServername") SELECT "id", "host", "port", "name", "username", "password", "tls", "verifyServerCert", "lastConnection", "caCertId", "clientCertId", "connectionType", "nodes", "nameFromProvider", "sentinelMasterName", "sentinelMasterUsername", "sentinelMasterPassword", "provider", "modules", "db", "encryption", "tlsServername" FROM "temporary_database_instance"`);
17+
await queryRunner.query(`DROP TABLE "temporary_database_instance"`);
18+
}
19+
20+
}

redisinsight/api/migration/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { workbenchGroupMode1663093411715 } from './1663093411715-workbench-group
2020
import { databaseAnalysis1664785208236 } from './1664785208236-database-analysis';
2121
import { databaseAnalysisExpirationGroups1664886479051 } from './1664886479051-database-analysis-expiration-groups';
2222
import { workbenchExecutionTime1667368983699 } from './1667368983699-workbench-execution-time';
23+
import { database1667477693934 } from './1667477693934-database';
2324

2425
export default [
2526
initialMigration1614164490968,
@@ -44,4 +45,5 @@ export default [
4445
databaseAnalysis1664785208236,
4546
databaseAnalysisExpirationGroups1664886479051,
4647
workbenchExecutionTime1667368983699,
48+
database1667477693934,
4749
];
Lines changed: 76 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,76 @@
1-
import { IAgreement } from 'src/models';
2-
import {
3-
AgreementsEntity,
4-
IAgreementsJSON,
5-
} from 'src/modules/core/models/agreements.entity';
6-
import {
7-
ISettingsJSON,
8-
SettingsEntity,
9-
} from 'src/modules/core/models/settings.entity';
10-
11-
export const mockAppAgreement: IAgreement = {
12-
defaultValue: false,
13-
required: true,
14-
since: '1.0.0',
15-
disabled: false,
16-
displayInSetting: false,
17-
editable: false,
18-
title: 'License Terms',
19-
label: 'I have read and understood the License Terms',
20-
};
21-
22-
export const mockAgreementsJSON = {
23-
version: null,
24-
};
25-
26-
export const mockAgreementsEntity: AgreementsEntity = {
27-
id: 1,
28-
version: null,
29-
data: null,
30-
toJSON: (): IAgreementsJSON => mockAgreementsJSON,
31-
};
32-
33-
export const mockSettingsJSON: ISettingsJSON = {
34-
theme: null,
35-
scanThreshold: null,
36-
batchSize: null,
37-
};
38-
39-
export const mockSettingsEntity: SettingsEntity = {
40-
id: 1,
41-
data: null,
42-
toJSON: (): ISettingsJSON => mockSettingsJSON,
43-
};
1+
import { Settings } from 'src/modules/settings/models/settings';
2+
import { Agreements } from 'src/modules/settings/models/agreements';
3+
import { mockUserId } from 'src/__mocks__/user';
4+
import { GetAppSettingsResponse } from 'src/modules/settings/dto/settings.dto';
5+
import { AgreementsEntity } from 'src/modules/settings/entities/agreements.entity';
6+
import { SettingsEntity } from 'src/modules/settings/entities/settings.entity';
7+
8+
export const mockSettings = Object.assign(new Settings(), {
9+
id: mockUserId,
10+
data: {
11+
theme: 'DARK',
12+
scanThreshold: 500,
13+
batchSize: 10,
14+
},
15+
});
16+
17+
export const mockSettingsEntity = Object.assign(new SettingsEntity(), {
18+
id: mockSettings.id,
19+
data: JSON.stringify(mockSettings.data),
20+
});
21+
22+
export const mockAgreements = Object.assign(new Agreements(), {
23+
id: mockUserId,
24+
version: '1.0.0',
25+
data: {
26+
eula: true,
27+
analytics: true,
28+
encryption: true,
29+
notifications: true,
30+
},
31+
});
32+
33+
export const mockAgreementsEntity = Object.assign(new AgreementsEntity(), {
34+
id: mockAgreements.id,
35+
version: mockAgreements.version,
36+
data: JSON.stringify(mockAgreements.data),
37+
});
38+
39+
export const mockAppSettings = Object.assign(new GetAppSettingsResponse(), {
40+
...mockSettings.data,
41+
agreements: {
42+
version: mockAgreements.version,
43+
...mockAgreements.data,
44+
},
45+
});
46+
47+
export const mockAppSettingsWithoutPermissions = Object.assign(new GetAppSettingsResponse(), {
48+
...mockSettings.data,
49+
agreements: {
50+
version: mockAgreements.version,
51+
eula: false,
52+
analytics: false,
53+
encryption: false,
54+
notifications: false,
55+
},
56+
});
57+
58+
export const mockAppSettingsInitial = Object.assign(new GetAppSettingsResponse(), {
59+
agreements: null,
60+
});
61+
62+
export const mockAgreementsRepository = jest.fn(() => ({
63+
getOrCreate: jest.fn(),
64+
update: jest.fn(),
65+
}));
66+
67+
export const mockSettingsRepository = jest.fn(() => ({
68+
getOrCreate: jest.fn(),
69+
update: jest.fn(),
70+
}));
71+
72+
export const mockSettingsService = jest.fn(() => ({
73+
getAppSettings: jest.fn(),
74+
updateAppSettings: jest.fn(),
75+
getAgreementsSpec: jest.fn(),
76+
}));

redisinsight/api/src/__mocks__/common.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { ISettingsProvider } from 'src/modules/core/models/settings-provider.interface';
2-
31
export type MockType<T> = {
42
[P in keyof T]: jest.Mock<any>;
53
};
@@ -57,9 +55,3 @@ export const mockRepository = jest.fn(() => ({
5755
remove: jest.fn(),
5856
createQueryBuilder: mockCreateQueryBuilder,
5957
}));
60-
61-
export const mockSettingsProvider = (): ISettingsProvider => ({
62-
getSettings: jest.fn(),
63-
updateSettings: jest.fn(),
64-
getAgreementsSpec: jest.fn(),
65-
});

redisinsight/api/src/__mocks__/encryption.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ export const mockEncryptionService = () => ({
1111
decrypt: jest.fn(),
1212
});
1313

14-
export const mockEncryptionStrategy = () => ({
14+
export const mockEncryptionStrategy = jest.fn(() => ({
1515
isAvailable: jest.fn(),
1616
encrypt: jest.fn(),
1717
decrypt: jest.fn(),
18-
});
18+
}));
1919

2020
export const mockKeytarModule = {
2121
getPassword: jest.fn(),

redisinsight/api/src/__mocks__/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ export * from './app-settings';
99
export * from './autodiscovery-tools';
1010
export * from './analytics';
1111
export * from './profiler';
12+
export * from './user';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const mockUserId = '1';

0 commit comments

Comments
 (0)