Skip to content

Commit

Permalink
Merge branch 'v3' into PMM-12710-API-breaking-changes
Browse files Browse the repository at this point in the history
  • Loading branch information
YashSartanpara1 authored May 9, 2024
2 parents ceee2f6 + d89f416 commit 7c9bac9
Show file tree
Hide file tree
Showing 8 changed files with 577 additions and 454 deletions.
31 changes: 28 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Test pipeline

on: pull_request
on:
pull_request:
paths:
- pmm-app/**

jobs:
build:
Expand Down Expand Up @@ -29,6 +32,28 @@ jobs:
path: pmm-app/dist/
if-no-files-found: error

unit_tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Run with Node 18
uses: actions/setup-node@v4
with:
node-version: "18"
cache: "yarn"
cache-dependency-path: pmm-app/yarn.lock

- name: Install deps
run: make prepare_release

- name: Run lint
run: cd pmm-app && yarn lint:check

- name: Run unit tests
run: cd pmm-app && yarn test:ci

code_coverage:
needs: build
runs-on: ubuntu-latest
Expand Down Expand Up @@ -57,7 +82,7 @@ jobs:
run: make generate_coverage

workflow_success:
needs: [code_coverage, build]
needs: [unit_tests, code_coverage, build]
name: Slack Notification success
runs-on: ubuntu-latest
env:
Expand All @@ -77,7 +102,7 @@ jobs:

workflow_failure:
if: ${{ failure() }}
needs: [code_coverage, build]
needs: [unit_tests, code_coverage, build]
name: Slack Notification failure
runs-on: ubuntu-latest
env:
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/setup-page.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Setup Page pipeline

on:
pull_request:
paths:
- setup-page/**

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Run with Node 18
uses: actions/setup-node@v4
with:
node-version: "18"
cache: "npm"
cache-dependency-path: setup-page/package-lock.json

- name: Install deps
run: cd setup-page && npm ci

- name: Run lint
run: cd setup-page && npm run lint

- name: Run build
run: cd setup-page && npm run build
10 changes: 5 additions & 5 deletions dashboards/MongoDB/MongoDB_Cluster_Summary.json
Original file line number Diff line number Diff line change
Expand Up @@ -1011,17 +1011,17 @@
"pluginVersion": "8.3.5",
"targets": [
{
"expr": "min(mongodb_mongos_sharding_chunks_is_balanced{cluster=\"$cluster\"})",
"expr": "min(mongodb_mongos_sharding_chunks_is_balancer_running{cluster=\"$cluster\"})",
"format": "time_series",
"interval": "5m",
"intervalFactor": 1,
"legendFormat": "Cluster Balanced",
"legendFormat": "Cluster Balancer is Running",
"refId": "A",
"step": 300
}
],
"timeFrom": "1m",
"title": "Chunks Balanced",
"title": "Chunks Balancer is running",
"type": "stat"
},
{
Expand Down Expand Up @@ -1400,11 +1400,11 @@
"y": 24
},
"type": "state-timeline",
"title": "Chunks Balanced",
"title": "Chunks Balancer is running",
"description": "The MongoDB balancer is a background process that monitors the number of chunks on each shard. When the number of chunks on a given shard reaches specific migration thresholds, the balancer attempts to automatically migrate chunks between shards and reach an equal number of chunks per shard.",
"targets": [
{
"expr": "min(mongodb_mongos_sharding_chunks_is_balanced{cluster=\"$cluster\"})",
"expr": "min(mongodb_mongos_sharding_chunks_is_balancer_running{cluster=\"$cluster\"})",
"interval": "$interval",
"legendFormat": "$cluster",
"refId": "A"
Expand Down
1 change: 1 addition & 0 deletions pmm-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"dev": "webpack -w -c ./.config/webpack/webpack.config.ts --env development",
"jest": "jest",
"lint": "yarn lint:dev",
"lint:check": "eslint --ext .tsx,.ts src/",
"lint:dev": "eslint --ext .tsx,.ts --fix src/",
"lint:fix": "yarn run lint --fix",
"server": "docker-compose up --build",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ jest.mock('shared/components/helpers/notification-manager');
jest.mock('antd/es/tooltip', () => <div className="tooltip" />);

jest.mock('./hooks/useHistogram', () => ({
useHistogram: jest.fn(({ theme }) => (
[getChartDataFromHistogramItems([{ frequency: 6175, range: '(0-3)' }], theme), true]
)),
useHistogram: jest.fn(({ theme }) => [
getChartDataFromHistogramItems([{ frequency: 6175, range: '(0-3)' }], theme),
true,
]),
}));

const originalConsoleError = console.error;
Expand Down Expand Up @@ -2696,6 +2697,10 @@ const panelState = {
describe('useFilters::', () => {
beforeEach(() => {
console.error = jest.fn();
// TODO: Grafana Tooltip component uses a react 18 hook - useId
// due to enzyme we are currently stuck at react 17, mocking for now
// @ts-ignore
React.useId = () => '';
});

afterEach(() => {
Expand All @@ -2717,7 +2722,6 @@ describe('useFilters::', () => {
textMetrics={textMetrics}
loading={false}
/>
,
</QueryAnalyticsProvider.Provider>,
);

Expand All @@ -2731,14 +2735,7 @@ describe('useFilters::', () => {
panelState,
}}
>
<Metrics
databaseType={Databases.mysql}
groupBy="queryid"
totals
metrics={metrics}
loading={false}
/>
,
<Metrics databaseType={Databases.mysql} groupBy="queryid" totals metrics={metrics} loading={false} />
</QueryAnalyticsProvider.Provider>,
);

Expand All @@ -2760,7 +2757,6 @@ describe('useFilters::', () => {
textMetrics={textMetrics}
loading={false}
/>
,
</QueryAnalyticsProvider.Provider>,
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ exports[`TimeDistributionChart chart test Renders correct 1`] = `
<Fragment>
<h
data={
Array [
Object {
[
{
"color": "#BD4848",
"description": "0.08%",
"name": "Lock Time",
"value": 1,
},
Object {
{
"color": "gray",
"description": "99.92%",
"name": "Other",
Expand Down
Loading

0 comments on commit 7c9bac9

Please sign in to comment.