Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { MigrationInterface, QueryRunner } from "typeorm";

export class feature1684175820824 implements MigrationInterface {
name = 'feature1684175820824'
export class Feature1684931530343 implements MigrationInterface {
name = 'Feature1684931530343'

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE "features" ("name" varchar PRIMARY KEY NOT NULL, "flag" boolean NOT NULL)`);
await queryRunner.query(`CREATE TABLE "features_config" ("id" varchar PRIMARY KEY NOT NULL, "controlNumber" integer, "data" varchar NOT NULL, "updatedAt" datetime NOT NULL DEFAULT (datetime('now')))`);
await queryRunner.query(`CREATE TABLE "features_config" ("id" varchar PRIMARY KEY NOT NULL, "controlNumber" float, "data" varchar NOT NULL, "updatedAt" datetime NOT NULL DEFAULT (datetime('now')))`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
Expand Down
4 changes: 2 additions & 2 deletions redisinsight/api/migration/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { databaseCompressor1678182722874 } from './1678182722874-database-compre
import { customTutorials1677135091633 } from './1677135091633-custom-tutorials';
import { databaseRecommendations1681900503586 } from './1681900503586-database-recommendations';
import { databaseRecommendationParams1683006064293 } from './1683006064293-database-recommendation-params';
import { feature1684175820824 } from './1684175820824-feature';
import { Feature1684931530343 } from './1684931530343-feature';

export default [
initialMigration1614164490968,
Expand Down Expand Up @@ -67,5 +67,5 @@ export default [
customTutorials1677135091633,
databaseRecommendations1681900503586,
databaseRecommendationParams1683006064293,
feature1684175820824,
Feature1684931530343,
];
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const mockCreateBulkActionDto = {

const mockOverview = {
...mockCreateBulkActionDto,
duration: 0,
duration: jasmine.any(Number),
filter: { match: '*', type: null },
progress: {
scanned: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class FeaturesConfigEntity {
@PrimaryGeneratedColumn('uuid')
id: string;

@Column({ nullable: true })
@Column({ nullable: true, type: 'float' })
@Expose()
controlNumber: number;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('POST /databases/:id/bulk-actions/import/tutorial-data', () => {
responseBody: {
id: 'empty',
databaseId: constants.TEST_INSTANCE_ID,
type: 'import',
type: 'upload',
summary: { processed: 1, succeed: 1, failed: 0, errors: [] },
progress: null,
filter: null,
Expand Down Expand Up @@ -91,7 +91,7 @@ describe('POST /databases/:id/bulk-actions/import/tutorial-data', () => {
responseBody: {
id: 'empty',
databaseId: constants.TEST_INSTANCE_ID,
type: 'import',
type: 'upload',
summary: { processed: 1, succeed: 1, failed: 0, errors: [] },
progress: null,
filter: null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('POST /databases/:id/bulk-actions/import', () => {
responseBody: {
id: 'empty',
databaseId: constants.TEST_INSTANCE_ID,
type: 'import',
type: 'upload',
summary: { processed: 1, succeed: 0, failed: 1, errors: [] },
progress: null,
filter: null,
Expand All @@ -50,7 +50,7 @@ describe('POST /databases/:id/bulk-actions/import', () => {
responseBody: {
id: 'empty',
databaseId: constants.TEST_INSTANCE_ID,
type: 'import',
type: 'upload',
summary: { processed: 100, succeed: 100, failed: 0, errors: [] },
progress: null,
filter: null,
Expand Down Expand Up @@ -80,7 +80,7 @@ describe('POST /databases/:id/bulk-actions/import', () => {
responseBody: {
id: 'empty',
databaseId: constants.TEST_INSTANCE_ID,
type: 'import',
type: 'upload',
summary: { processed: 10_000, succeed: 10_000, failed: 0, errors: [] },
progress: null,
filter: null,
Expand Down Expand Up @@ -115,7 +115,7 @@ describe('POST /databases/:id/bulk-actions/import', () => {
responseBody: {
id: 'empty',
databaseId: constants.TEST_INSTANCE_ID,
type: 'import',
type: 'upload',
summary: { processed: 100, succeed: 50, failed: 50, errors: [] },
progress: null,
filter: null,
Expand Down Expand Up @@ -156,7 +156,7 @@ describe('POST /databases/:id/bulk-actions/import', () => {
responseBody: {
id: 'empty',
databaseId: constants.TEST_INSTANCE_ID,
type: 'import',
type: 'upload',
summary: { processed: 100_000, succeed: 100_000, failed: 0, errors: [] },
progress: null,
filter: null,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { describe, it, expect, _, before, deps, validateApiCall, requirements } from '../deps';
const { server, request, constants, rte } = deps;
import {
enableAllDbFeatures,
getRepository,
repositories
} from '../../helpers/local-db';
import { Socket } from 'socket.io-client';
import { randomBytes } from 'crypto';
import { getSocket } from '../../helpers/server';

const getClient = async (): Promise<Socket> => {
Expand All @@ -21,8 +21,9 @@ describe('WS new recommendations', () => {
await repo.clear();
});

before(() => {
rte.data.truncate();
before(async () => {
await rte.data.truncate();
await enableAllDbFeatures();
});

it('Should notify about new big set recommendations', async () => {
Expand All @@ -39,7 +40,7 @@ describe('WS new recommendations', () => {
validateApiCall({
endpoint: () => request(server).post(`/${constants.API.DATABASES}/${constants.TEST_INSTANCE_ID}/keys/get-info`),
data: {
keys: [constants.TEST_SET_KEY_1],
keyName: constants.TEST_SET_KEY_1,
},
});
})
Expand All @@ -49,7 +50,9 @@ describe('WS new recommendations', () => {
expect(recommendationsResponse.recommendations[0].name).to.eq('bigSets');
expect(recommendationsResponse.recommendations[0].databaseId).to.eq(constants.TEST_INSTANCE_ID);
expect(recommendationsResponse.recommendations[0].read).to.eq(false);
expect(recommendationsResponse.recommendations[0].disabled).to.eq(false);
// expect(recommendationsResponse.recommendations[0].disabled).to.eq(false);
// todo: investigate if it should return false vs undefined
expect(recommendationsResponse.recommendations[0].disabled).to.eq(undefined);
expect(recommendationsResponse.totalUnread).to.eq(1);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const responseSchema = Joi.object({
maxResults: Joi.number().integer().allow(null).required(),
keys: Joi.array().items(Joi.object({
name: JoiRedisString.required(),
type: Joi.string(),
})).required(),
}).required().strict(true);
const mainCheckFn = getMainCheckFn(endpoint);
Expand Down
8 changes: 8 additions & 0 deletions redisinsight/api/test/helpers/local-db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,14 @@ export const resetSettings = async () => {
await rep.save(settings);
}

export const enableAllDbFeatures = async () => {
const rep = await getRepository(repositories.FEATURE);
await rep.delete({});
await rep.insert([
{ name: 'insightsRecommendations', flag: true },
]);
}

export const initSettings = async () => {
await initAgreements();
const rep = await getRepository(repositories.SETTINGS);
Expand Down
2 changes: 1 addition & 1 deletion redisinsight/api/test/test-runs/start-test-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ echo "Test run is starting... ${RTE}"
eval "ID=$ID RTE=$RTE docker-compose -p $ID \
-f $BASEDIR/$BUILD.build.yml \
-f $BASEDIR/$RTE/docker-compose.yml \
--env-file $BASEDIR/$BUILD.build.env run test"
--env-file $BASEDIR/$BUILD.build.env run --use-aliases test"

echo "Stop all containers... ${RTE}"
eval "ID=$ID RTE=$RTE docker-compose -p $ID \
Expand Down