cloudnative-pg / cloudnative-pg/cnpg-i-hello-world

Issue: Missing Unit Test Coverage for Core Modules

Open
#187 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
5
Forks
12
PR merge metrics
No merged PRs in 30d

Description

## Missing Unit Tests for Core Plugin Logic

Hi team,

While exploring the codebase to understand the plugin's workflow better, I noticed that there aren’t any unit tests for some of the core modules like `config.go`, `validation.go`, `status.go`, `mutations.go`, and `lifecycle.go`. Given that this project is meant to be a reference for CNPG-I plugin development, I feel adding tests here would be really valuable.

### Why I think this is important:
- It’ll help ensure that core functionalities like validation, lifecycle hooks, and status updates work as expected.
- Tests will make it easier for future contributors (including new folks like me) to experiment and build on top of this safely.
- This will also improve CI reliability by catching bugs early.

### My proposal:
I'd like to start by writing unit tests for:
1. `internal/config/config.go` – testing configuration validation.
2. `internal/operator/validation.go` – testing cluster validation logic.

If that goes well, I can follow up with:
- `status.go` – making sure NoOp vs JSONStatus logic is covered.
- `mutations.go` – checking default mutation behaviors.
- `lifecycle.go` – covering pod metadata changes.

Would it be okay if I start working on this? I can open a PR for the first couple of test files and we can take it from there.

Thanks!

Contributor guide

Open the contributing guide

Research direction

Start by reading internal/config/config.go and internal/operator/validation.go to identify the configuration and cluster validation behavior that needs coverage. Add unit tests for those two modules first, then consider status.go, mutations.go, and lifecycle.go separately. Done means the proposed core logic has meaningful tests that pass in CI.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
testing-qa
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.