Skip to content

Commit

Permalink
PMM-13573 fix settings tests (#901)
Browse files Browse the repository at this point in the history
* PMM-13573 fix settings tests

* PMM-13573 fix settings tests

* PMM-13573 mongo 8 ssl for testing

* PMM-13573 fix externalClickhouse_test.js

* PMM-13573 fix disconnect test

* PMM-13573 fix rdsadmin test

* PMM-13573 fix rdsadmin test

* PMM-13573 update disconnect test

* PMM-13573 update skip azure node metric check
  • Loading branch information
yurkovychv authored Nov 29, 2024
1 parent 6069c91 commit 22a50df
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 42 deletions.
4 changes: 3 additions & 1 deletion docker-compose-clickhouse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,16 @@ services:
restart: on-failure

mysql5.7:
platform: linux/x86_64
container_name: mysql5.7
image: mysql:5.7
image: percona:5.7.30
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_ROOT_PASSWORD: 7B*53@lCdflR

external-clickhouse:
platform: linux/x86_64
image: clickhouse/clickhouse-server:22.5.2
container_name: external-clickhouse
healthcheck:
Expand Down
9 changes: 3 additions & 6 deletions docker-compose-disconnect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ services:
- PMM_DEBUG=1
- PERCONA_TEST_SAAS_HOST=check-dev.percona.com:443
- PERCONA_TEST_CHECKS_PUBLIC_KEY=RWTg+ZmCCjt7O8eWeAmTLAqW+1ozUbpRSKSwNTmO+exlS5KEIPYWuYdX
- PERCONA_TEST_VERSION_SERVICE_URL=https://check-dev.percona.com/versions/v1
- PERCONA_TEST_TELEMETRY_INTERVAL=10s
- PERCONA_TEST_TELEMETRY_RETRY_BACKOFF=10s
networks:
- server-network

Expand All @@ -55,9 +52,9 @@ services:
- server-network
- mysql-network

mysql5.7:
container_name: mysql-disconnect-5.7
image: mysql:5.7
ps8:
container_name: ps8
image: percona:8.0
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
Expand Down
2 changes: 1 addition & 1 deletion tests/QAN/externalClickhouse_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const basePmmUrl = `http://127.0.0.1:${pmmServerPort}/`;
const dockerVersion = process.env.DOCKER_VERSION || 'perconalab/pmm-server:dev-latest';

BeforeSuite(async ({ I }) => {
await I.verifyCommand(`PMM_SERVER_IMAGE=${dockerVersion} docker-compose -f docker-compose-clickhouse.yml up -d`);
await I.verifyCommand(`PMM_SERVER_IMAGE=${dockerVersion} docker compose -f docker-compose-clickhouse.yml up -d`);
await I.wait(30);
await I.verifyCommand('docker exec pmm-client-clickhouse pmm-admin add mysql --username=root --password=7B*53@lCdflR --query-source=perfschema mysql5.7 mysql5.7:3306');
await I.wait(60);
Expand Down
12 changes: 5 additions & 7 deletions tests/configuration/verifyPMMServerDisconnect_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ Feature('Pmm Server stability');
const pmmServerPort = '8180';
const basePmmUrl = `http://127.0.0.1:${pmmServerPort}/`;
let clientServerNetwork = 'pmm-ui-tests_server-network';
const serverImage = process.env.DOCKER_VERSION || 'perconalab/pmm-server:dev-latest';

BeforeSuite(async ({ I }) => {
await I.verifyCommand(`PMM_SERVER_IMAGE=${process.env.DOCKER_VERSION} docker-compose -f docker-compose-disconnect.yml up -d pmm-server-disconnect`);
await I.asyncWaitFor(async () => await I.verifyCommand(`echo $(curl -s -o /dev/null -w '%{http_code}' 127.0.0.1:${pmmServerPort}/ping)`) === '200', 100);
await I.verifyCommand('docker-compose -f docker-compose-disconnect.yml up -d pmm-client');
await I.verifyCommand('docker-compose -f docker-compose-disconnect.yml up -d mysql5.7');
await I.verifyCommand(`PMM_SERVER_IMAGE=${serverImage} docker compose -f docker-compose-disconnect.yml up -d`);
clientServerNetwork = await I.verifyCommand('docker inspect pmm-client-disconnect -f \'{{range $k, $v := .NetworkSettings.Networks}}{{printf "%s\\n" $k}}{{end}}\' | grep -o \'.*server-network\'');
await I.asyncWaitFor(async () => await I.verifyCommand('echo $(docker container logs mysql-disconnect-5.7 2>&1 | grep "Server hostname (bind-address)")') !== '', 100);
await I.verifyCommand('docker exec pmm-client-disconnect pmm-admin add mysql --username=root --password=7B*53@lCdflR --host=mysql-disconnect-5.7 --port=3306 --query-source=perfschema mysql-disconnect-5.7');
I.wait(20);
await I.verifyCommand('docker exec pmm-client-disconnect pmm-admin add mysql --username=root --password=7B*53@lCdflR --host=ps8 --port=3306 --query-source=perfschema ps8');
// wait for the data to be scraped from db
I.wait(60);
});
Expand Down Expand Up @@ -50,7 +48,7 @@ Scenario(

Scenario(
'@PMM-T1443 Verify metrics are saved if pmm-agent is stopped @disconnect',
async ({ I, dashboardPage, qanPage }) => {
async ({ I, dashboardPage }) => {
await I.amOnPage(withCustomBaseUrl(dashboardPage.mySQLInstanceOverview.url));
await dashboardPage.waitForDashboardOpened();
await dashboardPage.expandEachDashboardRow();
Expand Down
18 changes: 13 additions & 5 deletions tests/serverLogs_test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { codeceptjsConfig } = inject();
const { codeceptjsConfig, I } = inject();
const assert = require('assert');

Feature('Logs tests');
Expand All @@ -7,13 +7,21 @@ const filename = 'logs.zip';
const fileNameToCheck = 'pmm-managed.log';
const baseUrl = codeceptjsConfig.config.helpers.Playwright.url;

const getLineCount = async () => Number(await I.verifyCommand('docker exec pmm-server cat /srv/logs/pmm-managed.log | wc -l'));

BeforeSuite(async ({ I, locationsAPI }) => {
let actualLineCount = await getLineCount();
// Simple request to generate > 50k lines in logs
for (let i = 0; i < 13000; i++) {
await locationsAPI.getLocationsList();
}

I.wait(15);
while (actualLineCount < 50001) {
for (let i = 0; i < 1000; i++) {
await locationsAPI.getLocationsList();
}

I.wait(5);

actualLineCount = await getLineCount();
}
});

// @settings-fb tag added in order to execute these tests on FB
Expand Down
8 changes: 4 additions & 4 deletions tests/verifyAWSRDSPostgreSQLInstance_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,23 @@ Scenario(
I.amOnPage(remoteInstancesPage.url);
remoteInstancesPage.waitUntilRemoteInstancesPageLoaded().openAddAWSRDSMySQLPage();
remoteInstancesPage.discoverRDS();
remoteInstancesPage.verifyInstanceIsDiscovered(serviceName);
await remoteInstancesPage.verifyInstanceIsDiscovered(serviceName);
remoteInstancesPage.startMonitoringOfInstance(serviceName);
remoteInstancesPage.verifyAddInstancePageOpened();
const grabbedHostname = await I.grabValueFrom(remoteInstancesPage.fields.hostName);

assert.ok(grabbedHostname.startsWith(serviceName), `Hostname is incorrect: ${grabbedHostname}`);
I.seeInField(remoteInstancesPage.fields.serviceName, serviceName);
remoteInstancesPage.fillRemoteRDSFields(serviceName);
await remoteInstancesPage.fillRemoteRDSFields(serviceName);
remoteInstancesPage.createRemoteInstance(serviceName);
pmmInventoryPage.verifyRemoteServiceIsDisplayed(serviceName);
// Skipping due to QAN Setup part on AWS
// await pmmInventoryPage.verifyAgentHasStatusRunning(serviceName);

// await pmmInventoryPage.verifyMetricsFlags(serviceName);
const logs = await I.verifyCommand('docker exec pmm-server cat /srv/logs/pmm-agent.log | awk \'/ERRO/ && /rdsadmin/\'');
const logs = await I.verifyCommand('docker exec pmm-server cat /srv/logs/pmm-agent.log | awk \'/postgres_exporter/ && /ERRO/ && /opening connection/ && /rdsadmin/\'');

assert.ok(logs, `Logs contains errors about rdsadmin database being used! \n The lines are: \n ${logs}`);
assert.ok(!logs, `Logs contains errors about rdsadmin database being used! \n The lines are: \n ${logs}`);
},
);

Expand Down
3 changes: 2 additions & 1 deletion tests/verifyAzureMySQLPostgreSQLRemoteInstance_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ if (remoteInstancesHelper.getInstanceStatus('azure').azure_postgresql.enabled) {

const metrics = new DataTable(['metricName']);

metrics.add(['azure_memory_percent_average']);
// TODO: bring back once PMM-13585 is fixed
// metrics.add(['azure_memory_percent_average']);
metrics.add(['mysql_global_status_max_used_connections']);
// Removing to avoid failures due to missing metric, seems to be some changes on Azure deployments.
// metrics.add(['mysql_global_variables_azure_ia_enabled']);
Expand Down
4 changes: 2 additions & 2 deletions tests/verifyMongodbSharding_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ Scenario(
async ({
I,
}) => {
const version = '6.0';
const version = '7.0';
const edition = 'Community';

const containerName = await I.verifyCommand(`docker ps --format "table {{.ID}}\\t{{.Image}}\\t{{.Names}}" | grep 'psmdb.*${version}_sharded' | awk -F " " '{print $3}'`);
const containerName = `psmdb_pmm_${version}_sharded`;
const agentId = await I.verifyCommand(`docker exec ${containerName} pmm-admin list | grep "42002" | awk -F " " '{print $4}'`);
const serviceId = await I.verifyCommand(`docker exec ${containerName} pmm-admin list | grep "mongodb_shraded" | awk -F " " '{print $4}'`);
const port = await I.verifyCommand(`docker exec ${containerName} pmm-admin list | grep "mongodb_exporter.*${serviceId}" | awk -F " " '{print $6}'`);
Expand Down
16 changes: 1 addition & 15 deletions tests/verifyTLSMongoDBRemoteInstance_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,7 @@ Feature('Monitoring SSL/TLS MongoDB instances');

const instances = new DataTable(['serviceName', 'version', 'container', 'serviceType', 'metric', 'maxQueryLength']);

instances.add(['mongodb_4.4_ssl_service', '4.4', 'mongodb_4.4', 'mongodb_ssl', 'mongodb_connections', '7']);
// instances.add(['mongodb_4.2_ssl_service', '4.2', 'mongodb_4.2', 'mongodb_ssl', 'mongodb_connections']);
instances.add(['mongodb_5.0_ssl_service', '5.0', 'mongodb_5.0', 'mongodb_ssl', 'mongodb_connections', '7']);

BeforeSuite(async ({ I, codeceptjsConfig }) => {
// await I.verifyCommand(`${pmmFrameworkLoader} --mo-version=4.2 --setup-mongodb-ssl --pmm2`);
await I.verifyCommand(`${pmmFrameworkLoader} --mo-version=4.4 --setup-mongodb-ssl --pmm2`);
await I.verifyCommand(`${pmmFrameworkLoader} --mo-version=5.0 --setup-mongodb-ssl --pmm2`);
});

AfterSuite(async ({ I }) => {
await I.verifyCommand('docker stop mongodb_4.4 || docker rm mongodb_4.4');
// await I.verifyCommand('docker stop mongodb_4.2 || docker rm mongodb_4.2');
await I.verifyCommand('docker stop mongodb_5.0 || docker rm mongodb_5.0');
});
instances.add(['mongodb_8.0_ssl_service', '8.0', 'mongodb_8.0', 'mongodb_ssl', 'mongodb_connections', '7']);

Before(async ({ I, settingsAPI }) => {
await I.Authorize();
Expand Down

0 comments on commit 22a50df

Please sign in to comment.