Files
object-browser/portal-ui/tests/operator/tenants.ts
Daniel Valdivia 2aa5081889 Release v0.17.3 (#2047)
Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
2022-05-26 16:50:23 -07:00

105 lines
3.3 KiB
TypeScript

// This file is part of MinIO Console Server
// Copyright (c) 2022 MinIO, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import { t, Selector } from "testcafe";
import {
loginToOperator,
createTenant,
createTenantWithoutAuditLog,
deleteTenant,
redirectToTenantsList,
goToPodInTenant,
goToPodSection,
goToPvcInTenant,
goToPvcSection,
} from "./utils";
fixture("For user with default permissions").page("http://localhost:9090");
test("Create Tenant and List Tenants", async (t) => {
const tenantName = `tenant-${Math.floor(Math.random() * 10000)}`;
await loginToOperator();
await createTenant(tenantName);
await deleteTenant(tenantName);
});
test("Create Tenant Without Audit Log", async (t) => {
const tenantName = `tenant-${Math.floor(Math.random() * 10000)}`;
await loginToOperator();
await createTenantWithoutAuditLog(tenantName);
await deleteTenant(tenantName);
});
test("Test describe section for PODs in new tenant", async (t) => {
const tenantName = `tenant-${Math.floor(Math.random() * 10000)}`;
await loginToOperator();
await createTenant(tenantName);
await t.wait(20000); // wait for PODs to be created
await testPODDescribe(tenantName);
await redirectToTenantsList();
await deleteTenant(tenantName);
});
const testPODDescribe = async (tenantName: string) => {
await goToPodInTenant(tenantName);
await goToPodSection(1);
await checkPodDescribeHasSections();
};
const checkPodDescribeHasSections = async () => {
await t
.expect(Selector("#pod-describe-summary").exists)
.ok()
.expect(Selector("#pod-describe-annotations").exists)
.ok()
.expect(Selector("#pod-describe-labels").exists)
.ok()
.expect(Selector("#pod-describe-conditions").exists)
.ok()
.expect(Selector("#pod-describe-tolerations").exists)
.ok()
.expect(Selector("#pod-describe-volumes").exists)
.ok()
.expect(Selector("#pod-describe-containers").exists)
.ok();
};
test("Test describe section for PVCs in new tenant", async (t) => {
const tenantName = `tenant-${Math.floor(Math.random() * 10000)}`;
await loginToOperator();
await createTenant(tenantName);
await t.wait(20000); // wait for PVCs to be created
await testPvcDescribe(tenantName);
await redirectToTenantsList();
await deleteTenant(tenantName);
});
const testPvcDescribe = async (tenantName: string) => {
await goToPvcInTenant(tenantName);
await goToPvcSection(1);
await checkPvcDescribeHasSections();
};
const checkPvcDescribeHasSections = async () => {
await t
.expect(Selector("#pvc-describe-summary").exists)
.ok()
.expect(Selector("#pvc-describe-annotations").exists)
.ok()
.expect(Selector("#pvc-describe-labels").exists)
.ok();
};