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 11import { CdnDeployInputs } from './../src/modules/cdn/interface' ;
22import { Cdn } from '../src' ;
3- import { getCdnByDomain } from '../src/modules/cdn/utils' ;
3+ import { getCdnByDomain , openCdnService } from '../src/modules/cdn/utils' ;
44import { sleep } from '@ygkit/request' ;
55
66describe ( 'Cdn' , ( ) => {
@@ -42,6 +42,12 @@ describe('Cdn', () => {
4242 } ;
4343 const cdn = new Cdn ( credentials ) ;
4444
45+ test ( 'openCdnService' , async ( ) => {
46+ await openCdnService ( cdn . capi ) ;
47+
48+ expect ( true ) . toEqual ( true ) ;
49+ } ) ;
50+
4551 test ( 'should deploy CDN success with originType = cos' , async ( ) => {
4652 await sleep ( 5000 ) ;
4753 const res = await cdn . deploy ( inputs ) ;
Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ export default class Apigw {
8686 environment = 'release' as const ,
8787 oldState = { } ,
8888 isInputServiceId = false ,
89- isAutoRelease = false ,
89+ isAutoRelease = true ,
9090 } = inputs ;
9191 if ( isInputServiceId ) {
9292 return this . deployWIthInputServiceId ( inputs as ApigwDeployWithServiceIdInputs ) ;
@@ -112,7 +112,7 @@ export default class Apigw {
112112 environment,
113113 } ) ;
114114
115- if ( ! isAutoRelease ) {
115+ if ( isAutoRelease ) {
116116 await this . service . release ( { serviceId, environment } ) ;
117117 }
118118
@@ -246,7 +246,7 @@ export default class Apigw {
246246 environment,
247247 } ) ;
248248
249- if ( ! isAutoRelease ) {
249+ if ( isAutoRelease ) {
250250 await this . service . release ( { serviceId, environment } ) ;
251251 }
252252
Original file line number Diff line number Diff line change @@ -123,9 +123,14 @@ export async function openCdnService(capi: Capi) {
123123 PayTypeMainland : 'flux' ,
124124 PayTypeOverseas : 'flux' ,
125125 } ) ;
126+ return true ;
126127 } catch ( e ) {
127- if ( e . code !== 'ResourceInUse.CdnUserExists' ) {
128+ if (
129+ e . code !== 'ResourceInUse.CdnUserExists' &&
130+ e . code !== 'UnauthorizedOperation.OperationTooOften'
131+ ) {
128132 throw e ;
129133 }
134+ return false ;
130135 }
131136}
You can’t perform that action at this time.
0 commit comments