Revert "feat(core): Read ephemeral license from environment and cleanup ee flags (#5797)" (#5816)

Revert "feat(core): Read ephemeral license from environment and clean up ee flags (#5797)"

This reverts commit a81ca7c19c.
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-03-29 18:00:29 +02:00
committed by GitHub
parent 06d7a46bdc
commit be373bb859
19 changed files with 86 additions and 71 deletions

View File

@@ -23,8 +23,6 @@ import { MessageEventBusDestinationWebhook } from '@/eventbus/MessageEventBusDes
import { MessageEventBusDestinationSentry } from '@/eventbus/MessageEventBusDestination/MessageEventBusDestinationSentry.ee';
import { EventMessageAudit } from '@/eventbus/EventMessageClasses/EventMessageAudit';
import { EventNamesTypes } from '@/eventbus/EventMessageClasses';
import Container from 'typedi';
import { License } from '../../src/License';
jest.unmock('@/eventbus/MessageEventBus/MessageEventBus');
jest.mock('axios');
@@ -79,7 +77,6 @@ async function confirmIdSent(id: string) {
}
beforeAll(async () => {
Container.get(License).isLogStreamingEnabled = () => true;
app = await utils.initTestServer({ endpointGroups: ['eventBus'] });
globalOwnerRole = await testDb.getGlobalOwnerRole();
@@ -104,6 +101,7 @@ beforeAll(async () => {
utils.initConfigFile();
config.set('eventBus.logWriter.logBaseName', 'n8n-test-logwriter');
config.set('eventBus.logWriter.keepLogCount', 1);
config.set('enterprise.features.logStreaming', true);
config.set('userManagement.disabled', false);
config.set('userManagement.isInstanceOwnerSetUp', true);
@@ -112,7 +110,6 @@ beforeAll(async () => {
afterAll(async () => {
jest.mock('@/eventbus/MessageEventBus/MessageEventBus');
Container.reset();
await testDb.terminate();
await eventBus.close();
});
@@ -181,6 +178,7 @@ test.skip('should send message to syslog', async () => {
eventName: 'n8n.test.message' as EventNamesTypes,
id: uuid(),
});
config.set('enterprise.features.logStreaming', true);
const syslogDestination = eventBus.destinations[
testSyslogDestination.id!
@@ -221,6 +219,7 @@ test.skip('should confirm send message if there are no subscribers', async () =>
eventName: 'n8n.test.unsub' as EventNamesTypes,
id: uuid(),
});
config.set('enterprise.features.logStreaming', true);
const syslogDestination = eventBus.destinations[
testSyslogDestination.id!
@@ -256,6 +255,7 @@ test('should anonymize audit message to syslog ', async () => {
},
id: uuid(),
});
config.set('enterprise.features.logStreaming', true);
const syslogDestination = eventBus.destinations[
testSyslogDestination.id!
@@ -317,6 +317,7 @@ test('should send message to webhook ', async () => {
eventName: 'n8n.test.message' as EventNamesTypes,
id: uuid(),
});
config.set('enterprise.features.logStreaming', true);
const webhookDestination = eventBus.destinations[
testWebhookDestination.id!
@@ -351,6 +352,7 @@ test('should send message to sentry ', async () => {
eventName: 'n8n.test.message' as EventNamesTypes,
id: uuid(),
});
config.set('enterprise.features.logStreaming', true);
const sentryDestination = eventBus.destinations[
testSentryDestination.id!

View File

@@ -17,8 +17,6 @@ import * as testDb from './../shared/testDb';
import type { AuthAgent } from '../shared/types';
import * as utils from '../shared/utils';
import { getCurrentAuthenticationMethod, setCurrentAuthenticationMethod } from '@/sso/ssoHelpers';
import Container from 'typedi';
import { License } from '../../../src/License';
jest.mock('@/telemetry');
jest.mock('@/UserManagement/email/NodeMailer');
@@ -43,7 +41,6 @@ const defaultLdapConfig = {
};
beforeAll(async () => {
Container.get(License).isLdapEnabled = () => true;
app = await utils.initTestServer({ endpointGroups: ['auth', 'ldap'] });
const [globalOwnerRole, fetchedGlobalMemberRole] = await testDb.getAllRoles();
@@ -80,10 +77,10 @@ beforeEach(async () => {
config.set('userManagement.disabled', false);
config.set('userManagement.isInstanceOwnerSetUp', true);
config.set('userManagement.emails.mode', '');
config.set('enterprise.features.ldap', true);
});
afterAll(async () => {
Container.reset();
await testDb.terminate();
});

View File

@@ -7,25 +7,22 @@ import { randomEmail, randomName, randomValidPassword } from '../shared/random';
import * as testDb from '../shared/testDb';
import * as utils from '../shared/utils';
import { sampleConfig } from './sampleMetadata';
import Container from 'typedi';
import { License } from '../../../src/License';
let owner: User;
let authOwnerAgent: SuperAgentTest;
async function enableSaml(enable: boolean) {
await setSamlLoginEnabled(enable);
config.set('enterprise.features.saml', enable);
}
beforeAll(async () => {
Container.get(License).isSamlEnabled = () => true;
const app = await utils.initTestServer({ endpointGroups: ['me', 'saml'] });
owner = await testDb.createOwner();
authOwnerAgent = utils.createAuthAgent(app)(owner);
});
afterAll(async () => {
Container.reset();
await testDb.terminate();
});

View File

@@ -74,13 +74,13 @@ import { InternalHooks } from '@/InternalHooks';
import { LoadNodesAndCredentials } from '@/LoadNodesAndCredentials';
import { PostHogClient } from '@/posthog';
import { LdapManager } from '@/Ldap/LdapManager.ee';
import { LDAP_ENABLED } from '@/Ldap/constants';
import { handleLdapInit } from '@/Ldap/helpers';
import { Push } from '@/push';
import { setSamlLoginEnabled } from '@/sso/saml/samlHelpers';
import { SamlService } from '@/sso/saml/saml.service.ee';
import { SamlController } from '@/sso/saml/routes/saml.controller.ee';
import { EventBusController } from '@/eventbus/eventBus.controller';
import { License } from '../../../src/License';
export const mockInstance = <T>(
ctor: new (...args: any[]) => T,
@@ -186,7 +186,7 @@ export async function initTestServer({
);
break;
case 'ldap':
Container.get(License).isLdapEnabled = () => true;
config.set(LDAP_ENABLED, true);
await handleLdapInit();
const { service, sync } = LdapManager.getInstance();
registerController(

View File

@@ -12,8 +12,6 @@ import { createWorkflow } from './shared/testDb';
import type { SaveCredentialFunction } from './shared/types';
import { makeWorkflow } from './shared/utils';
import { randomCredentialPayload } from './shared/random';
import Container from 'typedi';
import { License } from '../../src/License';
let owner: User;
let member: User;
@@ -25,7 +23,6 @@ let saveCredential: SaveCredentialFunction;
let sharingSpy: jest.SpyInstance<boolean>;
beforeAll(async () => {
Container.get(License).isSharingEnabled = () => true;
const app = await utils.initTestServer({ endpointGroups: ['workflows'] });
const globalOwnerRole = await testDb.getGlobalOwnerRole();
@@ -45,6 +42,8 @@ beforeAll(async () => {
sharingSpy = jest.spyOn(UserManagementHelpers, 'isSharingEnabled').mockReturnValue(true);
await utils.initNodeTypes();
config.set('enterprise.features.sharing', true);
});
beforeEach(async () => {
@@ -52,7 +51,6 @@ beforeEach(async () => {
});
afterAll(async () => {
Container.reset();
await testDb.terminate();
});