Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use FakeClient as backend for InformersService in unit tests #466

Conversation

MatousJobanek
Copy link
Contributor

First PR to migrate unit tests to use FakeClient instead of the mocks. I was able to isolate the changes for the InformerService only.

  • Unit tests now rely on the FakeClient as the back-end of the InformerService in all unit tests where it was used.
  • I removed the "fake informer" as well as other extra mocks.
  • I tried to minimize the changes, so I adjusted some formatting here and there accordingly

The main goal of this PR is to start using the FakeClient in unit tests, its purpose is not to improve the unit tests, or increase the coverage. This can (and should) be done later.

KUBESAW-193

Copy link

codecov bot commented Sep 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.14%. Comparing base (e15d7cc) to head (0194c4c).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #466      +/-   ##
==========================================
- Coverage   81.17%   81.14%   -0.04%     
==========================================
  Files          42       42              
  Lines        2630     2630              
==========================================
- Hits         2135     2134       -1     
- Misses        407      408       +1     
  Partials       88       88              
Flag Coverage Δ
unittests 81.14% <ø> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@alexeykazakov alexeykazakov left a comment

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@mfrancisc mfrancisc left a comment

Choose a reason for hiding this comment

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

Nice job, the code looks simpler 👍

I have left some very minor comments , only aesthetic stuff so feel free to ignore those.

pkg/proxy/handlers/spacelister_get_test.go Outdated Show resolved Hide resolved
pkg/proxy/handlers/spacelister_get_test.go Show resolved Hide resolved
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
27.4% Duplication on New Code (required ≤ 20%)

See analysis details on SonarCloud

Copy link

openshift-ci bot commented Sep 25, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alexeykazakov, MatousJobanek, mfrancisc

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

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [MatousJobanek,alexeykazakov,mfrancisc]

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

@MatousJobanek MatousJobanek merged commit c828088 into codeready-toolchain:master Sep 25, 2024
9 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants