Skip to content

Commit 71a98ae

Browse files
committed
Refactor v2 test for new indexRangeable prop config
1 parent bd79545 commit 71a98ae

File tree

1 file changed

+58
-13
lines changed

1 file changed

+58
-13
lines changed

src/schema/journey.test.ts

Lines changed: 58 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ const isVer = (client: WeaviateClient, minor: number, patch: number) =>
1111
if (!version) {
1212
return false;
1313
}
14-
const semver = version.split('.').map((v) => parseInt(v, 10));
15-
return semver[1] >= minor && semver[2] >= patch;
14+
const semver = version
15+
.split('-')[0]
16+
.split('.')
17+
.map((v) => parseInt(v, 10));
18+
return semver[1] > minor ? true : semver[1] === minor && semver[2] >= patch;
1619
});
1720

1821
describe('schema', () => {
@@ -21,7 +24,12 @@ describe('schema', () => {
2124
host: 'localhost:8080',
2225
});
2326

24-
const classObjPromise = newClassObject('MyThingClass', isVer(client, 25, 0), isVer(client, 25, 2));
27+
const classObjPromise = newClassObject(
28+
'MyThingClass',
29+
isVer(client, 25, 0),
30+
isVer(client, 25, 2),
31+
isVer(client, 26, 0)
32+
);
2533

2634
it('creates a thing class (implicitly)', async () => {
2735
const classObj = await classObjPromise;
@@ -61,6 +69,7 @@ describe('schema', () => {
6169
name: 'anotherProp',
6270
tokenization: 'field',
6371
indexFilterable: true,
72+
indexRangeable: false,
6473
indexSearchable: true,
6574
moduleConfig: {
6675
'text2vec-contextionary': {
@@ -166,7 +175,12 @@ describe('schema', () => {
166175

167176
it('updates all shards in a class', async () => {
168177
const shardCount = 3;
169-
const newClass: any = await newClassObject('NewClass', isVer(client, 25, 0), isVer(client, 25, 2));
178+
const newClass: any = await newClassObject(
179+
'NewClass',
180+
isVer(client, 25, 0),
181+
isVer(client, 25, 2),
182+
isVer(client, 26, 0)
183+
);
170184
newClass.shardingConfig.desiredCount = shardCount;
171185

172186
await client.schema
@@ -209,7 +223,12 @@ describe('schema', () => {
209223
});
210224

211225
it('has updated values of bm25 config', async () => {
212-
const newClass: any = await newClassObject('NewClass', isVer(client, 25, 0), isVer(client, 25, 2));
226+
const newClass: any = await newClassObject(
227+
'NewClass',
228+
isVer(client, 25, 0),
229+
isVer(client, 25, 2),
230+
isVer(client, 26, 0)
231+
);
213232
const bm25Config = { k1: 1.13, b: 0.222 };
214233

215234
newClass.invertedIndexConfig.bm25 = bm25Config;
@@ -226,7 +245,12 @@ describe('schema', () => {
226245
});
227246

228247
it('has updated values of stopwords config', async () => {
229-
const newClass: any = await newClassObject('SpaceClass', isVer(client, 25, 0), isVer(client, 25, 2));
248+
const newClass: any = await newClassObject(
249+
'SpaceClass',
250+
isVer(client, 25, 0),
251+
isVer(client, 25, 2),
252+
isVer(client, 26, 0)
253+
);
230254
const stopwordConfig: any = {
231255
preset: 'en',
232256
additions: ['star', 'nebula'],
@@ -278,7 +302,12 @@ describe('schema', () => {
278302

279303
it('creates a class with explicit replication config', async () => {
280304
const replicationFactor = 1;
281-
const newClass: any = await newClassObject('SomeClass', isVer(client, 25, 0), isVer(client, 25, 2));
305+
const newClass: any = await newClassObject(
306+
'SomeClass',
307+
isVer(client, 25, 0),
308+
isVer(client, 25, 2),
309+
isVer(client, 26, 0)
310+
);
282311
newClass.replicationConfig.factor = replicationFactor;
283312

284313
await client.schema
@@ -293,7 +322,12 @@ describe('schema', () => {
293322
});
294323

295324
it('creates a class with implicit replication config', async () => {
296-
const newClass: any = await newClassObject('SomeClass', isVer(client, 25, 0), isVer(client, 25, 2));
325+
const newClass: any = await newClassObject(
326+
'SomeClass',
327+
isVer(client, 25, 0),
328+
isVer(client, 25, 2),
329+
isVer(client, 26, 0)
330+
);
297331
delete newClass.replicationConfig;
298332

299333
await client.schema
@@ -311,12 +345,14 @@ describe('schema', () => {
311345
const newClass: any = await newClassObject(
312346
'LetsDeleteThisClass',
313347
isVer(client, 25, 0),
314-
isVer(client, 25, 2)
348+
isVer(client, 25, 2),
349+
isVer(client, 26, 0)
315350
);
316351
const newClass2: any = await newClassObject(
317352
'LetsDeleteThisClassToo',
318353
isVer(client, 25, 0),
319-
isVer(client, 25, 2)
354+
isVer(client, 25, 2),
355+
isVer(client, 26, 0)
320356
);
321357
const classNames = [newClass.class, newClass2.class];
322358
Promise.all([
@@ -502,7 +538,7 @@ describe('property setting defaults and migrations', () => {
502538
);
503539

504540
const errMsg1 =
505-
'`indexInverted` is deprecated and can not be set together with `indexFilterable` or `indexSearchable`';
541+
'`indexInverted` is deprecated and can not be set together with `indexFilterable`, `indexSearchable` or `indexRangeable`';
506542
const errMsg2 = '`indexSearchable`';
507543
test.each([
508544
['text', false, null, false, errMsg1],
@@ -681,7 +717,8 @@ describe('multi tenancy', () => {
681717
const classObjWithoutMultiTenancyConfig = newClassObject(
682718
'NoMultiTenancy',
683719
isVer(client, 25, 0),
684-
isVer(client, 25, 2)
720+
isVer(client, 25, 2),
721+
isVer(client, 26, 0)
685722
);
686723

687724
it('creates a NoMultiTenancy class', async () => {
@@ -711,7 +748,8 @@ describe('multi tenancy', () => {
711748
async function newClassObject(
712749
className: string,
713750
is1250Promise: Promise<boolean>,
714-
is1252Promise: Promise<boolean>
751+
is1252Promise: Promise<boolean>,
752+
is1260Promise: Promise<boolean>
715753
) {
716754
return {
717755
class: className,
@@ -721,6 +759,7 @@ async function newClassObject(
721759
name: 'stringProp',
722760
tokenization: 'word',
723761
indexFilterable: true,
762+
indexRangeable: false,
724763
indexSearchable: true,
725764
moduleConfig: {
726765
'text2vec-contextionary': {
@@ -754,6 +793,11 @@ async function newClassObject(
754793
bq: {
755794
enabled: false,
756795
},
796+
sq: {
797+
enabled: false,
798+
rescoreLimit: 20,
799+
trainingLimit: 100000,
800+
},
757801
skip: false,
758802
efConstruction: 128,
759803
vectorCacheMaxObjects: 500000,
@@ -792,6 +836,7 @@ async function newClassObject(
792836
virtualPerPhysical: 128,
793837
},
794838
replicationConfig: {
839+
asyncEnabled: (await is1260Promise) ? false : undefined,
795840
factor: 1,
796841
},
797842
};

0 commit comments

Comments
 (0)