Skip to content

Commit bdf7238

Browse files
author
arthosofteq
authored
Merge pull request #1986 from RedisInsight/fix_ITests
fix ITests
2 parents b26bf2e + 839a8db commit bdf7238

File tree

2 files changed

+84
-37
lines changed

2 files changed

+84
-37
lines changed

redisinsight/api/test/api/cli/POST-databases-id-cli-uuid-send_command.test.ts

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,22 @@ describe('POST /databases/:instanceId/cli/:uuid/send-command', () => {
7373
});
7474

7575
describe('Common', () => {
76-
describe('String', () => {
76+
describe('Analytics', () => {
77+
requirements('rte.serverType=local');
78+
const key = constants.getRandomString();
7779
[
7880
{
79-
name: 'Should create string',
81+
name: 'Should create string and send analytics event for it',
8082
data: {
81-
command: `set ${constants.TEST_STRING_KEY_1} ${constants.TEST_STRING_VALUE_1}`,
83+
command: `set ${key} ${constants.TEST_STRING_VALUE_1}`,
8284
outputFormat: 'TEXT',
8385
},
8486
responseSchema,
8587
before: async () => {
86-
expect(await rte.client.exists(constants.TEST_STRING_KEY_1)).to.eql(0);
88+
expect(await rte.client.exists(key)).to.eql(0);
8789
},
8890
after: async () => {
89-
expect(await rte.client.get(constants.TEST_STRING_KEY_1)).to.eql(constants.TEST_STRING_VALUE_1);
91+
expect(await rte.client.get(key)).to.eql(constants.TEST_STRING_VALUE_1);
9092
await analytics.waitForEvent({
9193
event: 'CLI_COMMAND_EXECUTED',
9294
properties: {
@@ -101,6 +103,24 @@ describe('POST /databases/:instanceId/cli/:uuid/send-command', () => {
101103
});
102104
}
103105
},
106+
].map(mainCheckFn);
107+
});
108+
describe('String', () => {
109+
[
110+
{
111+
name: 'Should create string',
112+
data: {
113+
command: `set ${constants.TEST_STRING_KEY_1} ${constants.TEST_STRING_VALUE_1}`,
114+
outputFormat: 'TEXT',
115+
},
116+
responseSchema,
117+
before: async () => {
118+
expect(await rte.client.exists(constants.TEST_STRING_KEY_1)).to.eql(0);
119+
},
120+
after: async () => {
121+
expect(await rte.client.get(constants.TEST_STRING_KEY_1)).to.eql(constants.TEST_STRING_VALUE_1);
122+
}
123+
},
104124
{
105125
name: 'Should get string',
106126
data: {

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

Lines changed: 59 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,65 @@ describe('POST /databases', () => {
115115
requirements('rte.type=STANDALONE', '!rte.ssh');
116116
describe('NO AUTH', function () {
117117
requirements('!rte.tls', '!rte.pass');
118+
describe('Analytics', () => {
119+
requirements('rte.serverType=local');
120+
121+
it('Create standalone without pass and tls, and send analytics event for it', async () => {
122+
const dbName = constants.getRandomString();
123+
124+
await validateApiCall({
125+
endpoint,
126+
statusCode: 201,
127+
data: {
128+
name: dbName,
129+
host: constants.TEST_REDIS_HOST,
130+
port: constants.TEST_REDIS_PORT,
131+
},
132+
responseSchema,
133+
responseBody: {
134+
name: dbName,
135+
host: constants.TEST_REDIS_HOST,
136+
port: constants.TEST_REDIS_PORT,
137+
username: null,
138+
password: null,
139+
connectionType: constants.STANDALONE,
140+
new: true,
141+
},
142+
checkFn: async ({ body }) => {
143+
// todo: find a way to test rest of the fields
144+
await analytics.waitForEvent({
145+
event: 'CONFIG_DATABASES_DATABASE_ADDED',
146+
properties: {
147+
databaseId: body.id,
148+
connectionType: body.connectionType,
149+
provider: body.provider,
150+
useTLS: 'disabled',
151+
verifyTLSCertificate: 'disabled',
152+
useTLSAuthClients: 'disabled',
153+
useSNI: 'disabled',
154+
useSSH: 'disabled',
155+
version: rte.env.version,
156+
// numberOfKeys: 8,
157+
// numberOfKeysRange: '0 - 500 000',
158+
// totalMemory: 881632,
159+
// numberedDatabases: 16,
160+
// numberOfModules: 0,
161+
timeout: body.timeout / 1000,
162+
// RediSearch: { loaded: false },
163+
// RedisAI: { loaded: false },
164+
// RedisGraph: { loaded: false },
165+
// RedisGears: { loaded: false },
166+
// RedisBloom: { loaded: false },
167+
// RedisJSON: { loaded: false },
168+
// RedisTimeSeries: { loaded: false },
169+
// customModules: [],
170+
buildType: serverConfig.get('server').buildType,
171+
},
172+
});
173+
},
174+
});
175+
});
176+
});
118177
it('Create standalone without pass and tls', async () => {
119178
const dbName = constants.getRandomString();
120179

@@ -136,38 +195,6 @@ describe('POST /databases', () => {
136195
connectionType: constants.STANDALONE,
137196
new: true,
138197
},
139-
checkFn: async ({ body }) => {
140-
// todo: find a way to test rest of the fields
141-
await analytics.waitForEvent({
142-
event: 'CONFIG_DATABASES_DATABASE_ADDED',
143-
properties: {
144-
databaseId: body.id,
145-
connectionType: body.connectionType,
146-
provider: body.provider,
147-
useTLS: 'disabled',
148-
verifyTLSCertificate: 'disabled',
149-
useTLSAuthClients: 'disabled',
150-
useSNI: 'disabled',
151-
useSSH: 'disabled',
152-
version: rte.env.version,
153-
// numberOfKeys: 8,
154-
// numberOfKeysRange: '0 - 500 000',
155-
// totalMemory: 881632,
156-
// numberedDatabases: 16,
157-
// numberOfModules: 0,
158-
timeout: body.timeout / 1000,
159-
// RediSearch: { loaded: false },
160-
// RedisAI: { loaded: false },
161-
// RedisGraph: { loaded: false },
162-
// RedisGears: { loaded: false },
163-
// RedisBloom: { loaded: false },
164-
// RedisJSON: { loaded: false },
165-
// RedisTimeSeries: { loaded: false },
166-
// customModules: [],
167-
buildType: serverConfig.get('server').buildType,
168-
},
169-
});
170-
},
171198
});
172199
});
173200
describe('Enterprise', () => {

0 commit comments

Comments
 (0)