Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisronline committed Sep 13, 2021
1 parent 6c82b11 commit e709483
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
42 changes: 42 additions & 0 deletions x-pack/plugins/task_manager/server/plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,48 @@ describe('TaskManagerPlugin', () => {
`"Cannot register task definitions after the task manager has started"`
);
});

test('it logs a warning when the unsafe `exclude_task_types` config is used', async () => {
const pluginInitializerContext = coreMock.createPluginInitializerContext<TaskManagerConfig>({
enabled: true,
max_workers: 10,
index: 'foo',
max_attempts: 9,
poll_interval: 3000,
version_conflict_threshold: 80,
max_poll_inactivity_cycles: 10,
request_capacity: 1000,
monitored_aggregated_stats_refresh_rate: 5000,
monitored_stats_health_verbose_log: {
enabled: false,
warn_delayed_task_start_in_seconds: 60,
},
monitored_stats_required_freshness: 5000,
monitored_stats_running_average_window: 50,
monitored_task_execution_thresholds: {
default: {
error_threshold: 90,
warn_threshold: 80,
},
custom: {},
},
ephemeral_tasks: {
enabled: false,
request_capacity: 10,
},
unsafe: {
exclude_task_types: ['*'],
},
});

const logger = pluginInitializerContext.logger.get();
const taskManagerPlugin = new TaskManagerPlugin(pluginInitializerContext);
taskManagerPlugin.setup(coreMock.createSetup(), { usageCollection: undefined });
expect((logger.warn as jest.Mock).mock.calls.length).toBe(1);
expect((logger.warn as jest.Mock).mock.calls[0][0]).toBe(
'Excluding task types from execution: *'
);
});
});

describe('getElasticsearchAndSOAvailability', () => {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/task_manager/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export class TaskManagerPlugin
}

if (this.config.unsafe.exclude_task_types.length) {
this.logger.debug(
this.logger.warn(
`Excluding task types from execution: ${this.config.unsafe.exclude_task_types.join(', ')}`
);
}
Expand Down

0 comments on commit e709483

Please sign in to comment.