Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

EVEREST-312 Repeated deletion fix #133

Merged
merged 4 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 9 additions & 0 deletions cli-tests/tests/flow/all-operators.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ test.describe('Everest CLI install operators', async () => {
await verifyClusterResources();
await apiVerifyClusterExists(request, clusterName);
await cliDeleteCluster(cli, request, clusterName);

await test.step('try to delete cluster again', async () => {
const out = await cli.everestExecSilent('delete cluster');

await out.exitCodeEquals(1);
await out.outErrContainsNormalizedMany([
'no Kubernetes clusters found',
]);
});
await verifyClusterResources();
});
});
6 changes: 6 additions & 0 deletions pkg/delete/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@ func (c *Cluster) askForKubernetesCluster(ctx context.Context) error {
return err
}

if len(clusters) == 0 {
l := c.l.WithOptions(zap.AddStacktrace(zap.DPanicLevel))
l.Error("no Kubernetes clusters found")
return common.ErrExitWithError
}

opts := make([]string, 0, len(clusters)+1)
for _, i := range clusters {
opts = append(opts, i.Name)
Expand Down
Loading