Skip to content

Commit d9f883c

Browse files
committed
Make permission tests compatible with minio-js v8
Fixes #3322
1 parent fe534ab commit d9f883c

File tree

4 files changed

+520
-371
lines changed

4 files changed

+520
-371
lines changed

.github/workflows/jobs.yaml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ jobs:
220220
working-directory: ./
221221
continue-on-error: false
222222
run: |
223-
yarn add minio@7.1.3
223+
yarn add minio
224224
225225
- uses: actions/cache@v3
226226
name: Console Binary Cache
@@ -239,7 +239,7 @@ jobs:
239239
(CONSOLE_SUBPATH=/console/subpath ./console server ) & (make test-initialize-minio-nginx)
240240
241241
- name: Install TestCafe
242-
run: npm install testcafe@3.0.0
242+
run: npm install testcafe@3.5.0
243243

244244
- name: Run TestCafe Tests
245245
run: npx testcafe "chrome:headless" web-app/tests/subpath-nginx/ -q --skip-js-errors -c 3
@@ -269,7 +269,7 @@ jobs:
269269
working-directory: ./
270270
continue-on-error: false
271271
run: |
272-
yarn add minio@7.1.3
272+
yarn add minio
273273
274274
- uses: actions/cache@v3
275275
name: Console Binary Cache
@@ -288,7 +288,7 @@ jobs:
288288
(./console server) & (make initialize-permissions)
289289
290290
- name: Install TestCafe
291-
run: npm install testcafe@3.0.0
291+
run: npm install testcafe@3.5.0
292292

293293
- name: Run TestCafe Tests
294294
run: npx testcafe "chrome:headless" web-app/tests/permissions-1/ -q --skip-js-errors -c 3
@@ -317,7 +317,7 @@ jobs:
317317
working-directory: ./
318318
continue-on-error: false
319319
run: |
320-
yarn add minio@7.1.3
320+
yarn add minio
321321
- uses: actions/cache@v3
322322
name: Console Binary Cache
323323
with:
@@ -335,7 +335,7 @@ jobs:
335335
(./console server) & (make initialize-permissions)
336336
337337
- name: Install TestCafe
338-
run: npm install testcafe@3.0.0
338+
run: npm install testcafe@3.5.0
339339

340340
- name: Run TestCafe Tests
341341
run: npx testcafe "chrome:headless" web-app/tests/permissions-2/ -q --skip-js-errors -c 3
@@ -364,7 +364,7 @@ jobs:
364364
working-directory: ./
365365
continue-on-error: false
366366
run: |
367-
yarn add minio@7.1.3
367+
yarn add minio
368368
- uses: actions/cache@v3
369369
name: Console Binary Cache
370370
with:
@@ -382,7 +382,7 @@ jobs:
382382
(./console server) & (make initialize-permissions)
383383
384384
- name: Install TestCafe
385-
run: npm install testcafe@3.0.0
385+
run: npm install testcafe@3.5.0
386386

387387
- name: Run TestCafe Tests
388388
run: npx testcafe "chrome:headless" web-app/tests/permissions-3/ -q --skip-js-errors -c 3
@@ -411,7 +411,7 @@ jobs:
411411
working-directory: ./
412412
continue-on-error: false
413413
run: |
414-
yarn add minio@7.1.3
414+
yarn add minio
415415
- uses: actions/cache@v3
416416
name: Console Binary Cache
417417
with:
@@ -429,7 +429,7 @@ jobs:
429429
(./console server) & (make initialize-permissions)
430430
431431
- name: Install TestCafe
432-
run: npm install testcafe@3.0.0
432+
run: npm install testcafe@3.5.0
433433

434434
- name: Run TestCafe Tests
435435
timeout-minutes: 10
@@ -454,7 +454,7 @@ jobs:
454454
working-directory: ./
455455
continue-on-error: false
456456
run: |
457-
yarn add minio@7.1.3
457+
yarn add minio
458458
- uses: actions/cache@v3
459459
name: Console Binary Cache
460460
with:
@@ -472,7 +472,7 @@ jobs:
472472
(./console server) & (make initialize-permissions)
473473
474474
- name: Install TestCafe
475-
run: npm install testcafe@3.0.0
475+
run: npm install testcafe@3.5.0
476476

477477
- name: Run TestCafe Tests
478478
timeout-minutes: 5
@@ -497,7 +497,7 @@ jobs:
497497
working-directory: ./
498498
continue-on-error: false
499499
run: |
500-
yarn add minio@7.1.3
500+
yarn add minio
501501
- uses: actions/cache@v3
502502
name: Console Binary Cache
503503
with:
@@ -515,7 +515,7 @@ jobs:
515515
(./console server) & (make initialize-permissions)
516516
517517
- name: Install TestCafe
518-
run: npm install testcafe@3.0.0
518+
run: npm install testcafe@3.5.0
519519

520520
- name: Run TestCafe Tests
521521
timeout-minutes: 5
@@ -540,7 +540,7 @@ jobs:
540540
working-directory: ./
541541
continue-on-error: false
542542
run: |
543-
yarn add minio@7.1.3
543+
yarn add minio
544544
- uses: actions/cache@v3
545545
name: Console Binary Cache
546546
with:
@@ -557,7 +557,7 @@ jobs:
557557
run: |
558558
(./console server) & (make initialize-permissions)
559559
- name: Install TestCafe
560-
run: npm install testcafe@3.0.0
560+
run: npm install testcafe@3.5.0
561561

562562
- name: Run TestCafe Tests
563563
timeout-minutes: 5
@@ -582,7 +582,7 @@ jobs:
582582
working-directory: ./
583583
continue-on-error: false
584584
run: |
585-
yarn add minio@7.1.3
585+
yarn add minio
586586
- uses: actions/cache@v3
587587
name: Console Binary Cache
588588
with:
@@ -600,7 +600,7 @@ jobs:
600600
(./console server) & (make initialize-permissions)
601601
602602
- name: Install TestCafe
603-
run: npm install testcafe@3.0.0
603+
run: npm install testcafe@3.5.0
604604

605605
- name: Run TestCafe Tests
606606
timeout-minutes: 5
@@ -625,7 +625,7 @@ jobs:
625625
working-directory: ./
626626
continue-on-error: false
627627
run: |
628-
yarn add minio@7.1.3
628+
yarn add minio
629629
- uses: actions/cache@v3
630630
name: Console Binary Cache
631631
with:
@@ -643,7 +643,7 @@ jobs:
643643
(./console server) & (make initialize-permissions)
644644
645645
- name: Install TestCafe
646-
run: npm install testcafe@3.0.0
646+
run: npm install testcafe@3.5.0
647647

648648
- name: Run TestCafe Tests
649649
run: npx testcafe "chrome:headless" web-app/tests/permissions-A/ --skip-js-errors -c 3
@@ -671,7 +671,7 @@ jobs:
671671
working-directory: ./
672672
continue-on-error: false
673673
run: |
674-
yarn add minio@7.1.3
674+
yarn add minio
675675
- uses: actions/cache@v3
676676
name: Console Binary Cache
677677
with:
@@ -689,7 +689,7 @@ jobs:
689689
(./console server) & (make initialize-permissions)
690690
691691
- name: Install TestCafe
692-
run: npm install testcafe@3.0.0
692+
run: npm install testcafe@3.5.0
693693

694694
- name: Run TestCafe Tests
695695
run: npx testcafe "chrome:headless" web-app/tests/permissions-B/ --skip-js-errors -c 3

web-app/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
"@playwright/test": "^1.43.0",
6464
"@types/lodash": "^4.17.0",
6565
"@types/luxon": "^3.4.2",
66-
"@types/minio": "7.1.1",
6766
"@types/node": "18.16.0",
6867
"@types/react": "18.2.75",
6968
"@types/react-copy-to-clipboard": "^5.0.5",
@@ -77,13 +76,13 @@
7776
"@types/webpack-env": "^1.18.2",
7877
"babel-plugin-istanbul": "^6.1.1",
7978
"customize-cra": "^1.0.0",
80-
"minio": "^7.1.3",
79+
"minio": "^8.0.0",
8180
"nyc": "^15.1.0",
8281
"prettier": "3.2.5",
8382
"react-app-rewire-hot-loader": "^2.0.1",
8483
"react-app-rewired": "^2.2.1",
8584
"react-scripts": "5.0.1",
86-
"testcafe": "^2.6.2",
85+
"testcafe": "3.5.0",
8786
"ts-prune": "^0.10.3",
8887
"typescript": "^4.4.3"
8988
},

web-app/tests/utils/functions.ts

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,8 @@ export const setUpNamedBucket = (t, name) => {
3333
accessKey: "minioadmin",
3434
secretKey: "minioadmin",
3535
});
36-
return new Promise((resolve, reject) => {
37-
minioClient.makeBucket(name, "us-east-1", (err) => {
38-
if (err) {
39-
console.log(err);
40-
}
41-
resolve("done: " + err);
42-
});
36+
return minioClient.makeBucket(name, "us-east-1").catch((err) => {
37+
console.log(err);
4338
});
4439
};
4540

@@ -48,7 +43,7 @@ export const uploadObjectToBucket = (t, modifier, objectName, objectPath) => {
4843
return uploadNamedObjectToBucket(t, bucketName, objectName, objectPath);
4944
};
5045

51-
export const uploadNamedObjectToBucket = (
46+
export const uploadNamedObjectToBucket = async (
5247
t,
5348
modifier,
5449
objectName,
@@ -62,14 +57,11 @@ export const uploadNamedObjectToBucket = (
6257
accessKey: "minioadmin",
6358
secretKey: "minioadmin",
6459
});
65-
return new Promise((resolve, reject) => {
66-
minioClient.fPutObject(bucketName, objectName, objectPath, {}, (err) => {
67-
if (err) {
68-
console.log(err);
69-
}
70-
resolve("done");
60+
return minioClient
61+
.fPutObject(bucketName, objectName, objectPath, {})
62+
.catch((err) => {
63+
console.log(err);
7164
});
72-
});
7365
};
7466

7567
export const setVersioned = (t, modifier) => {
@@ -139,9 +131,11 @@ export const cleanUpNamedBucketAndUploads = (t, bucket) => {
139131

140132
var stream = minioClient.listObjects(bucket, "", true);
141133

142-
let proms = [];
134+
let proms: any[] = [];
143135
stream.on("data", function (obj) {
144-
proms.push(minioClient.removeObject(bucket, obj.name));
136+
if (obj.name) {
137+
proms.push(minioClient.removeObject(bucket, obj.name));
138+
}
145139
});
146140

147141
stream.on("end", () => {

0 commit comments

Comments
 (0)