Added Testcafe test for Audit Logging text fields (#2173)
Added Testcafe test for Audit Logging text fields, fixed bug in setting serviceAccount
This commit is contained in:
@@ -1617,8 +1617,11 @@ func setTenantLogsResponse(session *models.Principal, params operator_api.SetTen
|
||||
}
|
||||
}
|
||||
}
|
||||
if params.Data.DbLabels != nil {
|
||||
if len(params.Data.ServiceAccountName) > 0 {
|
||||
minTenant.Spec.Log.ServiceAccountName = params.Data.ServiceAccountName
|
||||
}
|
||||
if params.Data.DbLabels != nil {
|
||||
|
||||
if params.Data.DbImage != "" || params.Data.DbServiceAccountName != "" {
|
||||
modified = true
|
||||
}
|
||||
|
||||
@@ -377,6 +377,7 @@ const TenantAuditLogging = ({
|
||||
<Grid item xs={12} textAlign={"right"}>
|
||||
<Button
|
||||
type="submit"
|
||||
id={"submit_button"}
|
||||
variant="contained"
|
||||
color="primary"
|
||||
disabled={loading || !checkValid()}
|
||||
|
||||
@@ -26,6 +26,7 @@ import {
|
||||
goToPvcInTenant,
|
||||
goToPvcSection,
|
||||
checkMonitoringFieldsAcceptValues,
|
||||
checkLoggingFieldsAcceptValues,
|
||||
} from "./utils";
|
||||
|
||||
fixture("For user with default permissions").page("http://localhost:9090");
|
||||
@@ -101,3 +102,9 @@ test("Test Prometheus config fields can be edited and submitted", async (t) => {
|
||||
await loginToOperator();
|
||||
await checkMonitoringFieldsAcceptValues(tenantName);
|
||||
});
|
||||
|
||||
test("Test Audit Log config fields can be edited and submitted", async (t) => {
|
||||
const tenantName = `storage-lite`;
|
||||
await loginToOperator();
|
||||
await checkLoggingFieldsAcceptValues(tenantName);
|
||||
});
|
||||
|
||||
@@ -115,6 +115,10 @@ export const goToMonitoringSection = async (tenantName: string) => {
|
||||
await t.click(`#list-tenant-${tenantName}`).wait(2000);
|
||||
await t.click(Selector(`a[href$="/monitoring"]`));
|
||||
};
|
||||
export const goToLoggingSection = async (tenantName: string) => {
|
||||
await t.click(`#list-tenant-${tenantName}`).wait(2000);
|
||||
await t.click(Selector(`a[href$="/logging"]`));
|
||||
};
|
||||
|
||||
export const redirectToTenantsList = async () => {
|
||||
await redirectToPath(`${host}/tenants`);
|
||||
@@ -189,3 +193,44 @@ export const checkMonitoringFieldsAcceptValues = async (tenantName: string) => {
|
||||
)
|
||||
.ok();
|
||||
};
|
||||
|
||||
export const checkLoggingFieldsAcceptValues = async (tenantName: string) => {
|
||||
await goToLoggingSection(tenantName);
|
||||
await t
|
||||
.typeText("#image", "minio/operator:v4.4.22", { replace: true })
|
||||
.typeText("#diskCapacityGB", "3", { replace: true })
|
||||
.typeText("#cpuRequest", "3", { replace: true })
|
||||
.typeText("#memRequest", "3", { replace: true })
|
||||
.typeText("#serviceAccountName", "loggingTestServiceAccountName", {
|
||||
replace: true,
|
||||
})
|
||||
.click("#submit_button")
|
||||
.click("#yaml_button")
|
||||
.expect(Selector("#code_wrapper").exists)
|
||||
.ok();
|
||||
await t
|
||||
.expect(
|
||||
(
|
||||
await Selector("#code_wrapper").textContent
|
||||
).includes("image: minio/operator:v4.4.22")
|
||||
)
|
||||
.ok()
|
||||
.expect(
|
||||
(
|
||||
await Selector("#code_wrapper").textContent
|
||||
).includes("diskCapacityGB: 3")
|
||||
)
|
||||
.ok()
|
||||
.expect((await Selector("#code_wrapper").textContent).includes('cpu: "3"'))
|
||||
.ok()
|
||||
.expect(
|
||||
(await Selector("#code_wrapper").textContent).includes('memory: "3"')
|
||||
)
|
||||
.ok()
|
||||
.expect(
|
||||
(
|
||||
await Selector("#code_wrapper").textContent
|
||||
).includes("serviceAccountName: loggingTestServiceAccountName")
|
||||
)
|
||||
.ok();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user