File tree Expand file tree Collapse file tree 4 files changed +7
-8
lines changed
Expand file tree Collapse file tree 4 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -206,7 +206,7 @@ export class Component extends OpenShiftItem {
206206 const project = application . getParent ( ) ;
207207 return Promise . resolve ( )
208208 . then ( ( ) => Component . odo . executeInTerminal ( `odo create ${ componentTypeName } :${ componentTypeVersion } ${ componentName } --git ${ repoURI } --app ${ application . getName ( ) } --project ${ project . getName ( ) } ` ) )
209- . then ( ( ) => new Promise ( ( res ) => setTimeout ( res , 5000 ) ) )
209+ . then ( ( ) => Component . wait ( ) )
210210 . then ( ( ) => Component . explorer . refresh ( application ) )
211211 . then ( ( ) => `Component '${ componentName } ' successfully created` ) ;
212212 }
Original file line number Diff line number Diff line change @@ -12,4 +12,5 @@ export abstract class OpenShiftItem {
1212
1313 static create ( context : OpenShiftObject ) : Promise < String > { return Promise . reject ( ) ; }
1414 static del ( context : OpenShiftObject ) : Promise < String > { return Promise . reject ( ) ; }
15+ static wait ( timeout : number = 2500 ) : Promise < void > { return new Promise ( ( res ) => setTimeout ( res , timeout ) ) ; }
1516}
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ suite('Openshift/Component', () => {
2727 sandbox . stub ( OdoImpl . prototype , 'getProjects' ) . resolves ( [ ] ) ;
2828 sandbox . stub ( OdoImpl . prototype , 'getApplications' ) . resolves ( [ ] ) ;
2929 sandbox . stub ( OdoImpl . prototype , 'getComponents' ) . resolves ( [ ] ) ;
30+ sandbox . stub ( Component , 'wait' ) . resolves ( ) ;
3031 } ) ;
3132
3233 teardown ( ( ) => {
Original file line number Diff line number Diff line change @@ -45,18 +45,15 @@ suite('Openshift/Service', () => {
4545 quickPickStub . onFirstCall ( ) . resolves ( templateName ) ;
4646 quickPickStub . onSecondCall ( ) . resolves ( templatePlan ) ;
4747 inputStub = sandbox . stub ( vscode . window , 'showInputBox' ) . resolves ( serviceItem . getName ( ) ) ;
48- progressStub = sandbox . stub ( Progress , 'execWithProgress ' ) . resolves ( ) ;
48+ progressStub = sandbox . stub ( Progress , 'execCmdWithProgress ' ) . resolves ( ) ;
4949 } ) ;
5050
5151 test ( 'works with correct inputs' , async ( ) => {
5252 const result = await Service . create ( appItem ) ;
53- const steps = [ {
54- command : `odo service create ${ templateName } --plan ${ templatePlan } ${ serviceItem . getName ( ) } --app ${ appItem . getName ( ) } --project ${ projectItem . getName ( ) } ` ,
55- increment : 100
56- } ] ;
57-
5853 expect ( result ) . equals ( `Service '${ serviceItem . getName ( ) } ' successfully created` ) ;
59- expect ( progressStub ) . calledOnceWith ( sinon . match . object , steps ) ;
54+ expect ( progressStub ) . calledOnceWith (
55+ `Creating new service '${ serviceItem . getName ( ) } '` ,
56+ `odo service create ${ templateName } --plan ${ templatePlan } ${ serviceItem . getName ( ) } --app ${ appItem . getName ( ) } --project ${ projectItem . getName ( ) } ` ) ;
6057 } ) ;
6158
6259 test ( 'returns null with no template selected' , async ( ) => {
You can’t perform that action at this time.
0 commit comments