kubernetes / kubernetes/node-problem-detector

NPD needs an integration test tier that contributors can run locally

Open
#1,331 0 comments 0 reactions 0 assignees View on GitHub
kind/cleanup sig/node
Dominant language
Go
Stars
3.5k
Forks
702
Avg merge
1d 6h
Merged PRs (30d)
11

Description

We should add a test tier between unit tests and the GCE suite that can be run locally.

---

NPD currently has two test tiers:
1. Unit tests
2. GCE e2e tests (Prow)

The e2e suite today only asserts against a local metrics endpoint on a GCE VM; yet, we cannot easily run the same functionality locally. This is because `make e2e-test` requires a GCP project, a zone, an image, and SSH keys. Not all important behaviors are unit-testable, and having the ability to run e2e tests locally will help author better improvements to NPD.

We should have two additional forms of testing to enable local e2e testing:

| Form | What it covers | Sketch |
|---------------|------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|
| Process-level | log parsing through condition/event | run NPD against fixed log files and assert emitted events against a local fake apiserver ( via --apiserver-override) |
| KIND | DaemonSet lifecycle, NodeCondition transitions | run NPD as a DaemonSet in a KIND cluster and inject faults, assert conditions and cleanup on shutdown |

This pattern is the standard in other Kubernetes repositories. Kubernetes has an integration [test tier](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-testing/integration-tests.md) and only merges PRs when unit, integration, and e2e tests all pass (https://github.com/kubernetes/community/blob/master/contributors/devel/sig-testing/testing.md). Furthermore, cert-manager and cilium run KIND-based e2e locally as well.

Together with #1328, this allows extensive coverage of NPD behavior before reaching a VM.

/sig node
/kind cleanup

Contributor guide

Open the contributing guide

Research direction

Start with the existing `make e2e-test` entry point and trace its GCP, image, zone, and SSH-key requirements. Read how `--apiserver-override` is handled, then plan process-level tests using fixed log files and a fake apiserver, followed by KIND coverage for DaemonSet lifecycle and NodeCondition transitions. Done means both tiers run locally and assert the described events, conditions, and cleanup.

Written by the indexing model from the issue text.

Assessment

Tech stack
gcp, go, kubernetes
Domain
devops, testing-qa
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.