Skip to content

Commit

Permalink
fix: to add minify3 git action and some test erro (#1005)
Browse files Browse the repository at this point in the history
* codecov

* fix: to install error

* feat: to add reveal

* feat: to add reveal

* fix: to fix install error

fix: to fix install error

fix: to fix install error

fix: to fix install error

fix: to fix install error

fix: to fix install error

fix: to fix install error

fix: to fix install error

fix: to fix install error

fix: to fix install error

fix: to fix install error

fix: to fix install error

fix: to fix install error

fix: to fix install error

fix: to fix install error

fix: to fix install error

fix: to fix install error

fix: to fix install error

fix: to fix install error

fix: to fix install error

fix: to fix install error

fix: to ci test error

fix: to ci test error

fix: to fix test error

fix: to fix test error

fix: to fix test error

fix: to fix test error

feat: to add feat

feat: to add feat

feat: to add feat

fix: to add network timeout

fix: to add network timeout

fix: to add network timeout

fix: to add network timeout

fix: to add network timeout

fix: to add network timeout

fix: to add network timeout

fix: to add network timeout

fix: to add network timeout

fix: to add network timeout

feat: to fix gitaction test error

feat: to fix network error

* feat: to fix network error

* docs: update outdated links. (#976) (#1002)

Co-authored-by: richex <i@richex.cn>

Co-authored-by: richex-cn <hzxtiger@vip.qq.com>
Co-authored-by: richex <i@richex.cn>
Co-authored-by: peize.rpz <peize.rpz@alibaba-inc.com>

* chore(release): 6.17.0

* feat: to fix network error

feat: to fix network error

feat: to fix network error

* feat: to fix network error

* fix: to fix network error

* fix: to fix network error

* Update node_test.yml

* feat: to remove secrets

* feat: to remove secrets

* fix: to remove travis (#1006)

Co-authored-by: 饶培泽 <peizerao@gmail.com>
Co-authored-by: richex-cn <hzxtiger@vip.qq.com>
Co-authored-by: richex <i@richex.cn>
Co-authored-by: peize.rpz <peize.rpz@alibaba-inc.com>
  • Loading branch information
5 people authored Oct 26, 2021
1 parent f941a2d commit bec8845
Show file tree
Hide file tree
Showing 11 changed files with 135 additions and 128 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/codeCov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ on:
push:
branches: [master]
workflow_run:
workflows: ['Receive PR']

workflows: ['TEST']
types:
- completed

Expand Down
67 changes: 51 additions & 16 deletions .github/workflows/node_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ on:
types:
- completed

jobs:
browser_test:
jobs:
browser_test:
environment: ali_oss_AK
runs-on: macos-latest

env:
ONCI: true
MINIFY: 1
ALI_SDK_OSS_ID: ${{secrets.ALI_SDK_OSS_ID}}
ALI_SDK_OSS_REGION: ${{secrets.ALI_SDK_OSS_REGION}}
ALI_SDK_OSS_SECRET: ${{secrets.ALI_SDK_OSS_SECRET}}
Expand All @@ -32,7 +33,6 @@ jobs:
strategy:
matrix:
node-version: [14.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v2
Expand All @@ -41,15 +41,15 @@ jobs:
curl cip.cc
npm install
mkdir test/browser/build
node browser-build.js > test/browser/build/aliyun-oss-sdk.min.js
node browser-build.js > test/browser/build/aliyun-oss-sdk.min.js
node task/browser-test-build.js > test/browser/build/tests.js
npx karma start
node_10:
node_10:
environment: ali_oss_AK
runs-on: macos-latest

env:
ONCI: true
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}}
Expand All @@ -58,7 +58,6 @@ jobs:
ALI_SDK_STS_REGION: ${{secrets.ALI_SDK_STS_REGION}}
ALI_SDK_STS_ROLE: ${{secrets.ALI_SDK_STS_ROLE}}
ALI_SDK_STS_SECRET: ${{secrets.ALI_SDK_STS_SECRET}}
ONCI: true


strategy:
Expand All @@ -72,23 +71,26 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm install
- run: npm run test
- run: node test/node/cleanAllBucket.js

node_12:
node_12:
if: always()
needs: [node_10]
environment: ali_oss_AK
runs-on: macos-latest

env:
ONCI: true
ALI_SDK_OSS_ID: ${{secrets.ALI_SDK_OSS_ID}}
ALI_SDK_OSS_REGION: ${{secrets.ALI_SDK_OSS_REGION}}
ALI_SDK_OSS_SECRET: ${{secrets.ALI_SDK_OSS_SECRET}}
ALI_SDK_OSS_REGION: ${{secrets.ALI_SDK_OSS_REGION}}
ALI_SDK_STS_BUCKET: ${{secrets.ALI_SDK_STS_BUCKET}}
ALI_SDK_STS_ID: ${{secrets.ALI_SDK_STS_ID}}
ALI_SDK_STS_REGION: ${{secrets.ALI_SDK_STS_REGION}}
ALI_SDK_STS_ROLE: ${{secrets.ALI_SDK_STS_ROLE}}
ALI_SDK_STS_SECRET: ${{secrets.ALI_SDK_STS_SECRET}}
ONCI: true


strategy:
Expand All @@ -102,23 +104,26 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm install
- run: npm run test
- run: node test/node/cleanAllBucket.js

node_14:
node_14:
if: always()
needs: [node_10,node_12]
environment: ali_oss_AK
runs-on: macos-latest

env:
ONCI: true
ALI_SDK_OSS_ID: ${{secrets.ALI_SDK_OSS_ID}}
ALI_SDK_OSS_REGION: ${{secrets.ALI_SDK_OSS_REGION}}
ALI_SDK_OSS_SECRET: ${{secrets.ALI_SDK_OSS_SECRET}}
ALI_SDK_OSS_REGION: ${{secrets.ALI_SDK_OSS_REGION}}
ALI_SDK_STS_BUCKET: ${{secrets.ALI_SDK_STS_BUCKET}}
ALI_SDK_STS_ID: ${{secrets.ALI_SDK_STS_ID}}
ALI_SDK_STS_REGION: ${{secrets.ALI_SDK_STS_REGION}}
ALI_SDK_STS_ROLE: ${{secrets.ALI_SDK_STS_ROLE}}
ALI_SDK_STS_SECRET: ${{secrets.ALI_SDK_STS_SECRET}}
ONCI: true

strategy:
matrix:
Expand All @@ -131,5 +136,35 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm install
- run: npm run test
- run: node test/node/cleanAllBucket.js

cleanAllBucket:
if: always()
needs: [node_10,node_12,node_14]
environment: ali_oss_AK
runs-on: ubuntu-latest

env:
ONCI: true
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_STS_BUCKET: ${{secrets.ALI_SDK_STS_BUCKET}}
ALI_SDK_STS_ID: ${{secrets.ALI_SDK_STS_ID}}
ALI_SDK_STS_REGION: ${{secrets.ALI_SDK_STS_REGION}}
ALI_SDK_STS_ROLE: ${{secrets.ALI_SDK_STS_ROLE}}
ALI_SDK_STS_SECRET: ${{secrets.ALI_SDK_STS_SECRET}}

strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v2
- name: clean all bucket
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: node test/node/cleanAllBucket.js
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
},
"scripts": {
"build-change-log": "standard-version",
"test": "npm run tsc && mocha -t 60000 -r should -r dotenv/config test/node/*.test.js test/node/**/*.test.js",
"test-cov": "npm run tsc && nyc --reporter=lcov node_modules/.bin/_mocha -t 60000 -r should test/node/*.test.js test/node/**/*.test.js",
"test": "npm run tsc && mocha -t 120000 -r should -r dotenv/config test/node/*.test.js test/node/**/*.test.js",
"test-cov": "npm run tsc && nyc --reporter=lcov node_modules/.bin/_mocha -t 120000 -r should test/node/*.test.js test/node/**/*.test.js",
"jshint": "jshint .",
"autod": "autod",
"build-test": "MINIFY=1 node browser-build.js > test/browser/build/aliyun-oss-sdk.min.js && node -r dotenv/config task/browser-test-build.js > test/browser/build/tests.js",
Expand Down
49 changes: 21 additions & 28 deletions test/node/bucket.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,18 @@ describe('test/bucket.test.js', () => {
const defaultRegion = config.region;
before(async () => {
store = oss(config);

const bucketResult = await store.listBuckets({
// prefix: '',
'max-keys': 20
});

await Promise.all(
(bucketResult.buckets || [])
.filter(_ => _.name.startsWith('ali-oss'))
.map(_bucket => utils.cleanBucket(oss(Object.assign(config, { region: _bucket.region })), _bucket.name))
);

config.region = defaultRegion;
store = oss(config);
bucket = `ali-oss-test-bucket-${prefix.replace(/[/.]/g, '-')}`;
bucket = bucket.substring(0, bucket.length - 1);
bucketRegion = defaultRegion;

const result = await store.putBucket(bucket);
const result = await store.putBucket(bucket, { timeout: process.env.ONCI ? 60000 : 10000 });
assert.equal(result.bucket, bucket);
assert.equal(result.res.status, 200);
});

after(async () => {
await utils.cleanBucket(store, bucket);
await utils.cleanAllBucket(store);
});

describe('setBucket()', () => {
Expand Down Expand Up @@ -79,18 +66,20 @@ describe('test/bucket.test.js', () => {
// just for archive bucket test
archvieBucket = `ali-oss-archive-bucket-${prefix.replace(/[/.]/g, '-')}`;
archvieBucket = archvieBucket.substring(0, archvieBucket.length - 1);
await store.putBucket(archvieBucket, { StorageClass: 'Archive' });
await store.putBucket(archvieBucket, { StorageClass: 'Archive', timeout: 120000 });
});

it('should create a new bucket', async () => {
const result1 = await store.putBucket(name);
const result1 = await store.putBucket(name, { timeout: 120000 });
assert.equal(result1.bucket, name);
assert.equal(result1.res.status, 200);
});

it('should create an archive bucket', async () => {
await utils.sleep(ms(metaSyncTime));
const result2 = await store.listBuckets();
const result2 = await store.listBuckets({}, {
timeout: 120000,
});
const { buckets } = result2;
const m = buckets.some(item => item.name === archvieBucket);
assert(m === true);
Expand Down Expand Up @@ -174,6 +163,7 @@ describe('test/bucket.test.js', () => {
it('should delete not empty bucket throw BucketNotEmptyError', async () => {
store.useBucket(bucket);
await store.put('ali-oss-test-bucket.txt', __filename);
utils.sleep(ms(metaSyncTime));
await utils.throws(async () => {
await store.deleteBucket(bucket);
}, 'BucketNotEmptyError');
Expand Down Expand Up @@ -223,7 +213,9 @@ describe('test/bucket.test.js', () => {
it('should list buckets by prefix', async () => {
const result = await store.listBuckets({
prefix: listBucketsPrefix,
'max-keys': 20
'max-keys': 20,
}, {
timeout: 120000
});

assert(Array.isArray(result.buckets));
Expand Down Expand Up @@ -413,7 +405,7 @@ describe('test/bucket.test.js', () => {
it('should create, get and delete the referer', async () => {
const putresult = await store.putBucketReferer(bucket, true, [
'http://npm.taobao.org'
]);
], { timeout: 120000 });
assert.equal(putresult.res.status, 200);

// put again will be fine
Expand All @@ -422,7 +414,7 @@ describe('test/bucket.test.js', () => {
'https://npm.taobao.org',
'http://cnpmjs.org'
];
const putReferer = await store.putBucketReferer(bucket, false, referers);
const putReferer = await store.putBucketReferer(bucket, false, referers, { timeout: 120000 });
assert.equal(putReferer.res.status, 200);

await utils.sleep(ms(metaSyncTime));
Expand All @@ -442,7 +434,7 @@ describe('test/bucket.test.js', () => {
describe('putBucketCORS(), getBucketCORS(), deleteBucketCORS()', () => {
afterEach(async () => {
// delete it
const result = await store.deleteBucketCORS(bucket);
const result = await store.deleteBucketCORS(bucket, { timeout: 120000 });
assert.equal(result.res.status, 204);
});

Expand All @@ -457,7 +449,7 @@ describe('test/bucket.test.js', () => {
const putResult = await store.putBucketCORS(bucket, rules);
assert.equal(putResult.res.status, 200);

const getResult = await store.getBucketCORS(bucket);
const getResult = await store.getBucketCORS(bucket, { timeout: 120000 });
assert.equal(getResult.res.status, 200);
assert.deepEqual(getResult.rules, [{
allowedOrigin: '*',
Expand All @@ -471,14 +463,15 @@ describe('test/bucket.test.js', () => {
it('should overwrite cors', async () => {
const rules1 = [{
allowedOrigin: '*',
allowedMethod: 'GET'
allowedMethod: 'GET',
timeout: 120000
}];
const putCorsResult1 = await store.putBucketCORS(bucket, rules1);
assert.equal(putCorsResult1.res.status, 200);

await utils.sleep(ms('1000ms'));
await utils.sleep(ms(metaSyncTime));

const getCorsResult1 = await store.getBucketCORS(bucket);
const getCorsResult1 = await store.getBucketCORS(bucket, { timeout: 120000 });
assert.equal(getCorsResult1.res.status, 200);
assert.deepEqual(getCorsResult1.rules, [{
allowedOrigin: '*',
Expand All @@ -492,9 +485,9 @@ describe('test/bucket.test.js', () => {
const putCorsResult2 = await store.putBucketCORS(bucket, rules2);
assert.equal(putCorsResult2.res.status, 200);

await utils.sleep(ms('1000ms'));
await utils.sleep(ms(metaSyncTime));

const getCorsResult2 = await store.getBucketCORS(bucket);
const getCorsResult2 = await store.getBucketCORS(bucket, { timeout: 120000 });
assert.equal(getCorsResult2.res.status, 200);
assert.deepEqual(getCorsResult2.rules, [{
allowedOrigin: 'localhost',
Expand Down
20 changes: 4 additions & 16 deletions test/node/bucket_worm.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,19 @@ describe('test/bucket_worm.test.js', () => {
const defaultRegion = config.region;
before(async () => {
store = oss(config);

const bucketResult = await store.listBuckets({
'max-keys': 20
});

await Promise.all((bucketResult.buckets || [])
.filter(_ => _.name.startsWith('ali-oss'))
.map(_bucket => utils
.cleanBucket(
oss(Object.assign(config, { region: _bucket.region })),
_bucket.name
)));

config.region = defaultRegion;
store = oss(config);
bucket = `ali-oss-test-bucket-worm-${prefix.replace(/[/.]/g, '-')}`;
bucket = `ali-oss-test-worm-bucket-worm-${prefix.replace(/[/.]/g, '-')}`;
bucket = bucket.substring(0, bucket.length - 1);

const result = await store.putBucket(bucket);
const result = await store.putBucket(bucket, {
timeout: process.env.ONCI ? 60000 : 10000 });
assert.equal(result.bucket, bucket);
assert.equal(result.res.status, 200);
});

after(async () => {
await utils.cleanBucket(store, bucket);
await utils.cleanAllBucket(store);
});
describe('worm()', () => {
describe('initiateBucketWorm()', () => {
Expand Down
Loading

0 comments on commit bec8845

Please sign in to comment.