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

refactor: Add auth_config mock #528

Merged
merged 2 commits into from
Apr 11, 2023

Conversation

helayoty
Copy link
Member

This PR includes the following changes:

  1. To be able to write unit tests for the auth package, we need to mock the azidentity and autorest libraries.

    In order to achieve that, we introduce a new interface, ConfigInterface that will implement:

    • GetMSICredential
    • GetSPCredential
    • GetAuthorizer
  2. And to make the code more organized, we split the config away from Authentication into two separate files; auth_config and authentication.

  3. Update the deprecated io/ioutil and replace it with io.

Signed-off-by: Heba Elayoty <hebaelayoty@gmail.com>
Signed-off-by: Heba Elayoty <hebaelayoty@gmail.com>
@helayoty helayoty requested a review from Fei-Guo as a code owner April 11, 2023 19:53
@helayoty helayoty temporarily deployed to test April 11, 2023 19:53 — with GitHub Actions Inactive
@helayoty helayoty temporarily deployed to test April 11, 2023 19:54 — with GitHub Actions Inactive
@codecov-commenter
Copy link

Codecov Report

Merging #528 (93557f2) into master (7e523b0) will decrease coverage by 0.37%.
The diff coverage is 57.74%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##           master     #528      +/-   ##
==========================================
- Coverage   61.36%   60.99%   -0.37%     
==========================================
  Files          15       17       +2     
  Lines        2490     2505      +15     
==========================================
  Hits         1528     1528              
- Misses        850      865      +15     
  Partials      112      112              
Impacted Files Coverage Δ
pkg/auth/mock_auth_config.go 0.00% <0.00%> (ø)
pkg/auth/authentication.go 72.22% <72.22%> (ø)
pkg/auth/auth_config.go 61.53% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@Fei-Guo Fei-Guo merged commit 47ee054 into virtual-kubelet:master Apr 11, 2023
@helayoty helayoty deleted the auth-config-mock branch April 12, 2023 00:22
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