Skip to content

Commit

Permalink
fix --wait issue for service creation
Browse files Browse the repository at this point in the history
  • Loading branch information
mohitsuman committed Dec 3, 2018
1 parent 1f74c05 commit be237fb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/openshift/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export class Component extends OpenShiftItem {
if (!serviceToLink) return null;

return Promise.resolve()
.then(() => Service.odo.execute(`odo link ${serviceToLink.getName()} --app ${app.getName()} --project ${project.getName()} --component ${context.getName()}`))
.then(() => Service.odo.execute(`odo link ${serviceToLink.getName()} --app ${app.getName()} --project ${project.getName()} --component ${context.getName()} --wait`))
.then(() => `service '${serviceToLink.getName()}' successfully linked with component '${context.getName()}'`)
.catch((err) => Promise.reject(`Failed to link service with error '${err}'`));
}
Expand Down
4 changes: 2 additions & 2 deletions src/openshift/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class Service extends OpenShiftItem {
if (serviceName) {
const project = application.getParent();
return Progress.execCmdWithProgress(`Creating new service '${serviceName}'`,
`odo service create ${serviceTemplateName} --plan ${serviceTemplatePlanName} ${serviceName.trim()} --app ${application.getName()} --project ${project.getName()} --wait`)
`odo service create ${serviceTemplateName} --plan ${serviceTemplatePlanName} ${serviceName.trim()} --app ${application.getName()} --project ${project.getName()}`)
.then(() => Service.explorer.refresh(application))
.then(() => `Service '${serviceName}' successfully created`)
.catch((err) => Promise.reject(`Failed to create service with error '${err}'`));
Expand All @@ -59,7 +59,7 @@ export class Service extends OpenShiftItem {
const answer = await vscode.window.showWarningMessage(`Are you sure you want to delete service '${service.getName()}'`, 'Yes', 'Cancel');
if (answer === 'Yes') {
return Promise.resolve()
.then(() => Service.odo.execute(`odo service delete ${service.getName()} -f --project ${project.getName()} --app ${application.getName()} --wait`))
.then(() => Service.odo.execute(`odo service delete ${service.getName()} -f --project ${project.getName()} --app ${application.getName()}`))
.then(() => Service.explorer.refresh(treeItem ? treeItem.getParent() : undefined))
.then(() => `Service '${service.getName()}' successfully deleted`)
.catch((err) => Promise.reject(`Failed to delete service with error '${err}'`));
Expand Down
6 changes: 3 additions & 3 deletions test/openshift/service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ suite('Openshift/Service', () => {
expect(result).equals(`Service '${serviceItem.getName()}' successfully created`);
expect(progressStub).calledOnceWith(
`Creating new service '${serviceItem.getName()}'`,
`odo service create ${templateName} --plan ${templatePlan} ${serviceItem.getName()} --app ${appItem.getName()} --project ${projectItem.getName()} --wait`);
`odo service create ${templateName} --plan ${templatePlan} ${serviceItem.getName()} --app ${appItem.getName()} --project ${projectItem.getName()}`);
});

test('returns null with no template selected', async () => {
Expand Down Expand Up @@ -105,14 +105,14 @@ suite('Openshift/Service', () => {
const result = await Service.del(serviceItem);

expect(result).equals(`Service '${serviceItem.getName()}' successfully deleted`);
expect(execStub).calledOnceWith(`odo service delete ${serviceItem.getName()} -f --project ${projectItem.getName()} --app ${appItem.getName()} --wait`);
expect(execStub).calledOnceWith(`odo service delete ${serviceItem.getName()} -f --project ${projectItem.getName()} --app ${appItem.getName()}`);
});

test('works without context item', async () => {
const result = await Service.del(null);

expect(result).equals(`Service '${serviceItem.getName()}' successfully deleted`);
expect(execStub).calledOnceWith(`odo service delete ${serviceItem.getName()} -f --project ${projectItem.getName()} --app ${appItem.getName()} --wait`);
expect(execStub).calledOnceWith(`odo service delete ${serviceItem.getName()} -f --project ${projectItem.getName()} --app ${appItem.getName()}`);
});

test('returns null with no application selected', async () => {
Expand Down

0 comments on commit be237fb

Please sign in to comment.