File tree Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Original file line number Diff line number Diff line change 1
1
import { CdnDeployInputs } from './../src/modules/cdn/interface' ;
2
2
import { Cdn } from '../src' ;
3
- import { getCdnByDomain } from '../src/modules/cdn/utils' ;
3
+ import { getCdnByDomain , openCdnService } from '../src/modules/cdn/utils' ;
4
4
import { sleep } from '@ygkit/request' ;
5
5
6
6
describe ( 'Cdn' , ( ) => {
@@ -42,6 +42,12 @@ describe('Cdn', () => {
42
42
} ;
43
43
const cdn = new Cdn ( credentials ) ;
44
44
45
+ test ( 'openCdnService' , async ( ) => {
46
+ await openCdnService ( cdn . capi ) ;
47
+
48
+ expect ( true ) . toEqual ( true ) ;
49
+ } ) ;
50
+
45
51
test ( 'should deploy CDN success with originType = cos' , async ( ) => {
46
52
await sleep ( 5000 ) ;
47
53
const res = await cdn . deploy ( inputs ) ;
Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ export default class Apigw {
86
86
environment = 'release' as const ,
87
87
oldState = { } ,
88
88
isInputServiceId = false ,
89
- isAutoRelease = false ,
89
+ isAutoRelease = true ,
90
90
} = inputs ;
91
91
if ( isInputServiceId ) {
92
92
return this . deployWIthInputServiceId ( inputs as ApigwDeployWithServiceIdInputs ) ;
@@ -112,7 +112,7 @@ export default class Apigw {
112
112
environment,
113
113
} ) ;
114
114
115
- if ( ! isAutoRelease ) {
115
+ if ( isAutoRelease ) {
116
116
await this . service . release ( { serviceId, environment } ) ;
117
117
}
118
118
@@ -246,7 +246,7 @@ export default class Apigw {
246
246
environment,
247
247
} ) ;
248
248
249
- if ( ! isAutoRelease ) {
249
+ if ( isAutoRelease ) {
250
250
await this . service . release ( { serviceId, environment } ) ;
251
251
}
252
252
Original file line number Diff line number Diff line change @@ -123,9 +123,14 @@ export async function openCdnService(capi: Capi) {
123
123
PayTypeMainland : 'flux' ,
124
124
PayTypeOverseas : 'flux' ,
125
125
} ) ;
126
+ return true ;
126
127
} catch ( e ) {
127
- if ( e . code !== 'ResourceInUse.CdnUserExists' ) {
128
+ if (
129
+ e . code !== 'ResourceInUse.CdnUserExists' &&
130
+ e . code !== 'UnauthorizedOperation.OperationTooOften'
131
+ ) {
128
132
throw e ;
129
133
}
134
+ return false ;
130
135
}
131
136
}
You can’t perform that action at this time.
0 commit comments