Loki: Decouple unit tests from core (#108917)

* Loki: Decouple tests

* Fix flaky tests

* Add maxParallel 2 for plugin tests
This commit is contained in:
Ivana Huckova
2025-07-31 10:20:28 +02:00
committed by GitHub
parent 6809df5427
commit b11509fea2
7 changed files with 15 additions and 4 deletions
+1
View File
@@ -83,6 +83,7 @@ module.exports = {
'<rootDir>/public/app/plugins/datasource/grafana-pyroscope-datasource',
'<rootDir>/public/app/plugins/datasource/grafana-testdata-datasource',
'<rootDir>/public/app/plugins/datasource/jaeger',
'<rootDir>/public/app/plugins/datasource/loki',
'<rootDir>/public/app/plugins/datasource/mysql',
'<rootDir>/public/app/plugins/datasource/parca',
'<rootDir>/public/app/plugins/datasource/tempo',
+1 -1
View File
@@ -68,7 +68,7 @@
"plugin:build": "nx run-many -t build --projects='tag:scope:plugin'",
"plugin:build:commit": "nx run-many -t build:commit --projects='tag:scope:plugin'",
"plugin:build:dev": "nx run-many -t dev --projects='tag:scope:plugin' --maxParallel=100",
"plugin:test:ci": "nx run-many -t test:ci --projects='tag:scope:plugin'",
"plugin:test:ci": "nx run-many -t test:ci --projects='tag:scope:plugin' --maxParallel=2",
"plugin:i18n-extract": "nx run-many -t i18n-extract --projects='tag:scope:plugin'",
"process-specs": "node --experimental-strip-types scripts/process-specs.ts",
"generate-apis": "yarn process-specs && rtk-query-codegen-openapi ./scripts/generate-rtk-apis.ts",
@@ -761,7 +761,8 @@ describe('Query imports', () => {
maxLines: DEFAULT_MAX_LINES_SAMPLE,
refId: 'data-samples',
},
languageProvider.getDefaultTimeRange()
// We are not interested in the time range here
expect.any(Object)
);
});
@@ -782,7 +783,8 @@ describe('Query imports', () => {
maxLines: 5,
refId: 'data-samples',
},
languageProvider.getDefaultTimeRange()
// We are not interested in the time range here
expect.any(Object)
);
});
@@ -0,0 +1 @@
import '@grafana/plugin-configs/jest/jest-setup';
@@ -0,0 +1,3 @@
import defaultConfig from '@grafana/plugin-configs/jest/jest.config.js';
export default defaultConfig;
@@ -37,6 +37,7 @@
"@types/react": "18.3.18",
"@types/react-dom": "18.3.5",
"@types/uuid": "10.0.0",
"jest": "29.7.0",
"ts-node": "10.9.2",
"typescript": "5.7.3",
"webpack": "5.97.1"
@@ -47,7 +48,9 @@
"scripts": {
"build": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -c ./webpack.config.ts --env production",
"build:commit": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -c ./webpack.config.ts --env production --env commit=$(git rev-parse --short HEAD)",
"dev": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -w -c ./webpack.config.ts --env development"
"dev": "NODE_OPTIONS='--experimental-strip-types --no-warnings=ExperimentalWarning' webpack -w -c ./webpack.config.ts --env development",
"test": "jest --watch --onlyChanged",
"test:ci": "jest --maxWorkers 4"
},
"packageManager": "yarn@4.9.2"
}
+1
View File
@@ -2771,6 +2771,7 @@ __metadata:
"@types/react-dom": "npm:18.3.5"
"@types/uuid": "npm:10.0.0"
d3-random: "npm:^3.0.1"
jest: "npm:29.7.0"
lodash: "npm:4.17.21"
micro-memoize: "npm:^4.1.2"
react: "npm:18.3.1"