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

Test refactoring #798

Merged
merged 2 commits into from
Dec 29, 2022
Merged

Test refactoring #798

merged 2 commits into from
Dec 29, 2022

Conversation

0xERR0R
Copy link
Owner

@0xERR0R 0xERR0R commented Dec 13, 2022

Some small improvements:

  • make tests more readable:

    • replace for example dns.Type(dns.TypeA) with A constant
    • add special assert functions to check TTL, Response, Return type
    • Squash multiple assertions on Response to one "Expect" call
    • remove "hidden" and "nested" assertions and variable definition in "beforeEach"
    • DNS response assertions can now be applied direct to model.Response, this make error check unnecessary (since gomega does it)
  • remove TTL check from ´BeDNSRecord´ and use dedicated HaveTTL which allows to use also "<=" comparison and make TTL assertion optional (without "hack" with 0 TTL before)

  • some small improvement on "Eventually" calls

After removing of sleep in a test, a race condition in cache is occurred. This was also fixed by a separate commit.

@0xERR0R 0xERR0R added the 🧰 technical debts Technical debts, refactoring label Dec 13, 2022
@0xERR0R 0xERR0R added this to the 0.21 milestone Dec 13, 2022
@0xERR0R 0xERR0R marked this pull request as draft December 13, 2022 14:33
@codecov
Copy link

codecov bot commented Dec 13, 2022

Codecov Report

Base: 93.32% // Head: 93.33% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (a7a6d44) compared to base (9abeaed).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff              @@
##           development     #798   +/-   ##
============================================
  Coverage        93.32%   93.33%           
============================================
  Files               42       42           
  Lines             4841     4845    +4     
============================================
+ Hits              4518     4522    +4     
  Misses             255      255           
  Partials            68       68           
Impacted Files Coverage Δ
resolver/blocking_resolver.go 98.14% <100.00%> (ø)
resolver/caching_resolver.go 97.88% <100.00%> (+0.04%) ⬆️
resolver/fqdn_only_resolver.go 100.00% <100.00%> (ø)
resolver/hosts_file_resolver.go 100.00% <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 at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@0xERR0R 0xERR0R marked this pull request as ready for review December 13, 2022 15:40
e2e/metrics_test.go Outdated Show resolved Hide resolved
@0xERR0R
Copy link
Owner Author

0xERR0R commented Dec 27, 2022

rebased on latest development branch

@0xERR0R 0xERR0R requested a review from kwitsch December 27, 2022 22:03
Copy link
Collaborator

@kwitsch kwitsch left a comment

Choose a reason for hiding this comment

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

I really like how SatisfyAll makes the unit tests way more readable.

dns.Type constants 👍
deferDeferCleanup 👍

@0xERR0R 0xERR0R merged commit 53a7d4f into development Dec 29, 2022
@delete-merged-branch delete-merged-branch bot deleted the refactor-tests branch December 29, 2022 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧰 technical debts Technical debts, refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants