Skip to content

Conversation

jrafanie
Copy link
Member

@jrafanie jrafanie commented Jul 22, 2025

Bypass feature validation for dynamic tenant features

We expect a one to one feature assignment with existing product features.
This doesn't work with dynamic tenant features.

This dynamic tenant feature was only ever implemented for tenant quotas.

Related to:
#5123
#5129
#5142

Fixes: #9512

Add a test for Settings, Access Control, Tenant Add and Delete

This recreates the issue found in #9512

@jrafanie jrafanie requested a review from a team as a code owner July 22, 2025 20:13
@jrafanie jrafanie added the wip label Jul 22, 2025
@Fryguy Fryguy changed the title WIP - bypass feature validation for dynamic tenant features [WIP] bypass feature validation for dynamic tenant features Jul 22, 2025
@Fryguy
Copy link
Member

Fryguy commented Jul 23, 2025

As discussed

tactically, if we change the role_allows to use x_node it would eliminate the params code, and it should just work...long term, there's gotta be a better way that avoids override role_allows at all, and passing in the correct feature from the caller

role_allows shouldn't be dynamically be building features though - something else should be doing that - I'm not sure how the toolbar code is working though
what I think has to happen long term, is we shouldn't be using basic buttons, but should have custom subclasses of the button for tenant stuff

@jrafanie
Copy link
Member Author

Closing in favor of #9527

@jrafanie jrafanie closed this Jul 24, 2025
@jrafanie jrafanie reopened this Aug 13, 2025
@jrafanie jrafanie force-pushed the skip-product-feature-validation-for-tenant-dynamic-product-features branch from c8c8ee5 to c816791 Compare August 13, 2025 18:19
@jrafanie jrafanie added bug and removed wip labels Aug 13, 2025
@jrafanie jrafanie force-pushed the skip-product-feature-validation-for-tenant-dynamic-product-features branch from c816791 to 6484ca9 Compare August 13, 2025 18:23
@jrafanie jrafanie changed the title [WIP] bypass feature validation for dynamic tenant features Bypass feature validation for dynamic tenant features Aug 13, 2025
@jrafanie
Copy link
Member Author

cc @asirvadAbrahamVarghese I used some of your pre-canned functions for the cypress test - let me know if you have better options than what I used.

cy.toolbar(toolBarConfigMenu, 'Add child Tenant to this Tenant');
cy.get('input#name').type(initialTenantName);
cy.get('input#description').type(initialTenantDescription);
cy.contains('.bx--btn--primary', 'Add').click();
Copy link
Contributor

@asirvadAbrahamVarghese asirvadAbrahamVarghese Aug 14, 2025

Choose a reason for hiding this comment

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

if this is a form can you try using getFormFooterButtonByType
cy.getFormFooterButtonByType('Add', 'submit') should work (not sure about the html button type here)

]);

cy.toolbar(toolBarConfigMenu, 'Add child Tenant to this Tenant');
cy.get('input#name').type(initialTenantName);
Copy link
Contributor

@asirvadAbrahamVarghese asirvadAbrahamVarghese Aug 14, 2025

Choose a reason for hiding this comment

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

Here we can use getFormInputFieldById
cy.getFormInputFieldById('name').type(initialTenantName); should be good.


cy.toolbar(toolBarConfigMenu, 'Add child Tenant to this Tenant');
cy.get('input#name').type(initialTenantName);
cy.get('input#description').type(initialTenantDescription);
Copy link
Contributor

Choose a reason for hiding this comment

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

similar to above: cy.getFormInputFieldById('description').type(initialTenantDescription);

@asirvadAbrahamVarghese
Copy link
Contributor

I haven't come across many form elements yet, but using these commands consistently across tests will help us generalize the selectors in here 😃

// flash message assertions
flashMessageOperationAdded: 'added',
flashMessageOperationDeleted: 'delete',
flashTypeSuccess: 'success',
Copy link
Contributor

Choose a reason for hiding this comment

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

I wanted to use a constant for the flash message type to avoid repetition, but forgot to follow through: #9554

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll do that here and update collect_logs as well

@jrafanie jrafanie force-pushed the skip-product-feature-validation-for-tenant-dynamic-product-features branch from 6484ca9 to f601874 Compare August 14, 2025 21:21
@@ -195,7 +192,7 @@ function saveButtonValidation() {
.should('be.enabled')
.click();
// Validating confirmation flash message
cy.expect_flash(flashTypeSuccess, flashMessageSettingsSaved);
cy.expect_flash(flashClassMap.success, flashMessageSettingsSaved);
Copy link
Member Author

Choose a reason for hiding this comment

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

I changed this one too...

@jrafanie
Copy link
Member Author

@asirvadAbrahamVarghese please take a look at the test changes... I also reduced the repetitive constant definition and assignment.

@asirvadAbrahamVarghese
Copy link
Contributor

@jrafanie looks fine to me now, thanks!

// CRUD actions
const FLASH_MESSAGE_OPERATION_ADDED = 'added';
const FLASH_MESSAGE_OPERATION_DELETED = 'delete';
const DELETE_ITEM = 'Delete this item';
Copy link
Member Author

Choose a reason for hiding this comment

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

This list of constants can be updated/consolidated when we add more access control tests. It's hard to decide what should be constants vs. inline.

My thinking is:

  • If it's used in a selector and unique to the test, it probably should be left as an inline string to make the test more readable. If it's used often enough, it should should become a shared function.
  • Simple text we input for CRUD will likely be reused by other tests so constants make sense there
  • Shared navigation for the whole set of tests and not unique to the test could be constants...

I don't know, that's my thinking here.

@jrafanie
Copy link
Member Author

jrafanie commented Aug 18, 2025

@Fryguy can you review the ruby side here? This is the workaround for the per tenant feature thing.

We expect a one to one feature assignment with existing product features.
This doesn't work with dynamic tenant features.

This dynamic tenant feature was only ever implemented for tenant quotas.

Related to:
ManageIQ#5123
ManageIQ#5129
ManageIQ#5142

Fixes: ManageIQ#9512
* Drop repetive constant definition and assignment
* Generalize the names of constants
* Capitalize constants as per conventions
@jrafanie jrafanie force-pushed the skip-product-feature-validation-for-tenant-dynamic-product-features branch from f601874 to 6f11925 Compare August 19, 2025 23:54
@jrafanie
Copy link
Member Author

Rebase/Updated after dropping the edit collect logs changes that were also in #9546, which was merged cc @asirvadAbrahamVarghese

@Fryguy Fryguy merged commit 71881e1 into ManageIQ:master Aug 20, 2025
18 checks passed
@Fryguy
Copy link
Member

Fryguy commented Aug 21, 2025

Backported to spassky in commit 3118187.

commit 311818769ace2068244ff5b4f64d177e8c4a0909
Author: Jason Frey <[email protected]>
Date:   Wed Aug 20 15:32:48 2025 -0400

    Merge pull request #9523 from jrafanie/skip-product-feature-validation-for-tenant-dynamic-product-features
    
    Bypass feature validation for dynamic tenant features
    
    (cherry picked from commit 71881e11962ff4bb296b306b2be26857bbd326a6)

Fryguy added a commit that referenced this pull request Aug 21, 2025
…n-for-tenant-dynamic-product-features

Bypass feature validation for dynamic tenant features

(cherry picked from commit 71881e1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deleting a tenant raises an Server Error
3 participants