Skip to content

Commit

Permalink
Merge branch 'main' into test/RHOAIENG-14370
Browse files Browse the repository at this point in the history
  • Loading branch information
FedeAlonso authored Nov 26, 2024
2 parents 634af62 + 6e4cf62 commit bb3260f
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,26 @@ class NIMDeployModal extends Modal {
shouldDisplayError(msg: string): void {
this.find().should('contain.text', msg);
}

findAuthenticationSection() {
return this.find().findByTestId('auth-section');
}

findModelRouteCheckbox() {
return this.find().findByTestId('alt-form-checkbox-route');
}

findAuthenticationCheckbox() {
return this.find().findByTestId('alt-form-checkbox-auth');
}

findExternalRouteError() {
return this.find().findByTestId('external-route-no-token-alert');
}

findServiceAccountNameInput() {
return this.find().findByTestId('service-account-form-name');
}
}

export const nimDeployModal = new NIMDeployModal();
Original file line number Diff line number Diff line change
Expand Up @@ -346,4 +346,47 @@ describe('NIM Model Serving', () => {
cy.wait('@deleteRuntime');
});
});

describe('Checking AuthServingRuntimeSection - Model Route and Token Authentication', () => {
it('should show or hide the alert based on route and token settings', () => {
initInterceptsToEnableNim({ hasAllModels: false });
projectDetailsOverviewTab.visit('test-project');
cy.findByTestId('model-serving-platform-button').click();
nimDeployModal.shouldBeOpen();

// should display and interact with the "Model route" checkbox
nimDeployModal.findModelRouteCheckbox().should('be.visible').should('not.be.checked');
nimDeployModal.findModelRouteCheckbox().check();
nimDeployModal.findModelRouteCheckbox().should('be.checked');
nimDeployModal.findModelRouteCheckbox().uncheck();
nimDeployModal.findModelRouteCheckbox().should('not.be.checked');

// should enable the "Authentication" checkbox when "Model route" is checked
nimDeployModal.findModelRouteCheckbox().check();
nimDeployModal.findAuthenticationCheckbox().should('be.checked');

// should display a warning alert if "Model route" is checked but "Authentication" is unchecked
nimDeployModal.findModelRouteCheckbox().check();
nimDeployModal.findAuthenticationCheckbox().uncheck();
nimDeployModal.findExternalRouteError().should('exist');

// Check external route
nimDeployModal.findModelRouteCheckbox().check();
nimDeployModal.findAuthenticationCheckbox().uncheck();
nimDeployModal.findExternalRouteError().should('exist');

// Uncheck external route
nimDeployModal.findModelRouteCheckbox().uncheck();
nimDeployModal.findExternalRouteError().should('not.exist');

// Re-enable authentication
nimDeployModal.findModelRouteCheckbox().check();
nimDeployModal.findAuthenticationCheckbox().check();
nimDeployModal.findExternalRouteError().should('not.exist');

// should display the default service account name when "Model route" is checked
nimDeployModal.findModelRouteCheckbox().check();
nimDeployModal.findServiceAccountNameInput().should('have.value', 'default-name');
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import {
import { useDashboardNamespace } from '~/redux/selectors';
import { getServingRuntimeFromTemplate } from '~/pages/modelServing/customServingRuntimes/utils';
import { useNIMPVC } from '~/pages/modelServing/screens/projects/NIMServiceModal/useNIMPVC';
import AuthServingRuntimeSection from '~/pages/modelServing/screens/projects/ServingRuntimeModal/AuthServingRuntimeSection';

const NIM_SECRET_NAME = 'nvidia-nim-secrets';
const NIM_NGC_SECRET_NAME = 'ngc-secret';
Expand Down Expand Up @@ -370,6 +371,14 @@ const ManageNIMServingModal: React.FC<ManageNIMServingModalProps> = ({
setSelectedAcceleratorProfile={setSelectedAcceleratorProfile}
infoContent="Select a server size that will accommodate your largest model. See the product documentation for more information."
/>
{isAuthorinoEnabled && (
<AuthServingRuntimeSection
data={createDataInferenceService}
setData={setCreateDataInferenceService}
allowCreate={allowCreate}
publicRoute
/>
)}
</Stack>
</Form>
</Modal>
Expand Down

0 comments on commit bb3260f

Please sign in to comment.