Skip to content

Commit

Permalink
PMM-13240 PMM3 integration ui test fixs (#829)
Browse files Browse the repository at this point in the history
* Updates for PDPGSQL, PXC, PS UI Test for v3
  • Loading branch information
saikumar-vs authored Jul 31, 2024
1 parent f8e1b8a commit 4f5d0b1
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 59 deletions.
17 changes: 10 additions & 7 deletions tests/qa-integration/pmm_pdpgsql_integration_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,19 @@ Scenario(
I, dashboardPage, adminPage,
}) => {
I.amOnPage(dashboardPage.postgresqlInstanceSummaryDashboard.url);
dashboardPage.waitForDashboardOpened();
await dashboardPage.applyFilter('Service Name', 'PDPGSQL_');
await dashboardPage.waitForDashboardOpened();
await dashboardPage.applyFilter('Service Name', 'pdpgsql_');
// Grab containerName from ServiceName
const grabServiceName = await I.grabTextFrom('//label[@for="var-service_name"]//following-sibling::*');
const partsServiceName = grabServiceName.split('_service');
const containerServiceName = partsServiceName[0];

await dashboardPage.expandEachDashboardRow();
I.click(adminPage.fields.metricTitle);
adminPage.performPageDown(5);
adminPage.performPageUp(5);
dashboardPage.verifyMetricsExistence(dashboardPage.postgresqlInstanceSummaryDashboard.metrics);
await dashboardPage.verifyThereAreNoGraphsWithNA();
await dashboardPage.verifyMetricsExistence(dashboardPage.postgresqlInstanceSummaryDashboard.metrics);
await dashboardPage.verifyThereAreNoGraphsWithoutData(1);
await I.verifyCommand('pmm-admin list | grep "postgresql_pgstatmonitor_agent" | grep "Running"');
await I.verifyCommand('pmm-admin list | grep "postgres_exporter" | grep "Running"');
await I.verifyCommand(`docker exec ${containerServiceName} pmm-admin list | grep "postgresql_pgstatmonitor_agent" | grep "Running"`);
await I.verifyCommand(`docker exec ${containerServiceName} pmm-admin list | grep "postgres_exporter" | grep "Running"`);
},
);
46 changes: 22 additions & 24 deletions tests/qa-integration/pmm_ps_integration_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Scenario(
async ({
I, remoteInstancesPage, pmmInventoryPage, inventoryAPI,
}) => {
const port = await I.verifyCommand(`docker exec ${container_name} pmm-admin list | grep "MySQL" | grep "mysql_client" | awk -F":" '{print $2}' | awk -F" " '{ print $1}' | head -1`);
const port = await I.verifyCommand(`docker exec ${container_name} pmm-admin list | grep "MySQL" | awk -F":" '{print $2}' | awk -F" " '{ print $1}' | head -1`);
const details = {
serviceName: remoteServiceName,
serviceType: 'MYSQL_SERVICE',
Expand All @@ -47,7 +47,8 @@ Scenario(
I.fillField(remoteInstancesPage.fields.environment, details.environment);
I.fillField(remoteInstancesPage.fields.cluster, details.cluster);
I.click(remoteInstancesPage.fields.addService);
//I.waitForVisible(pmmInventoryPage.fields.agentsLink, 30);
// I.waitForVisible(pmmInventoryPage.fields.agentsLink, 30);
I.wait(10);
await inventoryAPI.verifyServiceExistsAndHasRunningStatus(
{
serviceType: 'MYSQL_SERVICE',
Expand All @@ -70,8 +71,8 @@ Scenario(
let response; let result;
const metricName = 'mysql_global_status_max_used_connections';

await I.verifyCommand(`docker exec ${container_name} pmm-admin list | grep "mysqld_exporter" | grep "Running" | wc -l | grep "1"`);
await I.verifyCommand(`docker exec ${container_name} pmm-admin list | grep "mysql_slowlog_agent" | grep "Running" | wc -l | grep "1"`);
await I.verifyCommand(`docker exec ${container_name} pmm-admin list | grep "mysqld_exporter" | grep -i "running" | wc -l | grep "1"`);
await I.verifyCommand(`docker exec ${container_name} pmm-admin list | grep "mysql_perfschema_agent" | grep -i "running" | wc -l | grep "1"`);

const clientServiceName = (await I.verifyCommand(`docker exec ${container_name} pmm-admin list | grep MySQL | head -1 | awk -F" " '{print $2}'`)).trim();

Expand Down Expand Up @@ -105,20 +106,18 @@ Scenario(
const url = I.buildUrlWithParams(dashboardPage.mysqlInstanceSummaryDashboard.clearUrl, { from: 'now-5m', to: 'now', service_name: service });

I.amOnPage(url);
dashboardPage.waitForDashboardOpened();
await dashboardPage.waitForDashboardOpened();
adminPage.performPageDown(5);
await dashboardPage.expandEachDashboardRow();
adminPage.performPageUp(5);
if (service === remoteServiceName) {
await dashboardPage.verifyThereAreNoGraphsWithNA(7);
await dashboardPage.verifyThereAreNoGraphsWithoutData(9);
await dashboardPage.verifyThereAreNoGraphsWithoutData(15);
} else {
await dashboardPage.verifyThereAreNoGraphsWithNA(1);
await dashboardPage.verifyThereAreNoGraphsWithoutData(5);
await dashboardPage.verifyThereAreNoGraphsWithoutData(6);
}
}
},
).retry(1);
).retry(2);

Scenario(
'Verify QAN after PS Instances is added @pmm-ps-integration @not-ui-pipeline',
Expand All @@ -130,10 +129,11 @@ Scenario(
const serviceList = [clientServiceName, remoteServiceName];

for (const service of serviceList) {
I.amOnPage(I.buildUrlWithParams(queryAnalyticsPage.url, { from: 'now-120m', to: 'now' }));

I.amOnPage(I.buildUrlWithParams(queryAnalyticsPage.url, { from: 'now-5m' }));
queryAnalyticsPage.waitForLoaded();
await adminPage.applyTimeRange('Last 12 hours');
queryAnalyticsPage.waitForLoaded();
await queryAnalyticsPage.filters.selectFilter(service);
await queryAnalyticsPage.filters.selectFilterInGroup(service, 'Service Name');
queryAnalyticsPage.waitForLoaded();
const count = await queryAnalyticsPage.data.getCountOfItems();

Expand All @@ -150,28 +150,26 @@ Scenario(
const dbName = 'sbtest3';
const sbUser = { name: 'sysbench', password: 'test' };

const psContainerName = await I.verifyCommand('sudo docker ps --format "{{.Names}}" | grep ps_');
const psContainerName = await I.verifyCommand('docker ps --format "{{.Names}}" | grep ps_');

await I.verifyCommand(`sudo docker exec ${psContainerName} mysql -h 127.0.0.1 --port 3307 -u ${credentials.perconaServer.root.username} -p${credentials.perconaServer.root.password} -e "CREATE USER IF NOT EXISTS sysbench@'%' IDENTIFIED WITH mysql_native_password BY 'test'; GRANT ALL ON *.* TO sysbench@'%'; DROP DATABASE IF EXISTS ${dbName};"`);
await I.verifyCommand(`sudo docker exec ${psContainerName} mysql -h 127.0.0.1 --port 3307 -u ${sbUser.name} -p${sbUser.password} -e "SET GLOBAL slow_query_log=ON;"`);
await I.verifyCommand(`sudo docker exec ${psContainerName} mysql -h 127.0.0.1 --port 3307 -u ${sbUser.name} -p${sbUser.password} -e "SET GLOBAL long_query_time=0;"`);
await I.verifyCommand(`sudo docker exec ${psContainerName} mysql -h 127.0.0.1 --port 3307 -u ${sbUser.name} -p${sbUser.password} -e "CREATE DATABASE ${dbName}"`);
await I.verifyCommand(`docker exec ${psContainerName} mysql -h 127.0.0.1 --port 3307 -u ${credentials.perconaServer.root.username} -p${credentials.perconaServer.root.password} -e "CREATE USER IF NOT EXISTS sysbench@'%' IDENTIFIED WITH mysql_native_password BY 'test'; GRANT ALL ON *.* TO sysbench@'%'; DROP DATABASE IF EXISTS ${dbName};"`);
await I.verifyCommand(`docker exec ${psContainerName} mysql -h 127.0.0.1 --port 3307 -u ${sbUser.name} -p${sbUser.password} -e "SET GLOBAL slow_query_log=ON;"`);
await I.verifyCommand(`docker exec ${psContainerName} mysql -h 127.0.0.1 --port 3307 -u ${sbUser.name} -p${sbUser.password} -e "SET GLOBAL long_query_time=0;"`);
await I.verifyCommand(`docker exec ${psContainerName} mysql -h 127.0.0.1 --port 3307 -u ${sbUser.name} -p${sbUser.password} -e "CREATE DATABASE ${dbName}"`);

for (let i = 1; i <= 5; i++) {
await I.verifyCommand(`sudo docker exec ${psContainerName} mysql -h 127.0.0.1 --port 3307 -u ${sbUser.name} -p${sbUser.password} ${dbName} -e "CREATE TABLE Persons${i} ( PersonID int, LastName varchar(255), FirstName varchar(255), Address varchar(255), City varchar(255) );"`);
await I.verifyCommand(`docker exec ${psContainerName} mysql -h 127.0.0.1 --port 3307 -u ${sbUser.name} -p${sbUser.password} ${dbName} -e "CREATE TABLE Persons${i} ( PersonID int, LastName varchar(255), FirstName varchar(255), Address varchar(255), City varchar(255) );"`);
for (let j = 0; j <= 4; j++) {
await I.verifyCommand(`sudo docker exec ${psContainerName} mysql -h 127.0.0.1 --port 3307 -u ${sbUser.name} -p${sbUser.password} ${dbName} -e "INSERT INTO Persons${i} values (${j},'Qwerty','Qwe','Address','City');"`);
await I.verifyCommand(`docker exec ${psContainerName} mysql -h 127.0.0.1 --port 3307 -u ${sbUser.name} -p${sbUser.password} ${dbName} -e "INSERT INTO Persons${i} values (${j},'Qwerty','Qwe','Address','City');"`);
}

await I.verifyCommand(`sudo docker exec ${psContainerName} mysql -h 127.0.0.1 --port 3307 -u ${sbUser.name} -p${sbUser.password} ${dbName} -e "select count(*) from Persons${i};"`);
await I.verifyCommand(`docker exec ${psContainerName} mysql -h 127.0.0.1 --port 3307 -u ${sbUser.name} -p${sbUser.password} ${dbName} -e "select count(*) from Persons${i};"`);
}

I.amOnPage(I.buildUrlWithParams(queryAnalyticsPage.url, { from: 'now-1h', refresh: '5s' }));
queryAnalyticsPage.waitForLoaded();
await queryAnalyticsPage.filters.selectFilter(dbName, 120000);
queryAnalyticsPage.waitForLoaded();
I.waitForText('17', 180, queryAnalyticsPage.data.elements.totalItems);
await queryAnalyticsPage.data.selectRow(0);
I.waitForText('105', 180, queryAnalyticsPage.elements.queryCountValue);
I.waitForText('16', 180, queryAnalyticsPage.data.elements.totalItems);
},
).retry(1);
2 changes: 1 addition & 1 deletion tests/qa-integration/pmm_psmdb_integration_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ Scenario(
I.assertTrue(errorCode.includes(1), `No errors for arbiter setup expected but got error code: ${errorCode}`);

I.amOnPage(I.buildUrlWithParams(dashboardPage.mongodbReplicaSetSummaryDashboard.cleanUrl, { from: 'now-1h', refresh: '5s' }));
dashboardPage.waitForDashboardOpened();
await dashboardPage.waitForDashboardOpened();

// Gather Secondary member Service Name from Mongo
const secondaryServiceName = (await I.verifyCommand(`docker exec ${arbiter_primary_container_name} mongo --eval rs\.printSecondaryReplicationInfo\\(\\) --username=${username} --password=${password} | awk -F ":" '/source/ {print $2}'`)).trim();
Expand Down
48 changes: 21 additions & 27 deletions tests/qa-integration/pmm_pxc_integration_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Before(async ({ I, settingsAPI }) => {
});

const version = process.env.PXC_VERSION ? `${process.env.PXC_VERSION}` : '8.0';
const container_name = `pxc_container1_${version}`;
const container_name = `pxc_proxysql_pmm_${version}`;
const remoteServiceName = 'remote_pmm-mysql-integration';

const connection = {
Expand All @@ -27,7 +27,7 @@ Scenario(
const details = {
serviceName: remoteServiceName,
serviceType: 'MYSQL_SERVICE',
port: port,
port,
username: connection.username,
password: connection.password,
host: container_name,
Expand All @@ -39,15 +39,15 @@ Scenario(
remoteInstancesPage.waitUntilRemoteInstancesPageLoaded();
remoteInstancesPage.openAddRemotePage('mysql');
I.fillField(remoteInstancesPage.fields.hostName, details.host);
I.clearField(remoteInstancesPage.fields.portNumber);
// I.clearField(remoteInstancesPage.fields.portNumber);
I.fillField(remoteInstancesPage.fields.portNumber, details.port);
I.fillField(remoteInstancesPage.fields.userName, details.username);
I.fillField(remoteInstancesPage.fields.serviceName, remoteServiceName);
I.fillField(remoteInstancesPage.fields.password, details.password);
I.fillField(remoteInstancesPage.fields.environment, details.environment);
I.fillField(remoteInstancesPage.fields.cluster, details.cluster);
I.click(remoteInstancesPage.fields.addService);
//I.waitForVisible(pmmInventoryPage.fields.agentsLink, 30);
// I.waitForVisible(pmmInventoryPage.fields.agentsLink, 30);
await inventoryAPI.verifyServiceExistsAndHasRunningStatus(
{
serviceType: 'MYSQL_SERVICE',
Expand All @@ -70,8 +70,8 @@ Scenario(
let response; let result;
const metricName = 'mysql_global_status_max_used_connections';

await I.verifyCommand(`docker exec ${container_name} pmm-admin list | grep "mysqld_exporter" | grep "Running" | wc -l | grep "3"`);
await I.verifyCommand(`docker exec ${container_name} pmm-admin list | grep "mysql_perfschema_agent" | grep "Running" | wc -l | grep "3"`);
await I.verifyCommand(`docker exec ${container_name} pmm-admin list | grep "mysqld_exporter" | grep -i "Running" | wc -l | grep "3"`);
await I.verifyCommand(`docker exec ${container_name} pmm-admin list | grep "mysql_perfschema_agent" | grep -i "Running" | wc -l | grep "3"`);

const clientServiceName = (await I.verifyCommand(`docker exec ${container_name} pmm-admin list | grep MySQL | head -1 | awk -F" " '{print $2}'`)).trim();

Expand Down Expand Up @@ -103,42 +103,36 @@ Scenario(
const serviceList = [clientServiceName, remoteServiceName];

for (const service of serviceList) {
url = I.buildUrlWithParams(dashboardPage.mysqlInstanceSummaryDashboard.url, { from: 'now-5m', service_name: service });
url = I.buildUrlWithParams(dashboardPage.mysqlPXCGaleraNodeSummaryDashboard.clearUrl, { from: 'now-15m', service_name: service });

I.amOnPage(url);
dashboardPage.waitForDashboardOpened();
await dashboardPage.waitForDashboardOpened();
adminPage.performPageDown(5);
await dashboardPage.expandEachDashboardRow();
adminPage.performPageUp(5);
if (service === remoteServiceName) {
await dashboardPage.verifyThereAreNoGraphsWithNA(7);
await dashboardPage.verifyThereAreNoGraphsWithoutData(9);
await dashboardPage.verifyThereAreNoGraphsWithoutData(6);
} else {
await dashboardPage.verifyThereAreNoGraphsWithNA(1);
await dashboardPage.verifyThereAreNoGraphsWithoutData(5);
await dashboardPage.verifyThereAreNoGraphsWithoutData(3);
}

url = I.buildUrlWithParams(dashboardPage.mysqlPXCGaleraNodeSummaryDashboard.url, { from: 'now-5m', service_name: service });

I.amOnPage(url);
dashboardPage.waitForDashboardOpened();
adminPage.performPageDown(5);
await dashboardPage.expandEachDashboardRow();
adminPage.performPageUp(5);
await dashboardPage.verifyThereAreNoGraphsWithNA(1);
await dashboardPage.verifyThereAreNoGraphsWithoutData(1);
}

I.amOnPage(`${dashboardPage.pxcGaleraClusterSummaryDashboard.url}&var-replset=rs1`);
I.amOnPage(dashboardPage.proxysqlInstanceSummaryDashboard.url);
dashboardPage.waitForDashboardOpened();
await adminPage.applyTimeRange('Last 5 minutes');
await dashboardPage.expandEachDashboardRow();
await dashboardPage.verifyMetricsExistence(dashboardPage.proxysqlInstanceSummaryDashboard.metrics);
await dashboardPage.verifyThereAreNoGraphsWithoutData(6);

I.amOnPage(dashboardPage.pxcGaleraClusterSummaryDashboard.url);
await dashboardPage.waitForDashboardOpened();
await adminPage.applyTimeRange('Last 5 minutes');
adminPage.performPageDown(5);
await dashboardPage.expandEachDashboardRow();
adminPage.performPageUp(5);
await dashboardPage.verifyThereAreNoGraphsWithNA();
await dashboardPage.verifyThereAreNoGraphsWithoutData(1);
await dashboardPage.verifyThereAreNoGraphsWithoutData(2);
},
).retry(1);
).retry(3);

Scenario(
'Verify QAN after PXC Instances is added @pmm-pxc-integration @not-ui-pipeline',
Expand All @@ -153,7 +147,7 @@ Scenario(
I.amOnPage(I.buildUrlWithParams(queryAnalyticsPage.url, { from: 'now-120m', to: 'now' }));

queryAnalyticsPage.waitForLoaded();
queryAnalyticsPage.filters.selectFilter(service);
await queryAnalyticsPage.filters.selectFilterInGroup(service, 'Service Name');
queryAnalyticsPage.waitForLoaded();
const count = await queryAnalyticsPage.data.getCountOfItems();

Expand Down

0 comments on commit 4f5d0b1

Please sign in to comment.