it('should force enter host into maintenance', function () {
const hostname = Cypress._.sample(this.hosts).name;
+ const hostnameList = new Array();
+ this.hosts.array.forEach((host: any) => {
+ hostnameList.push(host.hostname);
+ });
const serviceList = new Array();
this.services.forEach((service: any) => {
if (hostname === service.hostname) {
});
let enterMaintenance = true;
+
+ // Force maintenance might throw out error if host are less than 3.
+ if (hostnameList.length < 3) {
+ enterMaintenance = false;
+ }
+
serviceList.forEach((service: string) => {
- if (service === 'mgr' || service === 'alertmanager') {
+ if (service !== 'rgw' && (service === 'mgr' || service === 'alertmanager')) {
enterMaintenance = false;
}
});
msg.includes('WARNING') &&
!msg.includes('It is NOT safe to stop') &&
!msg.includes('ALERT') &&
- !msg.includes('unable to stop')
+ !msg.includes('unsafe to stop')
) {
this.showModal = true;
}
expect(showForceMaintenanceModal.showModal).toBeFalsy();
});
- it('should not show force maintenance modal when it is unable to stop host', () => {
- const errorMsg = 'unable to stop osd.0 because of some unknown reason';
+ it('should not show force maintenance modal when it is unsafe to stop host', () => {
+ const errorMsg = 'unsafe to stop osd.0 because of some unknown reason';
showForceMaintenanceModal.showModalDialog(errorMsg);
expect(showForceMaintenanceModal.showModal).toBeFalsy();
});
error.error['detail'].includes('WARNING') &&
!error.error['detail'].includes('It is NOT safe to stop') &&
!error.error['detail'].includes('ALERT') &&
- !error.error['detail'].includes('unable to stop')
+ !error.error['detail'].includes('unsafe to stop')
) {
- const modalVarialbes = {
+ const modalVariables = {
titleText: $localize`Warning`,
buttonText: $localize`Continue`,
warning: true,
);
}
};
- this.modalRef = this.modalService.show(ConfirmationModalComponent, modalVarialbes);
+ this.modalRef = this.modalService.show(ConfirmationModalComponent, modalVariables);
} else {
this.notificationService.show(
NotificationType.error,