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 strict flag for assert #329

Merged
merged 5 commits into from
May 20, 2024
Merged

add strict flag for assert #329

merged 5 commits into from
May 20, 2024

Conversation

susarlanikhilesh
Copy link
Contributor

Addresses Issue

@dfarr
Copy link
Member

dfarr commented May 16, 2024

Thank you so much @susarlanikhilesh 🎉 🎉

The tests are failing because some of our tests expect a panic to occur, and if the flag is not set (eg: the code is run via a test rather than cli) I believe viper is returning the default boolean value of false. Is there a way to check if the flag is not set and, if not, set strict to true instead?

@susarlanikhilesh
Copy link
Contributor Author

Yes the strict flag is false, I did set when panic is true in the test cases

@dfarr
Copy link
Member

dfarr commented May 16, 2024

I would prefer for strict=true in cases where not explicitly set. Our philosophy here is to panic by default when an unexpected event occurs, this way we can protect ourselves from being in an invalid state.

viper.GetBool("strict") // if not set needs to be defaulted to true

An easier way to do it might be to invert the name of the flag to something like ignore-asserts that we can default to false which makes things a little easier to implement.

Copy link

codecov bot commented May 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.35%. Comparing base (9f31bbe) to head (097d546).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #329   +/-   ##
=======================================
  Coverage   55.34%   55.35%           
=======================================
  Files         113      113           
  Lines        9885     9886    +1     
=======================================
+ Hits         5471     5472    +1     
  Misses       4052     4052           
  Partials      362      362           

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

internal/util/util.go Outdated Show resolved Hide resolved
internal/util/util.go Outdated Show resolved Hide resolved
@dfarr dfarr merged commit d5a4a3d into resonatehq:main May 20, 2024
5 checks passed
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