Skip to content

Commit

Permalink
Make permission tests compatible with minio-js v8
Browse files Browse the repository at this point in the history
Fixes #3322
  • Loading branch information
kaankabalak committed May 1, 2024
1 parent fe534ab commit 0c91529
Show file tree
Hide file tree
Showing 4 changed files with 518 additions and 371 deletions.
44 changes: 22 additions & 22 deletions .github/workflows/jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ jobs:
working-directory: ./
continue-on-error: false
run: |
yarn add minio@7.1.3
yarn add minio
- uses: actions/cache@v3
name: Console Binary Cache
Expand All @@ -239,7 +239,7 @@ jobs:
(CONSOLE_SUBPATH=/console/subpath ./console server ) & (make test-initialize-minio-nginx)
- name: Install TestCafe
run: npm install testcafe@3.0.0
run: npm install testcafe@3.5.0

- name: Run TestCafe Tests
run: npx testcafe "chrome:headless" web-app/tests/subpath-nginx/ -q --skip-js-errors -c 3
Expand Down Expand Up @@ -269,7 +269,7 @@ jobs:
working-directory: ./
continue-on-error: false
run: |
yarn add minio@7.1.3
yarn add minio
- uses: actions/cache@v3
name: Console Binary Cache
Expand All @@ -288,7 +288,7 @@ jobs:
(./console server) & (make initialize-permissions)
- name: Install TestCafe
run: npm install testcafe@3.0.0
run: npm install testcafe@3.5.0

- name: Run TestCafe Tests
run: npx testcafe "chrome:headless" web-app/tests/permissions-1/ -q --skip-js-errors -c 3
Expand Down Expand Up @@ -317,7 +317,7 @@ jobs:
working-directory: ./
continue-on-error: false
run: |
yarn add minio@7.1.3
yarn add minio
- uses: actions/cache@v3
name: Console Binary Cache
with:
Expand All @@ -335,7 +335,7 @@ jobs:
(./console server) & (make initialize-permissions)
- name: Install TestCafe
run: npm install testcafe@3.0.0
run: npm install testcafe@3.5.0

- name: Run TestCafe Tests
run: npx testcafe "chrome:headless" web-app/tests/permissions-2/ -q --skip-js-errors -c 3
Expand Down Expand Up @@ -364,7 +364,7 @@ jobs:
working-directory: ./
continue-on-error: false
run: |
yarn add minio@7.1.3
yarn add minio
- uses: actions/cache@v3
name: Console Binary Cache
with:
Expand All @@ -382,7 +382,7 @@ jobs:
(./console server) & (make initialize-permissions)
- name: Install TestCafe
run: npm install testcafe@3.0.0
run: npm install testcafe@3.5.0

- name: Run TestCafe Tests
run: npx testcafe "chrome:headless" web-app/tests/permissions-3/ -q --skip-js-errors -c 3
Expand Down Expand Up @@ -411,7 +411,7 @@ jobs:
working-directory: ./
continue-on-error: false
run: |
yarn add minio@7.1.3
yarn add minio
- uses: actions/cache@v3
name: Console Binary Cache
with:
Expand All @@ -429,7 +429,7 @@ jobs:
(./console server) & (make initialize-permissions)
- name: Install TestCafe
run: npm install testcafe@3.0.0
run: npm install testcafe@3.5.0

- name: Run TestCafe Tests
timeout-minutes: 10
Expand All @@ -454,7 +454,7 @@ jobs:
working-directory: ./
continue-on-error: false
run: |
yarn add minio@7.1.3
yarn add minio
- uses: actions/cache@v3
name: Console Binary Cache
with:
Expand All @@ -472,7 +472,7 @@ jobs:
(./console server) & (make initialize-permissions)
- name: Install TestCafe
run: npm install testcafe@3.0.0
run: npm install testcafe@3.5.0

- name: Run TestCafe Tests
timeout-minutes: 5
Expand All @@ -497,7 +497,7 @@ jobs:
working-directory: ./
continue-on-error: false
run: |
yarn add minio@7.1.3
yarn add minio
- uses: actions/cache@v3
name: Console Binary Cache
with:
Expand All @@ -515,7 +515,7 @@ jobs:
(./console server) & (make initialize-permissions)
- name: Install TestCafe
run: npm install testcafe@3.0.0
run: npm install testcafe@3.5.0

- name: Run TestCafe Tests
timeout-minutes: 5
Expand All @@ -540,7 +540,7 @@ jobs:
working-directory: ./
continue-on-error: false
run: |
yarn add minio@7.1.3
yarn add minio
- uses: actions/cache@v3
name: Console Binary Cache
with:
Expand All @@ -557,7 +557,7 @@ jobs:
run: |
(./console server) & (make initialize-permissions)
- name: Install TestCafe
run: npm install testcafe@3.0.0
run: npm install testcafe@3.5.0

- name: Run TestCafe Tests
timeout-minutes: 5
Expand All @@ -582,7 +582,7 @@ jobs:
working-directory: ./
continue-on-error: false
run: |
yarn add minio@7.1.3
yarn add minio
- uses: actions/cache@v3
name: Console Binary Cache
with:
Expand All @@ -600,7 +600,7 @@ jobs:
(./console server) & (make initialize-permissions)
- name: Install TestCafe
run: npm install testcafe@3.0.0
run: npm install testcafe@3.5.0

- name: Run TestCafe Tests
timeout-minutes: 5
Expand All @@ -625,7 +625,7 @@ jobs:
working-directory: ./
continue-on-error: false
run: |
yarn add minio@7.1.3
yarn add minio
- uses: actions/cache@v3
name: Console Binary Cache
with:
Expand All @@ -643,7 +643,7 @@ jobs:
(./console server) & (make initialize-permissions)
- name: Install TestCafe
run: npm install testcafe@3.0.0
run: npm install testcafe@3.5.0

- name: Run TestCafe Tests
run: npx testcafe "chrome:headless" web-app/tests/permissions-A/ --skip-js-errors -c 3
Expand Down Expand Up @@ -671,7 +671,7 @@ jobs:
working-directory: ./
continue-on-error: false
run: |
yarn add minio@7.1.3
yarn add minio
- uses: actions/cache@v3
name: Console Binary Cache
with:
Expand All @@ -689,7 +689,7 @@ jobs:
(./console server) & (make initialize-permissions)
- name: Install TestCafe
run: npm install testcafe@3.0.0
run: npm install testcafe@3.5.0

- name: Run TestCafe Tests
run: npx testcafe "chrome:headless" web-app/tests/permissions-B/ --skip-js-errors -c 3
Expand Down
5 changes: 2 additions & 3 deletions web-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
"@playwright/test": "^1.43.0",
"@types/lodash": "^4.17.0",
"@types/luxon": "^3.4.2",
"@types/minio": "7.1.1",
"@types/node": "18.16.0",
"@types/react": "18.2.75",
"@types/react-copy-to-clipboard": "^5.0.5",
Expand All @@ -77,13 +76,13 @@
"@types/webpack-env": "^1.18.2",
"babel-plugin-istanbul": "^6.1.1",
"customize-cra": "^1.0.0",
"minio": "^7.1.3",
"minio": "^8.0.0",
"nyc": "^15.1.0",
"prettier": "3.2.5",
"react-app-rewire-hot-loader": "^2.0.1",
"react-app-rewired": "^2.2.1",
"react-scripts": "5.0.1",
"testcafe": "^2.6.2",
"testcafe": "3.5.0",
"ts-prune": "^0.10.3",
"typescript": "^4.4.3"
},
Expand Down
26 changes: 9 additions & 17 deletions web-app/tests/utils/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,8 @@ export const setUpNamedBucket = (t, name) => {
accessKey: "minioadmin",
secretKey: "minioadmin",
});
return new Promise((resolve, reject) => {
minioClient.makeBucket(name, "us-east-1", (err) => {
if (err) {
console.log(err);
}
resolve("done: " + err);
});
return minioClient.makeBucket(name, "us-east-1").catch(err => {
console.log(err);
});
};

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

export const uploadNamedObjectToBucket = (
export const uploadNamedObjectToBucket = async (
t,
modifier,
objectName,
Expand All @@ -62,13 +57,8 @@ export const uploadNamedObjectToBucket = (
accessKey: "minioadmin",
secretKey: "minioadmin",
});
return new Promise((resolve, reject) => {
minioClient.fPutObject(bucketName, objectName, objectPath, {}, (err) => {
if (err) {
console.log(err);
}
resolve("done");
});
return minioClient.fPutObject(bucketName, objectName, objectPath, {}).catch(err => {
console.log(err);
});
};

Expand Down Expand Up @@ -139,9 +129,11 @@ export const cleanUpNamedBucketAndUploads = (t, bucket) => {

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

let proms = [];
let proms: any[] = [];
stream.on("data", function (obj) {
proms.push(minioClient.removeObject(bucket, obj.name));
if (obj.name) {
proms.push(minioClient.removeObject(bucket, obj.name));
}
});

stream.on("end", () => {
Expand Down
Loading

0 comments on commit 0c91529

Please sign in to comment.