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

Testcases Added #9116

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

Testcases Added #9116

wants to merge 6 commits into from

Conversation

my-code-AL
Copy link

Description

This PR adds a new tester directory and file at core/src/test/java/com/cloud/serializer/GsonHelperTest.java. Previously, the serializer directory did not exist. The new test file checks the base functionality of GSON conversion into JSON of a Java CloudStack object implementing the dataStoreTo interface to ensure it works properly with a CloudStack class.

Additionally, this PR includes a test for OVAProcessor.java that tests the OVA processing of large objects and adds a test for PasswordPolicyImpl.java at server/src/test/java/com/cloud/user/PasswordPolicyImplTest.java. The new test verifies that a password meets all test case points (such as length, minimum special characters, minimum uppercase characters, regex specifications) instead of just individual criteria.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • [] Bug fix (non-breaking change which fixes an issue)
  • [] Enhancement (improves an existing feature and functionality)
  • [X ] Cleanup (Code refactoring and cleanup, that may add test cases)
  • build/CI

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

The tests were designed to cover various edge cases and typical usage scenarios to ensure robustness. For GsonHelperTest.java, different CloudStack objects were serialized and deserialized to verify GSON conversion accuracy. For OVAProcessor.java, large file sizes were used to test the OVA processing logic. For PasswordPolicyImpl.java, various password inputs were tested to ensure they meet all specified criteria.

Copy link

boring-cyborg bot commented May 24, 2024

Congratulations on your first Pull Request and welcome to the Apache CloudStack community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
Here are some useful points:

Copy link

codecov bot commented May 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 15.28%. Comparing base (f1c3d2c) to head (93378f4).
Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##              main    #9116       +/-   ##
============================================
+ Coverage     4.25%   15.28%   +11.02%     
- Complexity       0    11537    +11537     
============================================
  Files          363     5424     +5061     
  Lines        29686   474334   +444648     
  Branches      5214    58626    +53412     
============================================
+ Hits          1264    72509    +71245     
- Misses       28279   393767   +365488     
- Partials       143     8058     +7915     
Flag Coverage Δ
uitests 4.25% <ø> (-0.01%) ⬇️
unittests 16.02% <ø> (?)

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

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

@DaanHoogland
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@vishesh92
Copy link
Member

@my-code-AL Build is failing with error:

Error:  /home/runner/work/cloudstack/cloudstack/core/src/test/java/com/cloud/storage/template/OVAProcessorTest.java:134: Line has trailing spaces. [RegexpSingleline]
Error:  /home/runner/work/cloudstack/cloudstack/core/src/test/java/com/cloud/serializer/GsonHelperTest.java:75: Line has trailing spaces. [RegexpSingleline]

@blueorangutan
Copy link

Packaging result [SF]: ✖️ el7 ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 9718

@my-code-AL
Copy link
Author

@DaanHoogland Howdy Daan, I was able to update the checkstyle ruleset for these test cases. Let me know if there is anything else I can do!

@DaanHoogland
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

clgtm

@DaanHoogland
Copy link
Contributor

actually this is just unit-tests, so no packaging needed to prove this, as GHA does already run those.
alright by you like this @weizhouapache ?

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 9778

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.

None yet

5 participants