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

Add load_from_pem_data test #986

Merged
merged 4 commits into from
Apr 8, 2024

Conversation

thom-at-redhat
Copy link
Contributor

No description provided.

Copy link

codecov bot commented Apr 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 40.12%. Comparing base (137eb42) to head (7d26e57).

@@            Coverage Diff             @@
##            devel     #986      +/-   ##
==========================================
+ Coverage   39.89%   40.12%   +0.22%     
==========================================
  Files          42       42              
  Lines        6617     6617              
==========================================
+ Hits         2640     2655      +15     
+ Misses       3773     3754      -19     
- Partials      204      208       +4     

see 2 files with indirect coverage changes

}

func setupGoodRSAPrivateKeyPEMData() []byte {
return []byte(`-----BEGIN RSA PRIVATE KEY-----

Check failure

Code scanning / SonarCloud

Cryptographic private keys should not be disclosed

<!--SONAR_ISSUE_KEY:AY6uDvWTGIw3vZSjhwOY-->Make sure this private key gets revoked, changed, and removed from the code. <p>See more on <a href="https://sonarcloud.io/project/issues?id=ansible_receptor&issues=AY6uDvWTGIw3vZSjhwOY&open=AY6uDvWTGIw3vZSjhwOY&pullRequest=986">SonarCloud</a></p>
defer ctrl.Finish()

o := mock_certificates.NewMockOser(ctrl)
switch tt.args.filename {
Copy link
Contributor

Choose a reason for hiding this comment

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

This whole switch case can be swaped for a function pointer in the test case list, something like this: https://github.com/ansible/receptor/blob/devel/pkg/workceptor/workceptor_test.go#L140


o := mock_certificates.NewMockOser(ctrl)
switch tt.args.filename {
case failedToDecodeTestFilename:
Copy link
Contributor

Choose a reason for hiding this comment

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

same as previous comment 😄

I think keeping the expected calls with the test case definition in the list is more readable

Copy link

sonarcloud bot commented Apr 8, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
1 Accepted issue

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link
Contributor

@AaronH88 AaronH88 left a comment

Choose a reason for hiding this comment

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

lgtm

@AaronH88 AaronH88 merged commit 245080d into ansible:devel Apr 8, 2024
16 checks passed
@thom-at-redhat thom-at-redhat deleted the add_load_from_pemfile_test branch April 8, 2024 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants