Skip to content

Commit

Permalink
feat: upgrade urllib to 4.x (#26)
Browse files Browse the repository at this point in the history
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
	- Updated Node.js engine requirement to version 18.19.0 or higher.
	- Upgraded `urllib` dependency to version 4.6.2.

- **Chores**
- Adjusted CI workflow to remove Node.js version 16 from testing matrix,
focusing on versions 18, 20, 22, and 23.

- **Tests**
- Modified test suite for `OSSObject` class, focusing on the `copy()`
method and maintaining core functionality checks, including tests for
non-English names and metadata handling.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
killagu authored Dec 5, 2024
1 parent b384e48 commit ad9346f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [16, 18, 20, 22, 23]
node-version: [18, 20, 22, 23]
os: [ubuntu-latest]

steps:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"ms": "^2.1.3",
"oss-interface": "^1.3.0",
"stream-wormhole": "^2.0.0",
"urllib": "^3.19.2",
"urllib": "^4.6.2",
"utility": "^2.1.0",
"xml2js": "^0.6.2"
},
Expand Down
47 changes: 25 additions & 22 deletions test/OSSObject.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ describe('test/OSSObject.test.ts', () => {
}

it('should list with query', async () => {
const result = await ossObject.list();
const result = await ossObject.list({
prefix: listPrefix,
'max-keys': 5,
});
assert(result.objects.length > 0);
// console.log(result.objects);
result.objects.map(checkObjectProperties);
Expand Down Expand Up @@ -1728,8 +1731,8 @@ describe('test/OSSObject.test.ts', () => {
describe('copy()', () => {
let name: string;
let resHeaders: IncomingHttpHeaders;
let otherBucket: string;
let otherBucketObject: string;
// let otherBucket: string;
// let otherBucketObject: string;
before(async () => {
name = `${prefix}oss-client/oss/copy-meta.js`;
const object = await ossObject.put(name, __filename, {
Expand Down Expand Up @@ -1783,25 +1786,25 @@ describe('test/OSSObject.test.ts', () => {
assert.strictEqual(res.headers['content-disposition'], disposition);
});

it.skip('should copy object from other bucket, sourceBucket in copySource', async () => {
const copySource = `/${otherBucket}/${otherBucketObject}`;
const copyTarget = `${prefix}oss-client/oss/copy-target.js`;
const result = await ossObject.copy(copyTarget, copySource);
assert.equal(result.res.status, 200);

const info = await ossObject.head(copyTarget);
assert.equal(info.status, 200);
});

it.skip('should copy object from other bucket, sourceBucket is a separate parameter', async () => {
const copySource = otherBucketObject;
const copyTarget = `${prefix}oss-client/oss/has-bucket-name-copy-target.js`;
const result = await ossObject.copy(copyTarget, copySource, otherBucket);
assert.equal(result.res.status, 200);

const info = await ossObject.head(copyTarget);
assert.equal(info.status, 200);
});
// it.skip('should copy object from other bucket, sourceBucket in copySource', async () => {
// const copySource = `/${otherBucket}/${otherBucketObject}`;
// const copyTarget = `${prefix}oss-client/oss/copy-target.js`;
// const result = await ossObject.copy(copyTarget, copySource);
// assert.equal(result.res.status, 200);
//
// const info = await ossObject.head(copyTarget);
// assert.equal(info.status, 200);
// });

// it.skip('should copy object from other bucket, sourceBucket is a separate parameter', async () => {
// const copySource = otherBucketObject;
// const copyTarget = `${prefix}oss-client/oss/has-bucket-name-copy-target.js`;
// const result = await ossObject.copy(copyTarget, copySource, otherBucket);
// assert.equal(result.res.status, 200);
//
// const info = await ossObject.head(copyTarget);
// assert.equal(info.status, 200);
// });

it('should copy object with non-english name', async () => {
const sourceName = `${prefix}oss-client/oss/copy-meta_测试.js`;
Expand Down

0 comments on commit ad9346f

Please sign in to comment.