-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
API to validate Quota activation rule #9605
base: main
Are you sure you want to change the base?
Conversation
@blueorangutan package |
@hsato03 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. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9605 +/- ##
============================================
+ Coverage 15.78% 15.81% +0.02%
- Complexity 12551 12597 +46
============================================
Files 5625 5628 +3
Lines 491958 492225 +267
Branches 63091 61373 -1718
============================================
+ Hits 77663 77847 +184
- Misses 405836 405916 +80
- Partials 8459 8462 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 10872 |
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, manually tested in a local environment.
Test descriptions
Firstly, I validated whether the quotaValidateActivationRule
API would correctly identify JavaScript syntax errors.
The API correctly recognized the syntax error, which is the expected behavior.
Next, I inserted a valid syntax, and no errors were returned in the API response.
Relating to the validations of the preset variables, I selected the Template
usage type and inserted the value.computingResources.cpuNumber
variable into the script. Since it is not compatible with the selected usage type, an error was returned.
Then, I changed the usage type to Running VM
and the script had been successfully validated, since the variable value.computingResources.cpuNumber
is compatible with the selected usage type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some minor suggestions, overall, LGTM.
...atabase/quota/src/main/java/org/apache/cloudstack/api/response/QuotaResponseBuilderImpl.java
Outdated
Show resolved
Hide resolved
...ta/src/main/java/org/apache/cloudstack/api/response/QuotaValidateActivationRuleResponse.java
Show resolved
Hide resolved
server/src/main/java/org/apache/cloudstack/jsinterpreter/JsInterpreterHelper.java
Outdated
Show resolved
Hide resolved
@blueorangutan package |
@hsato03 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. |
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 11224 |
@blueorangutan test |
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
[SF] Trillian test result (tid-11578)
|
@DaanHoogland the test error logs don't seem to be related to the PR. Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/nose/suite.py", line 210, in run
self.setUp()
File "/usr/local/lib/python3.6/site-packages/nose/suite.py", line 293, in setUp
self.setupContext(ancestor)
File "/usr/local/lib/python3.6/site-packages/nose/suite.py", line 316, in setupContext
try_run(context, names)
File "/usr/local/lib/python3.6/site-packages/nose/util.py", line 471, in try_run
return func()
File "/marvin/tests/smoke/test_usage.py", line 1025, in setUpClass
cls.iso.id
Exception: ISO download failed exception: Failed to download ISO: 2785331c-21e7-47d5-91d5-ffb46b2dbe32 Could you run the smoke tests again? |
@blueorangutan package |
@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. |
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 11280 |
@blueorangutan test |
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
[SF] Trillian test result (tid-11617)
|
Description
When entering an activation rule during the creation and editing of Quota tariffs, the defined rule is not validated. This way, errors are only identified while processing the tariff.
Because of this, the
quotaValidateActivationRule
API was created, which informs whether the activation rule is valid or not. Also, the activation rule field was added when creating and editing the tariff via UI.API parameters
Example
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?