From e3358634c120fb6d1fea9945638575d31a875e12 Mon Sep 17 00:00:00 2001 From: yurkovychv Date: Mon, 21 Aug 2023 11:26:58 +0300 Subject: [PATCH] PMM-7 default scrape size test --- cli/playwright.config.ts | 2 - .../docker-compose-scrape-intervals.yml | 49 +++++++++++++++++++ cli/tests/generic.spec.ts | 15 +++++- 3 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 cli/test-setup/docker-compose-scrape-intervals.yml diff --git a/cli/playwright.config.ts b/cli/playwright.config.ts index 8378e6882..ab4484bfd 100644 --- a/cli/playwright.config.ts +++ b/cli/playwright.config.ts @@ -28,9 +28,7 @@ const config: PlaywrightTestConfig = { /* Opt out of parallel tests on CI. */ workers: 6, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - // reporter: process.env.CI ? 'github' : 'list', reporter: [ - ['github'], ['list'], ['html', { open: 'never', outputFolder: './test-report' }] ], diff --git a/cli/test-setup/docker-compose-scrape-intervals.yml b/cli/test-setup/docker-compose-scrape-intervals.yml new file mode 100644 index 000000000..07bfe09c5 --- /dev/null +++ b/cli/test-setup/docker-compose-scrape-intervals.yml @@ -0,0 +1,49 @@ +--- +version: '3.7' + +volumes: + scrape-intervals-pmm-server-data: + +networks: + scrape-intervals: + +services: + pmm-server-scrape-intervals: + image: ${DOCKER_VERSION:-perconalab/pmm-server:dev-latest} + container_name: pmm-server-scrape-intervals + healthcheck: + test: [ "CMD", "curl", "-f", "http://127.0.0.1/ping" ] + interval: 3s + timeout: 2s + retries: 20 + ports: + - "180:80" + - "1443:443" + environment: + - PMM_DEBUG=1 + volumes: + - scrape-intervals-pmm-server-data:/srv + networks: + - scrape-intervals + + pmm-client-scrape-intervals: + image: ${CLIENT_DOCKER_VERSION:-perconalab/pmm-client:dev-latest} + container_name: pmm-client-scrape-intervals + depends_on: + pmm-server-scrape-intervals: + condition: service_healthy + environment: + - PMM_AGENT_SETUP=1 + - PMM_AGENT_SERVER_ADDRESS=pmm-server-scrape-intervals + - PMM_AGENT_SERVER_USERNAME=admin + - PMM_AGENT_SERVER_PASSWORD=admin + - PMM_AGENT_PORTS_MIN=41000 + - PMM_AGENT_PORTS_MAX=41500 + - PMM_AGENT_SERVER_INSECURE_TLS=1 + - PMM_AGENT_CONFIG_FILE=config/pmm-agent.yaml + - PMM_AGENT_SETUP_NODE_NAME=pmm-client-scrape-intervals + - PMM_AGENT_SETUP_FORCE=1 + - PMM_AGENT_SETUP_NODE_TYPE=container + restart: on-failure + networks: + - scrape-intervals diff --git a/cli/tests/generic.spec.ts b/cli/tests/generic.spec.ts index cca952bf9..58b72c03e 100644 --- a/cli/tests/generic.spec.ts +++ b/cli/tests/generic.spec.ts @@ -1,4 +1,4 @@ -import { test, expect } from '@playwright/test'; +import { test } from '@playwright/test'; import * as cli from '@helpers/cliHelper'; /** @@ -10,3 +10,16 @@ test('run pmm-status and grep NodeName', async ({}) => { await output.outContains('Node name: client_container_'); }); +test('scrape interval default value', async ({page}) => { + const expectedScrapeSize = '64'; + + await (await cli.exec(`docker-compose -f cli/test-setup/docker-compose-scrape-intervals.yml up -d`)).assertSuccess(); + await (await cli.exec('sudo pmm-admin config --force \'--server-url=https://admin:admin@0.0.0.0:1443\' --server-insecure-tls 127.0.0.1')).assertSuccess() + + const scrapeSizeContainer = await cli.exec('docker logs pmm-client-scrape-intervals 2>&1 | grep \'promscrape.maxScrapeSize.*vm_agent\' | tail -1'); + await scrapeSizeContainer.outContains(`promscrape.maxScrapeSize=\\\"${expectedScrapeSize}MiB\\\"`) + + const scrapeSizeTarball = await cli.exec('ps aux | grep -v \'grep\' | grep \'vm_agent\' | tail -1 | grep -o \'promscrape.maxScrapeSize.*vm_agent\' | tail -1') + await scrapeSizeTarball.outContains(`promscrape.maxScrapeSize=\\\"${expectedScrapeSize}MiB\\\"`) +}); +