Skip to content

test: cover pkg/events/fake package#6096

Merged
k8s-ci-robot merged 2 commits intokubernetes-sigs:masterfrom
hritz220:test/improve-code-coverage
Jan 11, 2026
Merged

test: cover pkg/events/fake package#6096
k8s-ci-robot merged 2 commits intokubernetes-sigs:masterfrom
hritz220:test/improve-code-coverage

Conversation

@hritz220
Copy link
Copy Markdown
Contributor

What does it do?

Adds comprehensive test coverage for the pkg/events/fake package, improving coverage from 0% to 100%.

Motivation

Part of issue #5150 - improving code coverage across the codebase. This package had 0% coverage and is a good starting point.

Tests Added

  • TestNewFakeEventEmitter - Tests initialization
  • TestEventEmitter_Add_SingleEvent - Tests Add() with single event
  • TestEventEmitter_Add_MultipleEvents - Tests Add() with multiple events
  • TestEventEmitter_Add_WithDifferentEventTypes - Tests all event action/reason combinations
  • TestEventEmitter_Add_VerifyMockCalled - Tests mock verification with specific event
  • TestEventEmitter_Add_VerifyMockCalledWithAnyEvent - Tests mock with AnyEvent matcher
  • TestEventEmitter_Add_EmptyEventsPanics - Documents edge case behavior

Coverage

  • Before: 0.0% coverage
  • After: 100.0% coverage

More

  • Yes, this PR title follows Conventional Commits
  • Yes, I added unit tests
  • N/A - No end user documentation changes needed

Related to #5150

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented Jan 10, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Hi @hritz220. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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 k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 10, 2026
@hritz220 hritz220 force-pushed the test/improve-code-coverage branch from 5a024db to 1fd8465 Compare January 10, 2026 18:22
Add comprehensive test coverage for the fake EventEmitter implementation.
Tests cover:
- NewFakeEventEmitter() initialization
- Add() method with single and multiple events
- Different event types (Create, Update, Delete, Failed)
- Mock verification with specific events and any event type
- Edge case: empty events (panics as documented)

Improves code coverage from 0% to 100% for pkg/events/fake package.

Related to issue kubernetes-sigs#5150
@hritz220 hritz220 force-pushed the test/improve-code-coverage branch from 1fd8465 to 3e28b6f Compare January 10, 2026 18:24
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jan 10, 2026
@mloiseleur mloiseleur changed the title test: add tests for pkg/events/fake package test: cover pkg/events/fake package Jan 10, 2026
@mloiseleur
Copy link
Copy Markdown
Collaborator

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 10, 2026
@coveralls
Copy link
Copy Markdown

coveralls commented Jan 10, 2026

Pull Request Test Coverage Report for Build 20888408021

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 357 unchanged lines in 16 files lost coverage.
  • Overall coverage increased (+0.07%) to 78.968%

Files with Coverage Reduction New Missed Lines %
utils.go 1 96.0%
v1alpha1/groupversion_info.go 3 0.0%
node.go 6 90.48%
pod.go 6 95.54%
ingress.go 6 88.72%
openshift_route.go 7 84.78%
contour_httpproxy.go 7 84.14%
istio_gateway.go 8 88.07%
skipper_routegroup.go 9 38.84%
endpoint.go 17 91.01%
Totals Coverage Status
Change from base Build 20810601084: 0.07%
Covered Lines: 15957
Relevant Lines: 20207

💛 - Coveralls

@ivankatliarchuk
Copy link
Copy Markdown
Member

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jan 10, 2026
@ivankatliarchuk
Copy link
Copy Markdown
Member

/lgtm cancel

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 10, 2026
@@ -0,0 +1,128 @@
/*
Copyright 2025 The Kubernetes Authors.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
Copyright 2025 The Kubernetes Authors.
Copyright 2026 The Kubernetes Authors.

@k8s-ci-robot k8s-ci-robot removed the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 10, 2026
@ivankatliarchuk
Copy link
Copy Markdown
Member

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 11, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ivankatliarchuk

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 11, 2026
@k8s-ci-robot k8s-ci-robot merged commit bb67452 into kubernetes-sigs:master Jan 11, 2026
18 checks passed
ivankatliarchuk added a commit to gofogo/k8s-sigs-external-dns-fork that referenced this pull request Jan 16, 2026
* master: (25 commits)
  feat(event): standardize event messages and add resource kind lookup for events (kubernetes-sigs#6101)
  refactor(informers): unify cache sync functions using generics (kubernetes-sigs#6102)
  fix(fqdn): support kind and api version (kubernetes-sigs#6097)
  test(fqdn): cover sources without any fqdn tests (kubernetes-sigs#6094)
  chore(tools): CRD generation script moved and add validation workflow (kubernetes-sigs#6079)
  fix(metrics): add CNAME to known record types (kubernetes-sigs#6115)
  chore(cloudflare): migrate customhostname to v5 (kubernetes-sigs#5891)
  test(provider/exoscale): improved the test coverage for exoscale provider from 62.8% to 80.4%  (kubernetes-sigs#6112)
  feat(source): gateway api hostname source annotation (kubernetes-sigs#5959)
  test: cover pkg/events/fake package (kubernetes-sigs#6096)
  refactor(controller): controller no longer responsible for SingletonClientGenerator creation (kubernetes-sigs#6077)
  refactor(source): standardize FQDN template accross sources (kubernetes-sigs#6093)
  feat(coredns): rename ownerId and ownedBy to owner (kubernetes-sigs#6032)
  docs: fix typo in README (The are → There are) (kubernetes-sigs#6095)
  refactor(aws): abstract provider-specific boolean parsing (kubernetes-sigs#6078)
  refactor(api): deduplicate addKnownTypes (kubernetes-sigs#6087)
  fix(api): rollback changes for omitempty (kubernetes-sigs#6086)
  chore(deps): bump renovatebot/github-action (kubernetes-sigs#6080)
  fix(aws): enable AWS API validation for routing policies without setIdentifier (kubernetes-sigs#6082)
  chore(aws): document and test behavior for ALB and NLB (kubernetes-sigs#6063)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants