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

chore: add tests for utility functions for upsert env & truncate strings #161

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

zhaque44
Copy link

@zhaque44 zhaque44 commented Dec 17, 2024

This PR adds unit tests for the utils pkg functions:

TruncateString and UpsertEnvironmentStatus

  • The TestTruncateString function validates different truncation scenarios, including handling empty, short, and truncated strings, as well as an invalid negative length.
  • The TestUpsertEnvironmentStatus function tests the upsert logic for appending new elements, handling empty slices, and managing edge cases with a single element.

@zachaller
Copy link
Contributor

Will need to fix the lint issues, and then also add a new Make target that runs go test but excludes the TestControllers function which could actually probably be renamed to TestControllersGinkgo. Then we would probably need to add the new Make target to the github ci action.

@zhaque44 zhaque44 changed the title chore: add tests for utility functions for upsert env & tuncate strings chore: add tests for utility functions for upsert env & truncate strings Dec 17, 2024
@zhaque44 zhaque44 force-pushed the zhaque44-utils-test branch from 33b1432 to 8c3bde5 Compare December 17, 2024 22:09
@zhaque44
Copy link
Author

zhaque44 commented Dec 17, 2024

and then also add a new Make target that runs go test but excludes the TestControllers function which could actually probably be renamed to TestControllersGinkgo. Then we would probably need to add the new Make target to the github ci action.

@zachaller I dont know my way around this codebase well, can you show me an example of that, I know gingko does that BDD style of tests

@zhaque44 zhaque44 force-pushed the zhaque44-utils-test branch from 8c3bde5 to 2b36d8b Compare December 19, 2024 23:17
@zhaque44
Copy link
Author

@zachaller ive updated the func name & created the make target, before adding it to CI, I want to decide on what to name the make target, do you have any suggestions?

@zachaller
Copy link
Contributor

go-unit-test for the make target I think makes sense

@zhaque44
Copy link
Author

@zachaller its ready for review

@codecov-commenter
Copy link

codecov-commenter commented Dec 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 37.45%. Comparing base (a38bb8c) to head (f771974).

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #161       +/-   ##
===========================================
- Coverage   55.10%   37.45%   -17.66%     
===========================================
  Files          10       17        +7     
  Lines        1263     1917      +654     
===========================================
+ Hits          696      718       +22     
- Misses        479     1111      +632     
  Partials       88       88               

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

@zachaller
Copy link
Contributor

The coverage is still broken need to merge reports not sure how because ginkgo doesn't seem to support the new go binary format

@crenshaw-dev
Copy link
Contributor

I wonder if you could do two uploads under different codecov tags, or whatever they call them.

@zachaller
Copy link
Contributor

@zhaque44 zhaque44 force-pushed the zhaque44-utils-test branch from f771974 to d8efd5c Compare January 6, 2025 15:09
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.

4 participants