Skip to content

Commit

Permalink
PMM-7 default scrape size test
Browse files Browse the repository at this point in the history
  • Loading branch information
yurkovychv committed Aug 21, 2023
1 parent 66709d8 commit e335863
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 3 deletions.
2 changes: 0 additions & 2 deletions cli/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' }]
],
Expand Down
49 changes: 49 additions & 0 deletions cli/test-setup/docker-compose-scrape-intervals.yml
Original file line number Diff line number Diff line change
@@ -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
15 changes: 14 additions & 1 deletion cli/tests/generic.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test, expect } from '@playwright/test';
import { test } from '@playwright/test';
import * as cli from '@helpers/cliHelper';

/**
Expand All @@ -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:[email protected]: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\\\"`)
});

0 comments on commit e335863

Please sign in to comment.