fix: fix the size quota check when create volume

1. Disable to click submit button when the remaining size/type size quota is 0.
2. Add image check to the volume e2e after the volume created image successfully

Change-Id: I6d8c0491647abc8329fa089665194da278decf46
This commit is contained in:
Jingwei.Zhang 2022-08-02 17:35:04 +08:00
parent da98091f53
commit 28846810e2
2 changed files with 18 additions and 3 deletions

View File

@ -401,6 +401,11 @@ export const getQuota = (cinderQuota) => {
};
const getErrorMessage = ({ name, left, input }) => {
if (left === 0) {
return t('Quota: Insufficient { name } quota to create resources.', {
name,
});
}
const error = t(
'Quota: Insufficient { name } quota to create resources, please adjust resource quantity or quota(left { left }, input { input }).',
{
@ -444,7 +449,7 @@ export const getAdd = (cinderQuota, withCountCheck = true) => {
});
return { ...zero, error };
}
if (sizeLimit !== -1 && sizeLeft < totalSize) {
if ((sizeLimit !== -1 && sizeLeft < totalSize) || sizeLeft === 0) {
const error = getErrorMessage({
name: t('gigabytes'),
left: sizeLeft,
@ -463,7 +468,10 @@ export const getAdd = (cinderQuota, withCountCheck = true) => {
});
return { ...zero, error };
}
if (typeSizeLimit !== -1 && typeSizeLeft < totalSize) {
if (
(typeSizeLimit !== -1 && typeSizeLeft < totalSize) ||
typeSizeLeft === 0
) {
const error = getErrorMessage({
name: t('{name} type gigabytes', { name: type }),
left: typeSizeLeft,

View File

@ -13,7 +13,11 @@
// limitations under the License.
import { onlyOn } from '@cypress/skip-test';
import { volumeListUrl, volumeTypeListUrl } from '../../../support/constants';
import {
volumeListUrl,
volumeTypeListUrl,
imageListUrl,
} from '../../../support/constants';
describe('The Volume Page', () => {
const listUrl = volumeListUrl;
@ -157,6 +161,9 @@ describe('The Volume Page', () => {
.formInput('image_name', imageName)
.clickModalActionSubmitButton();
cy.tableSearchText(name).waitStatusActiveByRefresh();
cy.visit(imageListUrl)
.tableSearchText(imageName)
.checkTableFirstRow(imageName);
});
it('successfully extend volume', () => {