mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
refactor(core): Port endpoints config (no-changelog) (#10268)
This commit is contained in:
@@ -2,17 +2,48 @@ import { Container } from 'typedi';
|
||||
import { parse as semverParse } from 'semver';
|
||||
import request, { type Response } from 'supertest';
|
||||
|
||||
import config from '@/config';
|
||||
import { N8N_VERSION } from '@/constants';
|
||||
import { PrometheusMetricsService } from '@/metrics/prometheus-metrics.service';
|
||||
import { setupTestServer } from './shared/utils';
|
||||
import { mockInstance } from '@test/mocking';
|
||||
import { GlobalConfig } from '@n8n/config';
|
||||
|
||||
jest.unmock('@/eventbus/MessageEventBus/MessageEventBus');
|
||||
|
||||
const toLines = (response: Response) => response.text.trim().split('\n');
|
||||
|
||||
config.set('endpoints.metrics.enable', true);
|
||||
config.set('endpoints.metrics.prefix', 'n8n_test_');
|
||||
mockInstance(GlobalConfig, {
|
||||
database: {
|
||||
type: 'sqlite',
|
||||
sqlite: {
|
||||
database: 'database.sqlite',
|
||||
enableWAL: false,
|
||||
executeVacuumOnStartup: false,
|
||||
poolSize: 0,
|
||||
},
|
||||
logging: {
|
||||
enabled: false,
|
||||
maxQueryExecutionTime: 0,
|
||||
options: 'error',
|
||||
},
|
||||
tablePrefix: '',
|
||||
},
|
||||
endpoints: {
|
||||
metrics: {
|
||||
prefix: 'n8n_test_',
|
||||
includeDefaultMetrics: true,
|
||||
includeApiEndpoints: true,
|
||||
includeCacheMetrics: true,
|
||||
includeMessageEventBusMetrics: true,
|
||||
includeCredentialTypeLabel: false,
|
||||
includeNodeTypeLabel: false,
|
||||
includeWorkflowIdLabel: false,
|
||||
includeApiPathLabel: true,
|
||||
includeApiMethodLabel: true,
|
||||
includeApiStatusCodeLabel: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const server = setupTestServer({ endpointGroups: ['metrics'] });
|
||||
const agent = request.agent(server.app);
|
||||
|
||||
Reference in New Issue
Block a user