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 unit test for core/crypto and a little change in the empty []byte return value. #1014

Merged
merged 1 commit into from
Jun 28, 2024

Conversation

yigithankarabulut
Copy link
Contributor

Added unit testing to core/crypto/decrypt_test.go

Description

Test coverage increased from %11.8 to %85.5 in core/crypto.
Updated the DecryptBytesAge() function to return nil instead of []bytes{} if it returns an error.

Changes

List the major changes you have made in bullet points:

Add Test for core/crypto/decrypt_test.go #891

Test Policy Compliance

  • I have added or updated unit tests for my changes.
  • I have included integration tests where applicable.
  • All new and existing tests pass successfully.

Code Quality

  • I have followed the coding standards for this project.
  • I have performed a self-review of my code.
  • My code is well-commented, particularly in areas that may be difficult
    to understand.

Documentation

  • I have made corresponding changes to the documentation (if applicable).
  • I have updated any relevant READMEs or wiki pages.

Additional Comments

Include any additional comments or context about the PR here.

Checklist

Before you submit this PR, please make sure:

  • You have read the contributing guidelines and
    especially the test policy.
  • You have thoroughly tested your changes.
  • You have followed all the contributing guidelines for this project.
  • You understand and agree that your contributions will be publicly available
    under the project's license.

By submitting this pull request, you confirm that my contribution is made under
the terms of the project's license and that you have the authority to grant
these rights.


Thank you for your contribution to VMware Secrets Manager
🐢⚡️!

DecryptBytesAge function returns an error, it returns
nil instead of []byte{}.

Signed-off-by: Yiğithan Karabulut <yigithannkarabulutt@gmail.com>
@@ -78,14 +78,14 @@ func DecryptBytesAge(data []byte) ([]byte, error) {

identity, err := age.ParseX25519Identity(privateKey)
if err != nil {
return []byte{}, errors.Join(
return nil, errors.Join(
Copy link
Contributor

Choose a reason for hiding this comment

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

+1

@v0lkan
Copy link
Contributor

v0lkan commented Jun 28, 2024

Looking good.

Thanks for your contributions @yigithankarabulut .

We badly need to increase test coverage, and I do understand writing test is not the funniest thing to do.

So we truly appreciate your efforts 🙏 .

--

Landing this one.

I’ll run all unit and integration tests on the main branch on the build server after this.

@v0lkan v0lkan merged commit b4fe182 into vmware-tanzu:main Jun 28, 2024
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