lifecycle-toolkit icon indicating copy to clipboard operation
lifecycle-toolkit copied to clipboard

test: added catch statement in lifecycle-operator integration tests

Open UtkarshUmre opened this issue 1 year ago • 10 comments

Description

This issue is about adding catch statements to integration tests for improved error handling.

Fixes #2698

Checklist

  • [x] My PR fulfills the Definition of Done of the corresponding issue and not more (or parts if the issue is separated into multiple PRs)
  • [x] I used descriptive commit messages to help reviewers understand my thought process
  • [x] I signed off all my commits according to the Developer Certificate of Origin (DCO) see Contribution Guide
  • [x] My PR title is formatted according to the semantic PR conventions described in the Contribution Guide
  • [x] My code follows the style guidelines of this project (golangci-lint passes, YAMLLint passes)
  • [ ] I regenerated the auto-generated docs for Helm and the CRD documentation (if applicable)
  • [x] I have performed a self-review of my code
  • [ ] I have made corresponding changes to the documentation (if needed)
  • [x] My changes result in all-green PR checks (first-time contributors need to ask a maintainer to approve their test runs)
  • [x] New and existing unit and integration tests pass locally with my changes

Summary

In this pull request, I've implemented catch statements within the integration test. I've conducted thorough local testing to confirm their effectiveness in resolving the issue.

UtkarshUmre avatar Mar 11 '24 13:03 UtkarshUmre

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 87.00%. Comparing base (e048679) to head (7ca2e36).

:exclamation: Current head 7ca2e36 differs from pull request most recent head c1944b1. Consider uploading reports for the commit c1944b1 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3233      +/-   ##
==========================================
+ Coverage   85.36%   87.00%   +1.63%     
==========================================
  Files         167      162       -5     
  Lines        7412     8647    +1235     
==========================================
+ Hits         6327     7523    +1196     
- Misses        798      832      +34     
- Partials      287      292       +5     

see 91 files with indirect coverage changes

Flag Coverage Δ
certificate-operator 69.23% <ø> (ø)
component-tests 57.48% <ø> (-1.29%) :arrow_down:
lifecycle-operator 86.75% <ø> (+3.28%) :arrow_up:
metrics-operator 88.32% <ø> (ø)
scheduler 34.74% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

codecov[bot] avatar Mar 13 '24 06:03 codecov[bot]

Hi @UtkarshUmre , thanks for your PR. Did you check if the resources you are catching the the tests are valid things to check if the test fails? All catch blocks are the same and in some cases (for example api conversions) it does not make sense to describe app pod (because it does not exist) and as well keptn resources.

Please if possible go through each test and re-evaluate if it's needed.

Thank you!

odubajDT avatar Mar 13 '24 13:03 odubajDT

Hey @odubajDT I've re-evaluated the catch statements & addressed the issues with api conversions. i've made the necessary corrections, Could you please review it

UtkarshUmre avatar Mar 15 '24 20:03 UtkarshUmre

Hey @odubajDT I've re-evaluated the catch statements & addressed the issues with api conversions. i've made the necessary corrections, Could you please review it

Hi @UtkarshUmre , thank you for the adaptations. From what I see there are still a lot of information in the catch statement that are not needed.

My tip would be: Try to go through the tests and look at the install and assert files -> from the content (what is applied to the cluster and what is checked/asserted) you should be able to see what resources make sense to be retrieved in case the test fails

odubajDT avatar Mar 18 '24 06:03 odubajDT

Hi @UtkarshUmre any updates on this?

odubajDT avatar Mar 26 '24 14:03 odubajDT

Hey @odubajDT I'm tied up with some work at the moment, but I'll revisit the PR issues in a couple of days

UtkarshUmre avatar Mar 27 '24 22:03 UtkarshUmre

@UtkarshUmre any updates on this please?

odubajDT avatar Apr 22 '24 05:04 odubajDT

@odubajDT Half of the file's done, but the rest needs another look. I'll update the PR soon.

UtkarshUmre avatar Apr 24 '24 14:04 UtkarshUmre

Closing due to inactivity

odubajDT avatar Aug 05 '24 09:08 odubajDT