File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,15 @@ describe('Cynosdb', () => {
99
99
ip : expect . any ( String ) ,
100
100
port : 3306 ,
101
101
} ,
102
+ instances : [
103
+ {
104
+ id : expect . stringContaining ( 'cynosdbmysql-ins-' ) ,
105
+ name : expect . stringContaining ( 'cynosdbmysql-ins-' ) ,
106
+ role : 'master' ,
107
+ type : 'rw' ,
108
+ status : 'running' ,
109
+ } ,
110
+ ] ,
102
111
} ) ;
103
112
104
113
( { clusterId } = res ) ;
@@ -128,6 +137,15 @@ describe('Cynosdb', () => {
128
137
ip : expect . any ( String ) ,
129
138
port : expect . any ( Number ) ,
130
139
} ,
140
+ instances : [
141
+ {
142
+ id : expect . stringContaining ( 'cynosdbmysql-ins-' ) ,
143
+ name : expect . stringContaining ( 'cynosdbmysql-ins-' ) ,
144
+ role : 'master' ,
145
+ type : 'rw' ,
146
+ status : 'running' ,
147
+ } ,
148
+ ] ,
131
149
} ) ;
132
150
} ) ;
133
151
@@ -149,6 +167,15 @@ describe('Cynosdb', () => {
149
167
ip : expect . any ( String ) ,
150
168
port : 3306 ,
151
169
} ,
170
+ instances : [
171
+ {
172
+ id : expect . stringContaining ( 'cynosdbmysql-ins-' ) ,
173
+ name : expect . stringContaining ( 'cynosdbmysql-ins-' ) ,
174
+ role : 'master' ,
175
+ type : 'rw' ,
176
+ status : 'running' ,
177
+ } ,
178
+ ] ,
152
179
} ) ;
153
180
inputs . clusterId = undefined ;
154
181
} ) ;
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ const { Capi } = require('@tencent-sdk/capi');
2
2
const {
3
3
createCluster,
4
4
getClusterDetail,
5
+ getClusterInstances,
5
6
isolateCluster,
6
7
generatePwd,
7
8
formatConnectOutput,
@@ -136,6 +137,15 @@ class Cynosdb {
136
137
await closePublicAccess ( this . capi , outputs . clusterId ) ;
137
138
}
138
139
140
+ const clusterInstances = await getClusterInstances ( this . capi , outputs . clusterId ) ;
141
+ outputs . instances = clusterInstances . map ( ( item ) => ( {
142
+ id : item . InstanceId ,
143
+ name : item . InstanceName ,
144
+ role : item . InstanceRole ,
145
+ type : item . InstanceType ,
146
+ status : item . Status ,
147
+ } ) ) ;
148
+
139
149
return outputs ;
140
150
}
141
151
You can’t perform that action at this time.
0 commit comments