Skip to content

Commit fd7fdd4

Browse files
committed
Fix test errors
1 parent d890958 commit fd7fdd4

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

src/openshift/component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
}

src/openshift/openshiftItem.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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
}

test/openshift/component.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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(() => {

test/openshift/service.test.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff 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 () => {

0 commit comments

Comments
 (0)