Skip to content

Commit ffccf36

Browse files
committed
MILAB-2886: perform deepcopy of base spec to avoid test intersections
1 parent 961ad40 commit ffccf36

File tree

5 files changed

+31
-17
lines changed

5 files changed

+31
-17
lines changed

.changeset/kind-lions-cut.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

tests/workflow-tengo/src/pframes/test/ll.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ tplTest.concurrent.for([
110110
},
111111
);
112112

113-
eTplTest(
113+
eTplTest.concurrent(
114114
'should correctly execute low level aggregation routine with xsv parsing',
115115
async ({ helper, expect, stHelper }) => {
116116
const xsvSettings = {

tests/workflow-tengo/src/pframes/test/pframe.export.test.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ const baseSpec = {
1111
annotations: {},
1212
};
1313

14-
tplTest('should export files for p-frame without skipExportForUI annotation', { timeout: 40000 },
14+
tplTest.concurrent('should export files for p-frame without skipExportForUI annotation', { timeout: 40000 },
1515
async ({ helper, expect, driverKit }) => {
16-
const spec = baseSpec;
16+
const spec = deepClone(baseSpec);
1717
const fileHandle = await importFile(driverKit);
1818

1919
const result = await helper.renderTemplate(
@@ -43,9 +43,9 @@ tplTest('should export files for p-frame without skipExportForUI annotation', {
4343
},
4444
);
4545

46-
tplTest('should not export files for p-frame with hideDataFromUi annotation', { timeout: 40000 },
46+
tplTest.concurrent('should not export files for p-frame with hideDataFromUi annotation', { timeout: 40000 },
4747
async ({ helper, expect, driverKit }) => {
48-
const spec = { ...baseSpec, annotations: { 'pl7.app/hideDataFromUi': 'true' } };
48+
const spec = { ...deepClone(baseSpec), annotations: { 'pl7.app/hideDataFromUi': 'true' } };
4949
const fileHandle = await importFile(driverKit);
5050

5151
const result = await helper.renderTemplate(
@@ -87,3 +87,7 @@ async function importFile(driverKit: DriverKit) {
8787

8888
return ourFile.handle;
8989
}
90+
91+
function deepClone<T>(obj: T): T {
92+
return JSON.parse(JSON.stringify(obj));
93+
}

tests/workflow-tengo/src/pframes/test/xsv.export.test.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const baseSpec = {
7171
partitionKeyLength: 2,
7272
};
7373

74-
tplTest.for([
74+
tplTest.concurrent.for([
7575
{ partitionKeyLength: 0, storageFormat: 'Binary' },
7676
{ partitionKeyLength: 1, storageFormat: 'Binary' },
7777
{ partitionKeyLength: 2, storageFormat: 'Binary' },
@@ -88,7 +88,7 @@ tplTest.for([
8888
// execution takes 1-2 seconds at most.
8989
{ timeout: 30000 },
9090
async ({ partitionKeyLength, storageFormat }, { helper, expect, driverKit }) => {
91-
const spec = baseSpec;
91+
const spec = deepClone(baseSpec);
9292
spec.partitionKeyLength = partitionKeyLength;
9393
spec.storageFormat = storageFormat;
9494

@@ -129,7 +129,7 @@ tplTest.for([
129129
},
130130
);
131131

132-
tplTest.for([
132+
tplTest.concurrent.for([
133133
{ partitionKeyLength: 1, storageFormat: 'Binary' },
134134
{ partitionKeyLength: 2, storageFormat: 'Binary' },
135135
{ partitionKeyLength: 1, storageFormat: 'Json' },
@@ -144,7 +144,7 @@ tplTest.for([
144144
// execution takes 1-2 seconds at most.
145145
{ timeout: 30000 },
146146
async ({ partitionKeyLength, storageFormat }, { helper, expect, driverKit }) => {
147-
const spec = baseSpec;
147+
const spec = deepClone(baseSpec);
148148
spec.partitionKeyLength = partitionKeyLength;
149149
spec.storageFormat = storageFormat;
150150

@@ -198,7 +198,7 @@ function superPartitionKeys(keyLen: number): string[] {
198198
return r;
199199
}
200200

201-
tplTest.for([
201+
tplTest.concurrent.for([
202202
{
203203
superPartitionKeyLength: 0,
204204
partitionKeyLength: 0,
@@ -257,7 +257,7 @@ tplTest.for([
257257
{ helper, expect, driverKit },
258258
) => {
259259
const supKeys = superPartitionKeys(superPartitionKeyLength).sort();
260-
const spec = baseSpec;
260+
const spec = deepClone(baseSpec);
261261
spec.partitionKeyLength = partitionKeyLength;
262262
spec.storageFormat = storageFormat;
263263

@@ -308,3 +308,7 @@ tplTest.for([
308308
if (superPartitionKeyLength === 0) expect(actual).toEqual(expected);
309309
},
310310
);
311+
312+
function deepClone<T>(obj: T): T {
313+
return JSON.parse(JSON.stringify(obj));
314+
}

tests/workflow-tengo/src/pframes/test/xsv.import.test.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ function partitionKeyJson(str: string): any {
111111
return JSON.stringify(JSON.parse(str.replace('.index', '').replace('.values', '')));
112112
}
113113

114-
tplTest.for([
114+
tplTest.concurrent.for([
115115
{ partitionKeyLength: 0, storageFormat: 'Binary' },
116116
{ partitionKeyLength: 1, storageFormat: 'Binary' },
117117
{ partitionKeyLength: 2, storageFormat: 'Binary' },
@@ -128,7 +128,7 @@ tplTest.for([
128128
// execution takes 1-2 seconds at most.
129129
{ timeout: 30000 },
130130
async ({ partitionKeyLength, storageFormat }, { helper, expect, driverKit }) => {
131-
const spec = baseSpec;
131+
const spec = deepClone(baseSpec);
132132
spec.partitionKeyLength = partitionKeyLength;
133133
spec.storageFormat = storageFormat;
134134
const expectedPKeys = [...expectedPartitionKeys(spec)].sort();
@@ -228,7 +228,7 @@ function superPartitionKeys(keyLen: number): string[] {
228228
return r;
229229
}
230230

231-
tplTest.for([
231+
tplTest.concurrent.for([
232232
{
233233
superPartitionKeyLength: 0,
234234
partitionKeyLength: 0,
@@ -284,7 +284,7 @@ tplTest.for([
284284
{ timeout: 30000 },
285285
async ({ superPartitionKeyLength, partitionKeyLength, storageFormat }, { helper, expect }) => {
286286
const supKeys = superPartitionKeys(superPartitionKeyLength).sort();
287-
const spec = baseSpec;
287+
const spec = deepClone(baseSpec);
288288
spec.partitionKeyLength = partitionKeyLength;
289289
spec.storageFormat = storageFormat;
290290
// inner keys
@@ -393,7 +393,7 @@ tplTest.for([
393393
},
394394
);
395395

396-
tplTest.for([
396+
tplTest.concurrent.for([
397397
{
398398
superPartitionKeyLength: 0,
399399
partitionKeyLength: 0,
@@ -449,7 +449,7 @@ tplTest.for([
449449
{ timeout: 30000 },
450450
async ({ superPartitionKeyLength, partitionKeyLength, storageFormat }, { helper, expect }) => {
451451
const supKeys = superPartitionKeys(superPartitionKeyLength).sort();
452-
const spec = baseSpec;
452+
const spec = deepClone(baseSpec);
453453
spec.partitionKeyLength = partitionKeyLength;
454454
spec.storageFormat = storageFormat;
455455
// inner keys
@@ -548,3 +548,7 @@ tplTest.for([
548548
}
549549
},
550550
);
551+
552+
function deepClone<T>(obj: T): T {
553+
return JSON.parse(JSON.stringify(obj));
554+
}

0 commit comments

Comments
 (0)