Skip to content

Commit

Permalink
fix: error detail from header
Browse files Browse the repository at this point in the history
  • Loading branch information
csg01123119 committed Jul 26, 2024
1 parent 5a23c29 commit d845779
Show file tree
Hide file tree
Showing 3 changed files with 193 additions and 10 deletions.
172 changes: 168 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@
"node": ">=8"
},
"devDependencies": {
"@alicloud/openapi-client": "^0.4.10",
"@alicloud/resourcemanager20200331": "^2.3.0",
"@alicloud/tea-util": "^1.4.9",
"@babel/core": "^7.11.6",
"@babel/plugin-transform-regenerator": "^7.10.4",
"@babel/plugin-transform-runtime": "^7.11.5",
Expand Down
28 changes: 22 additions & 6 deletions test/node/bucket.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
/* eslint-disable @typescript-eslint/no-require-imports */
const assert = require('assert');
const utils = require('./utils');
const oss = require('../..');
const ms = require('humanize-ms');
const { default: ResourceManager, ListResourceGroupsRequest } = require('@alicloud/resourcemanager20200331');
const { Config: OConfig } = require('@alicloud/openapi-client');
const { RuntimeOptions } = require('@alicloud/tea-util');

const { oss: config, metaSyncTime, timeout } = require('../config');

describe('test/bucket.test.js', () => {
Expand Down Expand Up @@ -265,12 +270,23 @@ describe('test/bucket.test.js', () => {
}
});

it('should list buckets by group id', async () => {
const { buckets } = await store.listBuckets(
{},
{ headers: { 'x-oss-resource-group-id': 'rg-acfmwscflgywd3q' } } // default resource group
);
assert(buckets.length > 0);
it.only('should list buckets by group id', async () => {
const { accessKeyId, accessKeySecret } = config;
const oconfig = new OConfig({
accessKeyId,
accessKeySecret
});
oconfig.endpoint = `resourcemanager.aliyuncs.com`;
const client = new ResourceManager(oconfig);
const runtime = new RuntimeOptions({});
const {
body: {
resourceGroups: { resourceGroup }
}
} = await client.listResourceGroupsWithOptions(new ListResourceGroupsRequest({}), runtime);
const { id } = resourceGroup.find(re => re.name === 'sdktest');
const { buckets } = await store.listBuckets({}, { headers: { 'x-oss-resource-group-id': id } });
assert(buckets.length, 2);
});

after(async () => {
Expand Down

0 comments on commit d845779

Please sign in to comment.