Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Node.js 23 #23

Merged
merged 4 commits into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions .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]
node-version: [16, 18, 20, 22, 23]
os: [ubuntu-latest]

steps:
Expand All @@ -36,16 +36,11 @@ jobs:
- name: Continuous Integration
run: npm run ci
env:
ALI_SDK_OSS_ID: ${{ secrets.ALI_SDK_OSS_ID }}
ALI_SDK_OSS_SECRET: ${{ secrets.ALI_SDK_OSS_SECRET }}
ALI_SDK_OSS_REGION: ${{ secrets.ALI_SDK_OSS_REGION }}
ALI_SDK_OSS_ENDPOINT: ${{ secrets.ALI_SDK_OSS_ENDPOINT }}
ALI_SDK_OSS_BUCKET: ${{ secrets.ALI_SDK_OSS_BUCKET }}
ALI_SDK_STS_ID: ${{ secrets.ALI_SDK_STS_ID }}
ALI_SDK_STS_SECRET: ${{ secrets.ALI_SDK_STS_SECRET }}
ALI_SDK_STS_ROLE: ${{ secrets.ALI_SDK_STS_ROLE }}
ALI_SDK_STS_BUCKET: ${{ secrets.ALI_SDK_STS_BUCKET }}
ALI_SDK_STS_ENDPOINT: ${{ secrets.ALI_SDK_STS_ENDPOINT }}
OSS_CLIENT_ID: ${{ secrets.OSS_CLIENT_ID }}
OSS_CLIENT_SECRET: ${{ secrets.OSS_CLIENT_SECRET }}
OSS_CLIENT_REGION: ${{ secrets.OSS_CLIENT_REGION }}
OSS_CLIENT_ENDPOINT: ${{ secrets.OSS_CLIENT_ENDPOINT }}
OSS_CLIENT_BUCKET: ${{ secrets.OSS_CLIENT_BUCKET }}

- name: Code Coverage
uses: codecov/codecov-action@v3
Expand Down
24 changes: 14 additions & 10 deletions test/OSSObject.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ describe('test/OSSObject.test.ts', () => {
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

// OSSClientError: Access denied by bucket policy.
describe.skip('list()', () => {
describe('list()', () => {
// oss.jpg
// fun/test.jpg
// fun/movie/001.avi
Expand All @@ -42,9 +41,12 @@ describe('test/OSSObject.test.ts', () => {
assert.equal(typeof obj.name, 'string');
assert.equal(typeof obj.lastModified, 'string');
assert.equal(typeof obj.etag, 'string');
assert(obj.type === 'Normal' || obj.type === 'Multipart');
assert(obj.type === 'Normal' || obj.type === 'Multipart' || obj.type === 'Appendable' || obj.type === 'Symlink',
`invalid obj.type ${obj.type}`);
assert.equal(typeof obj.size, 'number');
assert.equal(obj.storageClass, 'Standard');
// assert.equal(obj.storageClass, 'Standard');
assert(obj.storageClass === 'Standard' || obj.storageClass === 'IA',
`invalid obj.storageClass ${obj.storageClass}`);
assert.equal(typeof obj.owner, 'object');
assert.equal(typeof obj.owner!.id, 'string');
assert.equal(typeof obj.owner!.displayName, 'string');
Expand All @@ -56,6 +58,7 @@ describe('test/OSSObject.test.ts', () => {
// console.log(result.objects);
result.objects.map(checkObjectProperties);
assert.equal(typeof result.nextMarker, 'string');
// console.log(result.isTruncated);
assert(result.isTruncated);
assert.deepEqual(result.prefixes, []);
assert(result.res.headers.date);
Expand All @@ -66,7 +69,7 @@ describe('test/OSSObject.test.ts', () => {
assert(obj.size > 0);
});

it('should list timeout work', async () => {
it.skip('should list timeout work', async () => {
await assert.rejects(async () => {
await ossObject.list({}, { timeout: 1 });
}, (err: Error) => {
Expand Down Expand Up @@ -168,8 +171,7 @@ describe('test/OSSObject.test.ts', () => {
});
});

// OSSClientError: Access denied by bucket policy.
describe.skip('listV2()', () => {
describe('listV2()', () => {
const listPrefix = `${prefix}oss-client/listV2/`;
before(async () => {
await ossObject.put(`${listPrefix}oss.jpg`, Buffer.from('oss.jpg'));
Expand All @@ -186,7 +188,8 @@ describe('test/OSSObject.test.ts', () => {
assert.equal(typeof obj.etag, 'string');
assert(obj.type === 'Normal' || obj.type === 'Multipart');
assert.equal(typeof obj.size, 'number');
assert.equal(obj.storageClass, 'Standard');
// assert.equal(obj.storageClass, 'Standard');
assert(obj.storageClass === 'Standard' || obj.storageClass === 'IA');
if (options?.owner) {
assert(typeof obj.owner!.id === 'string' && typeof obj.owner!.displayName === 'string');
} else {
Expand Down Expand Up @@ -924,12 +927,13 @@ describe('test/OSSObject.test.ts', () => {
assert(r2.owner.displayName);
assert(r2.owner.id);

const r3 = await ossObject.putACL(name, 'public-read');
// public-read, Put public object acl is not allowed
const r3 = await ossObject.putACL(name, 'private');
assert.equal(r3.res.status, 200);

const r4 = await ossObject.getACL(name);
assert.equal(r4.res.status, 200);
assert.equal(r4.acl, 'public-read');
assert.equal(r4.acl, 'private');

const r5 = await ossObject.get(name);
assert.equal(r5.res.status, 200);
Expand Down
10 changes: 5 additions & 5 deletions test/config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export default {
prefix: `${process.platform}-${process.version}-${new Date().getTime()}/`,
oss: {
accessKeyId: process.env.OSS_CLIENT_ID! || process.env.ALI_SDK_OSS_ID!,
accessKeySecret: process.env.OSS_CLIENT_SECRET! || process.env.ALI_SDK_OSS_SECRET!,
region: process.env.OSS_CLIENT_REGION || process.env.ALI_SDK_OSS_REGION,
endpoint: process.env.OSS_CLIENT_ENDPOINT! || process.env.ALI_SDK_OSS_ENDPOINT!,
bucket: process.env.OSS_CLIENT_BUCKET! || process.env.ALI_SDK_OSS_BUCKET!,
accessKeyId: process.env.OSS_CLIENT_ID!,
accessKeySecret: process.env.OSS_CLIENT_SECRET!,
region: process.env.OSS_CLIENT_REGION!,
endpoint: process.env.OSS_CLIENT_ENDPOINT!,
bucket: process.env.OSS_CLIENT_BUCKET!,
},
timeout: '120s',
};
Loading