Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,12 @@
}
]
},
"viewsWelcome": [
{
"view": "openshiftProjectExplorer",
"contents": "Cluster is not accessible or you are not logged in\n[Login](command:openshift.explorer.login)\n[Change Kubernetes context](command:openshift.explorer.switchContext)\n[Provision OpenShift Cluster](command:openshift.explorer.addCluster)"
}
],
"menus": {
"explorer/context": [
{
Expand Down
24 changes: 12 additions & 12 deletions src/odo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -490,12 +490,12 @@ export class OdoImpl implements Odo {
'"system:anonymous"',
];

private readonly serverDownMessages = [
'Unable to connect to OpenShift cluster, is it down?',
'no such host',
'no route to host',
'connection refused',
];
// private readonly serverDownMessages = [
Comment thread
dgolovin marked this conversation as resolved.
Outdated
// 'Unable to connect to OpenShift cluster, is it down?',
// 'no such host',
// 'no route to host',
// 'connection refused',
// ];

public readonly subject: Subject<OdoEvent> = new Subject<OdoEvent>();

Expand Down Expand Up @@ -539,12 +539,12 @@ export class OdoImpl implements Odo {
const result: cliInstance.CliExitData = await this.execute(
Command.printOdoVersionAndProjects(), process.cwd(), false
);
if (this.odoLoginMessages.some((element) => result.stderr ? result.stderr.includes(element) : false)) {
return[new OpenShiftLoginRequired()];
}
if (this.serverDownMessages.some((element) => result.stderr ? result.stderr.includes(element) : false)) {
return [new OpenShiftClusterDown()];
}
// if (this.odoLoginMessages.some((element) => result.stderr ? result.stderr.includes(element) : false)) {
// return[new OpenShiftLoginRequired()];
// }
// if (this.serverDownMessages.some((element) => result.stderr ? result.stderr.includes(element) : false)) {
// return [new OpenShiftClusterDown()];
// }
commands.executeCommand('setContext', 'isLoggedIn', true);
clusters = result.stdout.trim().split('\n').filter((value) => {
return value.includes('Server:');
Expand Down
20 changes: 0 additions & 20 deletions test/unit/odo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -614,26 +614,6 @@ suite('odo', () => {
assert.equal(cluster[0].getName(), clusterUrl);
});

test('show error message if cluster is not login', async () => {
sandbox.stub(odo.OdoImpl.prototype, 'execute').onFirstCall().resolves({
error: undefined,
stdout: '',
stderr: 'Please log in to the cluster'
});
const cluster: odo.OpenShiftObject[] = await odo.getInstance().getClusters();
assert.equal(cluster[0].getName(), 'Please log in to the cluster');
});

test('show message if cluster is down', async () => {
sandbox.stub(odo.OdoImpl.prototype, 'execute').onFirstCall().resolves({
error: undefined,
stdout: '',
stderr: 'Unable to connect to OpenShift cluster, is it down?'
});
const cluster: odo.OpenShiftObject[] = await odo.getInstance().getClusters();
assert.equal(cluster[0].getName(), 'Cannot connect to the OpenShift cluster');
});

test('extension uses oc version to get cluster url as a backup plan', async () => {
sandbox.stub(odo.OdoImpl.prototype, 'execute').onFirstCall().resolves({
error: undefined,
Expand Down