Skip to content

fix(feature_flags): make test conditions deterministic #2059

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

Merged
merged 1 commit into from
Mar 28, 2023

Conversation

ajwad-shaikh
Copy link
Contributor

Issue number: #2058

Summary

Feature Flags match type test cases must have the non-expected value as default and the condition when_match must be equal to expected_value

For the list of test cases below, the expected_value is assigned as the default value which is returned when the condition does not match. The test only passes because both the expected and non-expected values are the same - True meaning that the test cannot fail ever.

  • test_flags_not_equal_match
  • test_flags_less_than_match
  • test_flags_less_than_or_equal_match_1
  • test_flags_less_than_or_equal_match_2
  • test_flags_greater_than_match
  • test_flags_greater_than_or_equal_match_1
  • test_flags_greater_than_or_equal_match_2

Changes

Please provide a summary of what's being changed

For match cases - expected_value, is assigned to the when_match of condition rather than default and default must return False

Changed a similar flaw in the test case mentioned in documentation

User experience

Please share what the user experience looks like before and after this change

Checklist

If your change doesn't seem to apply, please leave them unchecked.

Is this a breaking change?

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@ajwad-shaikh ajwad-shaikh requested a review from a team as a code owner March 28, 2023 10:06
@ajwad-shaikh ajwad-shaikh requested review from leandrodamascena and removed request for a team March 28, 2023 10:06
@boring-cyborg boring-cyborg bot added documentation Improvements or additions to documentation tests labels Mar 28, 2023
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 28, 2023
@boring-cyborg
Copy link

boring-cyborg bot commented Mar 28, 2023

Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need.
In the meantime, check out the #python channel on our AWS Lambda Powertools Discord: Invite link

@heitorlessa heitorlessa changed the title fix(feature_flags): fix match fix(feature_flags): make test conditions deterministic Mar 28, 2023
@github-actions github-actions bot added the bug Something isn't working label Mar 28, 2023
@heitorlessa heitorlessa linked an issue Mar 28, 2023 that may be closed by this pull request
@codecov-commenter
Copy link

codecov-commenter commented Mar 28, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.01 ⚠️

Comparison is base (de69eca) 97.45% compared to head (aa0f950) 97.45%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2059      +/-   ##
===========================================
- Coverage    97.45%   97.45%   -0.01%     
===========================================
  Files          146      146              
  Lines         6750     6748       -2     
  Branches       478      477       -1     
===========================================
- Hits          6578     6576       -2     
  Misses         136      136              
  Partials        36       36              
Impacted Files Coverage Δ
...owertools/utilities/feature_flags/feature_flags.py 100.00% <ø> (ø)
...ambda_powertools/utilities/feature_flags/schema.py 97.19% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@heitorlessa heitorlessa merged commit eb273d1 into aws-powertools:develop Mar 28, 2023
@boring-cyborg
Copy link

boring-cyborg bot commented Mar 28, 2023

Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation size/M Denotes a PR that changes 30-99 lines, ignoring generated files. tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Feature Flags - Faulty Test Cases
3 participants