external-dns icon indicating copy to clipboard operation
external-dns copied to clipboard

external-dns improve code coverage

Open ivankatliarchuk opened this issue 8 months ago • 13 comments
trafficstars

What would you like to be added:

Current code coverage is ~76%, it would be beneficial to bump coverage to 90% or higher, this will simplify refactoring of certain features.

To find out lines that currently not covered with unit tests, run this command

make cover-html

Why is this needed:

  • quality of the product

What you expected to happen:

  • given the size of the codebase, slice/split work into multiple pull requests
  • cover if/else where possible
  • cover error cases like if err !=nil as in majority of scenarios we only testing happy path
  • cover logs with method (optional as not everyone knows how to validate logs and there are some bugs currently in our framework) https://github.com/kubernetes-sigs/external-dns/blob/4b2fd495d944f9a67cdeb5260db95c5f2367d8bf/internal/testutils/log.go#L36
  • github action to fail the build if code coverage is not X% (implemented last)

What is out of scope:

  • Modifications of actual non-test logic (separate pull-request required for that)

Relevant PRs

  • https://github.com/kubernetes-sigs/external-dns/pull/5337
  • https://github.com/kubernetes-sigs/external-dns/commit/3c93bcb0768966fa97ce8b120495531eb7f6aa79
  • https://github.com/kubernetes-sigs/external-dns/pull/5248

ivankatliarchuk avatar Mar 06 '25 09:03 ivankatliarchuk

/help

ivankatliarchuk avatar Mar 06 '25 09:03 ivankatliarchuk

@ivankatliarchuk: This request has been marked as needing help from a contributor.

Guidelines

Please ensure that the issue body includes answers to the following questions:

  • Why are we solving this issue?
  • To address this issue, are there any code changes? If there are code changes, what needs to be done in the code and what places can the assignee treat as reference points?
  • Does this issue have zero to low barrier of entry?
  • How can the assignee reach out to you for help?

For more details on the requirements of such an issue, please see here and ensure that they are met.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-help command.

In response to this:

/help

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

k8s-ci-robot avatar Mar 06 '25 09:03 k8s-ci-robot

/good-first-issue

ivankatliarchuk avatar Mar 06 '25 09:03 ivankatliarchuk

@ivankatliarchuk: This request has been marked as suitable for new contributors.

Guidelines

Please ensure that the issue body includes answers to the following questions:

  • Why are we solving this issue?
  • To address this issue, are there any code changes? If there are code changes, what needs to be done in the code and what places can the assignee treat as reference points?
  • Does this issue have zero to low barrier of entry?
  • How can the assignee reach out to you for help?

For more details on the requirements of such an issue, please see here and ensure that they are met.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-good-first-issue command.

In response to this:

/good-first-issue

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

k8s-ci-robot avatar Mar 06 '25 09:03 k8s-ci-robot

/kind cleanup

ivankatliarchuk avatar Mar 06 '25 09:03 ivankatliarchuk

/assign

arshadd-b avatar Mar 06 '25 09:03 arshadd-b

/unassign

arshadd-b avatar Mar 10 '25 04:03 arshadd-b

/assign

mayurpatil44 avatar Mar 30 '25 11:03 mayurpatil44

Hi @hjoshi123 this issue seems like is already have assignee. But there are way too many areas not covered with unit-tests. Worth to have a look, maybe there are easy wins. We should target 90%+ coverage in each file, error cases important to us as well.

ivankatliarchuk avatar Apr 02 '25 20:04 ivankatliarchuk

Hi @ivankatliarchuk i want to contribute in this issue, i am exploring the codebase and trying to understand the testing implementation.

upsaurav12 avatar Apr 25 '25 12:04 upsaurav12

/open

ivankatliarchuk avatar May 19 '25 07:05 ivankatliarchuk

/reopen /lifecycle frozen

ivankatliarchuk avatar May 19 '25 07:05 ivankatliarchuk

@ivankatliarchuk: Reopened this issue.

In response to this:

/reopen /lifecycle frozen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

k8s-ci-robot avatar May 19 '25 07:05 k8s-ci-robot

@ivankatliarchuk @mloiseleur is it issue still open, i am sorry i wasn't active here

upsaurav12 avatar Oct 28 '25 14:10 upsaurav12