Skip to content

Fix: handle connection errors gracefully and add comprehensive tests#13

Merged
utkarsh232005 merged 1 commit into
KDM-cli:mainfrom
utkarsh232005:fix/issue-12-and-tests
May 14, 2026
Merged

Fix: handle connection errors gracefully and add comprehensive tests#13
utkarsh232005 merged 1 commit into
KDM-cli:mainfrom
utkarsh232005:fix/issue-12-and-tests

Conversation

@utkarsh232005
Copy link
Copy Markdown
Member

@utkarsh232005 utkarsh232005 commented May 14, 2026

Fixes #12. This PR introduces graceful error handling when Kubernetes or Docker APIs are unreachable, adds unit tests for all commands, sets up a CI workflow, and adds an interactive 'kdm config setup' command for notification services using @vr_patel/tui.

Copilot AI review requested due to automatic review settings May 14, 2026 07:28
@utkarsh232005 utkarsh232005 merged commit 032e6a5 into KDM-cli:main May 14, 2026
4 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses issue #12 where kdm show runners crashed on Kubernetes connection errors. It wraps the show commands in try/catch and uses Promise.allSettled so a failure in one backend (Docker or Kubernetes) no longer aborts the whole command. It also adds Vitest-based unit tests for several commands and a CI workflow to run them on PRs.

Changes:

  • Graceful error handling in showContainers, showPods, and showRunners (using Promise.allSettled), plus safer error-message extraction in the Docker/Kubernetes fetchers.
  • New Vitest unit tests for show, watch, logs, health, and config commands.
  • New GitHub Actions workflow that runs npm test on PRs against main/master using Node 20.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/commands/show.ts Exports show subcommands and adds try/catch + Promise.allSettled for graceful failure handling.
src/docker/containers.ts Uses safer instanceof Error check when formatting the error message.
src/kubernetes/pods.ts Same safer error-message extraction as Docker side.
src/tests/show.test.ts Tests that showRunners/showPods handle backend failures without crashing.
src/tests/watch.test.ts Tests that the watch command registers and clears the screen / renders dashboard.
src/tests/logs.test.ts Tests logs command registration and logger.info invocation.
src/tests/health.test.ts Tests health command registration and logger.info invocation.
src/tests/config.test.ts Tests config set/list/clear subcommands including integer parsing for alert_cooldown.
.github/workflows/test.yml Adds CI workflow to run npm test with Node 20 on PRs to main/master.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

KDM show runner is not wokring

2 participants