ci: Fix DB tests (no-changelog) (#10282)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2024-08-02 12:20:34 +02:00 committed by GitHub
parent 84efbd9b9c
commit 47a68b0220
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5,45 +5,27 @@ import request, { type Response } from 'supertest';
import { N8N_VERSION } from '@/constants'; import { N8N_VERSION } from '@/constants';
import { PrometheusMetricsService } from '@/metrics/prometheus-metrics.service'; import { PrometheusMetricsService } from '@/metrics/prometheus-metrics.service';
import { setupTestServer } from './shared/utils'; import { setupTestServer } from './shared/utils';
import { mockInstance } from '@test/mocking';
import { GlobalConfig } from '@n8n/config'; import { GlobalConfig } from '@n8n/config';
jest.unmock('@/eventbus/MessageEventBus/MessageEventBus'); jest.unmock('@/eventbus/MessageEventBus/MessageEventBus');
const toLines = (response: Response) => response.text.trim().split('\n'); const toLines = (response: Response) => response.text.trim().split('\n');
mockInstance(GlobalConfig, { const globalConfig = Container.get(GlobalConfig);
database: { // @ts-expect-error `metrics` is a readonly property
type: 'sqlite', globalConfig.endpoints.metrics = {
sqlite: { prefix: 'n8n_test_',
database: 'database.sqlite', includeDefaultMetrics: true,
enableWAL: false, includeApiEndpoints: true,
executeVacuumOnStartup: false, includeCacheMetrics: true,
poolSize: 0, includeMessageEventBusMetrics: true,
}, includeCredentialTypeLabel: false,
logging: { includeNodeTypeLabel: false,
enabled: false, includeWorkflowIdLabel: false,
maxQueryExecutionTime: 0, includeApiPathLabel: true,
options: 'error', includeApiMethodLabel: true,
}, includeApiStatusCodeLabel: true,
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 server = setupTestServer({ endpointGroups: ['metrics'] });
const agent = request.agent(server.app); const agent = request.agent(server.app);