feat(core): Add secrets provider reload and refactor (#7277)
This PR adds a message for queue mode which triggers an external secrets provider reload inside the workers if the configuration has changed on the main instance. It also refactors some of the message handler code to remove cyclic dependencies, as well as remove unnecessary duplicate redis clients inside services (thanks to no more cyclic deps)
This commit is contained in:
committed by
GitHub
parent
a80abad3af
commit
53a7502d20
@@ -9,8 +9,10 @@ import { RedisService } from '@/services/redis.service';
|
||||
import { mockInstance } from '../../integration/shared/utils';
|
||||
import { handleWorkerResponseMessage } from '../../../src/services/orchestration/handleWorkerResponseMessage';
|
||||
import { handleCommandMessage } from '../../../src/services/orchestration/handleCommandMessage';
|
||||
import { OrchestrationHandlerService } from '../../../src/services/orchestration.handler.service';
|
||||
|
||||
const os = Container.get(OrchestrationService);
|
||||
const handler = Container.get(OrchestrationHandlerService);
|
||||
|
||||
let queueModeId: string;
|
||||
|
||||
@@ -76,8 +78,9 @@ describe('Orchestration Service', () => {
|
||||
|
||||
test('should initialize', async () => {
|
||||
await os.init();
|
||||
await handler.init();
|
||||
expect(os.redisPublisher).toBeDefined();
|
||||
expect(os.redisSubscriber).toBeDefined();
|
||||
expect(handler.redisSubscriber).toBeDefined();
|
||||
expect(queueModeId).toBeDefined();
|
||||
});
|
||||
|
||||
@@ -89,7 +92,7 @@ describe('Orchestration Service', () => {
|
||||
});
|
||||
|
||||
test('should handle command messages from others', async () => {
|
||||
jest.spyOn(LoggerProxy, 'warn');
|
||||
jest.spyOn(LoggerProxy, 'error');
|
||||
const responseFalseId = await handleCommandMessage(
|
||||
JSON.stringify({
|
||||
senderId: 'test',
|
||||
@@ -99,8 +102,8 @@ describe('Orchestration Service', () => {
|
||||
expect(responseFalseId).toBeDefined();
|
||||
expect(responseFalseId!.command).toEqual('reloadLicense');
|
||||
expect(responseFalseId!.senderId).toEqual('test');
|
||||
expect(LoggerProxy.warn).toHaveBeenCalled();
|
||||
jest.spyOn(LoggerProxy, 'warn').mockRestore();
|
||||
expect(LoggerProxy.error).toHaveBeenCalled();
|
||||
jest.spyOn(LoggerProxy, 'error').mockRestore();
|
||||
});
|
||||
|
||||
test('should reject command messages from iteslf', async () => {
|
||||
|
||||
Reference in New Issue
Block a user