From f97965331398b89f4c08987962d698785745d97a Mon Sep 17 00:00:00 2001 From: razbroc Date: Wed, 30 Oct 2024 15:49:32 +0200 Subject: [PATCH 1/7] refactor: change jobManagemnt to new jobDefentions --- config/custom-environment-variables.json | 20 +++++++++++++++----- helm/templates/_tplValues.tpl | 4 ++-- helm/templates/configmap.yaml | 12 +++++++----- helm/values.yaml | 22 ++++++++++------------ 4 files changed, 34 insertions(+), 24 deletions(-) diff --git a/config/custom-environment-variables.json b/config/custom-environment-variables.json index fe56c66..0d9aba0 100644 --- a/config/custom-environment-variables.json +++ b/config/custom-environment-variables.json @@ -33,6 +33,21 @@ "limit": "REQUEST_PAYLOAD_LIMIT" } }, + "jobDefinitions": { + "tasks": { + "export": { + "type": "EXPORT_JOB_TYPE" + } + }, + "jobs": { + "export": { + "type": "TILES_TASK_TYPE" + }, + "finalize": { + "type": "FINALIZE_TASK_TYPE" + } + } + }, "response": { "compression": { "enabled": { @@ -96,11 +111,6 @@ } } }, - "exportJobAndTaskTypes": { - "jobType": "EXPORT_JOB_TYPE", - "taskTilesType": "TILES_TASK_TYPE", - "taskFinalizeType": "FINALIZE_TASK_TYPE" - }, "httpRetry": { "attempts": { "__name": "HTTP_RETRY_ATTEMPTS", diff --git a/helm/templates/_tplValues.tpl b/helm/templates/_tplValues.tpl index bdd0cb8..8cd0497 100644 --- a/helm/templates/_tplValues.tpl +++ b/helm/templates/_tplValues.tpl @@ -57,8 +57,8 @@ Custom definitions {{- include "common.tplvalues.merge" ( dict "values" ( list .Values.serviceUrls .Values.global.serviceUrls ) "context" . ) }} {{- end -}} -{{- define "common.jobManagement.merged" -}} -{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.jobManagement .Values.global.jobManagement ) "context" . ) }} +{{- define "common.jobDefinitions.merged" -}} +{{- include "common.tplvalues.merge" ( dict "values" ( list .Values.jobDefinitions .Values.global.jobDefinitions ) "context" . ) }} {{- end -}} {{- define "common.ingestion.merged" -}} diff --git a/helm/templates/configmap.yaml b/helm/templates/configmap.yaml index 3261b03..c41fe94 100644 --- a/helm/templates/configmap.yaml +++ b/helm/templates/configmap.yaml @@ -2,9 +2,11 @@ {{- $tracing := (include "common.tracing.merged" .) | fromYaml }} {{- $metrics := (include "common.metrics.merged" .) | fromYaml }} {{- $serviceUrls := (include "common.serviceUrls.merged" .) | fromYaml }} -{{- $jobManagement := (include "common.jobManagement.merged" .) | fromYaml }} {{- $storage := (include "common.storage.merged" .) | fromYaml }} {{- $configmapName := include "configmap.fullname" . }} +{{- $jobDefinitions := (include "common.jobDefinitions.merged" .) | fromYaml }} + + {{- if .Values.enabled -}} apiVersion: v1 kind: ConfigMap @@ -26,9 +28,9 @@ data: JOB_MANAGER_URL: {{ $serviceUrls.jobManager | quote }} CLEANUP_EXPIRATION_DAYS: {{ .Values.env.cleanupExpirationDays | quote }} RASTER_CATALOG_MANAGER_URL: {{ $serviceUrls.catalogManager | quote }} - JOB_DOMAIN: {{ $jobManagement.jobDomain | quote }} - EXPORT_JOB_TYPE: {{ $jobManagement.exporter.jobType | quote }} - TILES_TASK_TYPE: {{ $jobManagement.exporter.taskTilesType | quote }} + JOB_DOMAIN: {{ .Values.global.domain | quote }} + EXPORT_JOB_TYPE: {{ $jobDefinitions.jobs.export.type | quote }} + TILES_TASK_TYPE: {{ $jobDefinitions.tasks.export.type | quote }} HTTP_RETRY_ATTEMPTS: {{ .Values.env.httpRetry.attempts | quote }} HTTP_RETRY_DELAY: {{ .Values.env.httpRetry.delay | quote }} HTTP_RETRY_SHOULD_RESET_TIMEOUT: {{ .Values.env.httpRetry.shouldResetTimeout | quote }} @@ -44,6 +46,6 @@ data: QUEUE_HEART_BEAT_MANAGER_BASE_URL: {{ $serviceUrls.heartbeatManager | quote }} QUEUE_DEQUEUE_FINALIZE_INTERVAL_MS: {{ .Values.env.queue.dequeueFinalizeIntervalMs | quote }} QUEUE_HEART_BEAT_INTERVAL_MS: {{ .Values.env.queue.heartbeatIntervalMs | quote }} - FINALIZE_TASK_TYPE: {{ $jobManagement.exporter.taskFinalizeType | quote }} + FINALIZE_TASK_TYPE: {{ $jobDefinitions.tasks.finalize.type | quote }} FINALIZE_TASKS_ATTEMPTS: {{ .Values.env.queue.finalizeTasksAttempts | quote }} {{- end }} diff --git a/helm/values.yaml b/helm/values.yaml index 61762fe..282c395 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -8,12 +8,6 @@ global: heartbeatManager: "" jobManager: "" downloadServerPublicDNS: "" - jobManagement: - jobDomain: "" - exporter: - jobType: "" - taskTilesType: "" - taskFinalizeType: "" storage: tilesStorageProvider: "" fs: @@ -24,17 +18,21 @@ global: ingress: domain: 'apps.aroapp.io' +jobDefinitions: + jobs: + export: + type: "" + tasks: + export: + type: "" + finalize: + type: "" + serviceUrls: catalogManager: "" heartbeatManager: "" jobManager: "" downloadServerPublicDNS: "" -jobManagement: - jobDomain: RASTER - exporter: - jobType: "" - taskTilesType: "" - taskFinalizeType: "" storage: tilesStorageProvider: '' fs: From 176e39c3701b0fa3ba1ed33ec6e9e537a9d24037 Mon Sep 17 00:00:00 2001 From: razbroc Date: Wed, 30 Oct 2024 15:52:29 +0200 Subject: [PATCH 2/7] feat: pr flow to v2 --- .github/workflows/pull_request.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index 63d6fb6..69dcebc 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -4,5 +4,5 @@ on: [pull_request] jobs: pull_request: - uses: MapColonies/shared-workflows/.github/workflows/pull_request.yaml@v1 + uses: MapColonies/shared-workflows/.github/workflows/pull_request.yaml@v2 secrets: inherit From 268af101809228193fbe0f0b964ccf88b85df7e8 Mon Sep 17 00:00:00 2001 From: razbroc Date: Wed, 30 Oct 2024 18:11:44 +0200 Subject: [PATCH 3/7] helm: configuration --- config/custom-environment-variables.json | 30 ++++++++++++------------ helm/values.yaml | 4 +++- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/config/custom-environment-variables.json b/config/custom-environment-variables.json index 0d9aba0..f20a89e 100644 --- a/config/custom-environment-variables.json +++ b/config/custom-environment-variables.json @@ -33,21 +33,6 @@ "limit": "REQUEST_PAYLOAD_LIMIT" } }, - "jobDefinitions": { - "tasks": { - "export": { - "type": "EXPORT_JOB_TYPE" - } - }, - "jobs": { - "export": { - "type": "TILES_TASK_TYPE" - }, - "finalize": { - "type": "FINALIZE_TASK_TYPE" - } - } - }, "response": { "compression": { "enabled": { @@ -57,6 +42,21 @@ } } }, + "jobDefinitions": { + "tasks": { + "export": { + "type": "EXPORT_JOB_TYPE" + } + }, + "jobs": { + "export": { + "type": "TILES_TASK_TYPE" + }, + "finalize": { + "type": "FINALIZE_TASK_TYPE" + } + } + }, "storageEstimation": { "jpegTileEstimatedSizeInBytes": { "__name": "JPEG_TILE_ESTIMATED_SIZE_IN_BYTES", diff --git a/helm/values.yaml b/helm/values.yaml index 282c395..8500509 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -16,7 +16,9 @@ global: name: "" gpkgSubPath: "" ingress: - domain: 'apps.aroapp.io' + domain: 'apps.aroapp.io' + jobDefinitions: {} + domain: '' jobDefinitions: jobs: From 6ed6bc9e884af61a713678ccbd8434517cde1c06 Mon Sep 17 00:00:00 2001 From: razbroc Date: Wed, 30 Oct 2024 18:44:37 +0200 Subject: [PATCH 4/7] refactor: all pointers to JobDefenitions --- config/custom-environment-variables.json | 2 +- config/default.json | 26 +++++++++++++------ src/clients/jobManagerWrapper.ts | 8 +++--- src/common/interfaces.ts | 16 +++++++----- src/containerConfig.ts | 7 ++--- src/finalizationManager.ts | 2 +- src/tasks/models/tasksManager.ts | 2 +- tests/integration/createPackage/tasks.spec.ts | 2 +- tests/integration/testContainerConfig.ts | 7 ++--- tests/mocks/config.ts | 22 +++++++++++----- tests/mocks/data.ts | 12 ++++----- tests/mocks/data/mockJob.ts | 2 +- tests/unit/clients/jobManagerClient.spec.ts | 4 +-- .../createPackage/models/tasksModel.spec.ts | 6 ++--- 14 files changed, 72 insertions(+), 46 deletions(-) diff --git a/config/custom-environment-variables.json b/config/custom-environment-variables.json index f20a89e..7ec9f6c 100644 --- a/config/custom-environment-variables.json +++ b/config/custom-environment-variables.json @@ -1,4 +1,5 @@ { + "domain": "JOB_DOMAIN", "openapiConfig": { "filePath": "OPENAPI_FILE_PATH" }, @@ -90,7 +91,6 @@ "clientsUrls": { "jobManager": { "url": "JOB_MANAGER_URL", - "jobDomain": "JOB_DOMAIN", "dequeueFinalizeIntervalMs": { "__name": "QUEUE_DEQUEUE_FINALIZE_INTERVAL_MS", "__format": "number" diff --git a/config/default.json b/config/default.json index 910027b..50d2214 100644 --- a/config/default.json +++ b/config/default.json @@ -1,4 +1,5 @@ { + "domain": "RASTER", "openapiConfig": { "filePath": "./openapi3.yaml", "basePath": "/docs", @@ -45,7 +46,6 @@ "clientsUrls": { "jobManager": { "url": "http://job-manager-job-manager", - "jobDomain": "RASTER", "dequeueFinalizeIntervalMs": 1000, "finalizeTasksAttempts": 5 }, @@ -57,11 +57,6 @@ "heartbeatIntervalMs": 300 } }, - "exportJobAndTaskTypes": { - "jobType": "rasterTilesExporter", - "taskTilesType": "rasterTilesExporter", - "taskFinalizeType": "rasterFinalizeExporter" - }, "httpRetry": { "attempts": 5, "delay": "exponential", @@ -72,5 +67,20 @@ "tilesProvider": "S3", "gpkgsLocation": "/app/tiles_outputs/gpkgs", "downloadServerUrl": "http://download-service", - "finalizePollingTimeMS": 2000 -} + "finalizePollingTimeMS": 2000, + "jobDefinitions": { + "tasks": { + "export": { + "type": "export" + }, + "finalize": { + "type": "finalize" + } + }, + "jobs": { + "export": { + "type": "Export" + } + } + } +} \ No newline at end of file diff --git a/src/clients/jobManagerWrapper.ts b/src/clients/jobManagerWrapper.ts index 257183b..e55aa03 100644 --- a/src/clients/jobManagerWrapper.ts +++ b/src/clients/jobManagerWrapper.ts @@ -27,16 +27,16 @@ export class JobManagerWrapper extends JobManagerClient { public constructor(@inject(SERVICES.LOGGER) protected readonly logger: Logger, @inject(SERVICES.TRACER) public readonly tracer: Tracer) { super( logger, - config.get('externalClientsConfig.exportJobAndTaskTypes.jobType'), + config.get('jobDefinitions.jobs.export.type'), config.get('externalClientsConfig.clientsUrls.jobManager.url'), config.get('externalClientsConfig.httpRetry'), 'jobManagerClient', config.get('externalClientsConfig.disableHttpClientLogs') ); this.expirationDays = config.get('cleanupExpirationDays'); - this.tilesJobType = config.get('externalClientsConfig.exportJobAndTaskTypes.jobType'); - this.tilesTaskType = config.get('externalClientsConfig.exportJobAndTaskTypes.taskTilesType'); - this.jobDomain = config.get('externalClientsConfig.clientsUrls.jobManager.jobDomain'); + this.tilesJobType = config.get('jobDefinitions.jobs.export.type'); + this.tilesTaskType = config.get('jobDefinitions.tasks.export.type'); + this.jobDomain = config.get('domain'); } @withSpanAsyncV4 diff --git a/src/common/interfaces.ts b/src/common/interfaces.ts index 7791af5..73e72ff 100644 --- a/src/common/interfaces.ts +++ b/src/common/interfaces.ts @@ -201,7 +201,7 @@ export interface IJobManager extends IClientBase { dequeueFinalizeIntervalMs: number; } -export interface IRasterCatalogManager extends IClientBase {} +export interface IRasterCatalogManager extends IClientBase { } export interface IHeartbeatManager extends IClientBase { heartbeatIntervalMs: number; @@ -214,11 +214,15 @@ export interface IExternalClientsConfig { heartbeatManager: IHeartbeatManager; finalizeTasksAttempts: number; }; - exportJobAndTaskTypes: { - jobType: string; - taskTilesType: string; - taskFinalizeType: string; - }; httpRetry: IHttpRetryConfig; disableHttpClientLogs: boolean; } + +export interface IJobDefinitions { + jobs: { + export: { type: string } + }; + tasks: { + export: { type: string } + }; +} \ No newline at end of file diff --git a/src/containerConfig.ts b/src/containerConfig.ts index b7bb867..011da50 100644 --- a/src/containerConfig.ts +++ b/src/containerConfig.ts @@ -9,7 +9,7 @@ import { createPackageRouterFactory, CREATE_PACKAGE_ROUTER_SYMBOL } from './crea import { InjectionObject, registerDependencies } from './common/dependencyRegistration'; import { tasksRouterFactory, TASKS_ROUTER_SYMBOL } from './tasks/routes/tasksRouter'; import { FinalizationManager, FINALIZATION_MANGER_SYMBOL } from './finalizationManager'; -import { IQueueConfig, IExternalClientsConfig } from './common/interfaces'; +import { IQueueConfig, IExternalClientsConfig, IJobDefinitions } from './common/interfaces'; import { storageRouterFactory, STORAGE_ROUTER_SYMBOL } from './storage/routes/storageRouter'; export interface RegisterOptions { @@ -20,13 +20,14 @@ export interface RegisterOptions { export const registerExternalValues = (options?: RegisterOptions): DependencyContainer => { const loggerConfig = config.get('telemetry.logger'); const externalClientsConfig = config.get('externalClientsConfig'); + const jobDefinitionsConfig = config.get('jobDefinitions'); const queueConfig: IQueueConfig = { jobManagerBaseUrl: externalClientsConfig.clientsUrls.jobManager.url, heartbeatManagerBaseUrl: externalClientsConfig.clientsUrls.heartbeatManager.url, dequeueFinalizeIntervalMs: externalClientsConfig.clientsUrls.jobManager.dequeueFinalizeIntervalMs, heartbeatIntervalMs: externalClientsConfig.clientsUrls.heartbeatManager.heartbeatIntervalMs, - jobType: externalClientsConfig.exportJobAndTaskTypes.jobType, - tilesTaskType: externalClientsConfig.exportJobAndTaskTypes.taskFinalizeType, + jobType: jobDefinitionsConfig.jobs.export.type, + tilesTaskType: jobDefinitionsConfig.tasks.export.type, }; // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const logger = jsLogger({ ...loggerConfig, prettyPrint: loggerConfig.prettyPrint, hooks: { logMethod } }); diff --git a/src/finalizationManager.ts b/src/finalizationManager.ts index e8ef4ee..50d173b 100644 --- a/src/finalizationManager.ts +++ b/src/finalizationManager.ts @@ -29,7 +29,7 @@ export class FinalizationManager { @inject(JobManagerWrapper) private readonly jobManagerClient: JobManagerWrapper ) { this.expirationDays = config.get('cleanupExpirationDays'); - this.finalizeTaskType = config.get('externalClientsConfig.exportJobAndTaskTypes.taskFinalizeType'); + this.finalizeTaskType = config.get('jobDefinitions.tasks.finalize.type'); this.finalizeAttempts = config.get('externalClientsConfig.clientsUrls.jobManager.finalizeTasksAttempts'); } diff --git a/src/tasks/models/tasksManager.ts b/src/tasks/models/tasksManager.ts index 74b9d39..ee48078 100644 --- a/src/tasks/models/tasksManager.ts +++ b/src/tasks/models/tasksManager.ts @@ -45,7 +45,7 @@ export class TasksManager { ) { this.gpkgsLocation = config.get('gpkgsLocation'); this.downloadServerUrl = config.get('downloadServerUrl'); - this.tilesJobType = config.get('externalClientsConfig.exportJobAndTaskTypes.jobType'); + this.tilesJobType = config.get('jobDefinitions.jobs.export.type'); } @withSpanAsyncV4 diff --git a/tests/integration/createPackage/tasks.spec.ts b/tests/integration/createPackage/tasks.spec.ts index 1312410..877cbb1 100644 --- a/tests/integration/createPackage/tasks.spec.ts +++ b/tests/integration/createPackage/tasks.spec.ts @@ -36,7 +36,7 @@ describe('tasks', function () { { id: '0a5552f7-01eb-40af-a912-eed8fa9e1561', jobId: '0a5552f7-01eb-40af-a912-eed8fa9e1568', - type: 'rasterTilesExporterd', + type: 'export', description: '', parameters: {} as unknown as ITaskParameters, status: OperationStatus.IN_PROGRESS, diff --git a/tests/integration/testContainerConfig.ts b/tests/integration/testContainerConfig.ts index c454b84..d0ef256 100644 --- a/tests/integration/testContainerConfig.ts +++ b/tests/integration/testContainerConfig.ts @@ -4,18 +4,19 @@ import { container } from 'tsyringe'; import { SERVICES } from '../../src/common/constants'; import { configMock, registerDefaultConfig, getMock, hasMock } from '../mocks/config'; import { InjectionObject } from '../../src/common/dependencyRegistration'; -import { IExternalClientsConfig, IQueueConfig } from '../../src/common/interfaces'; +import { IExternalClientsConfig, IJobDefinitions, IQueueConfig } from '../../src/common/interfaces'; function getContainerConfig(): InjectionObject[] { registerDefaultConfig(); const externalClientsConfig = configMock.get('externalClientsConfig'); + const jobDefinitionsConfig = configMock.get('jobDefinitions'); const queueConfig: IQueueConfig = { jobManagerBaseUrl: externalClientsConfig.clientsUrls.jobManager.url, heartbeatManagerBaseUrl: externalClientsConfig.clientsUrls.heartbeatManager.url, dequeueFinalizeIntervalMs: externalClientsConfig.clientsUrls.jobManager.dequeueFinalizeIntervalMs, heartbeatIntervalMs: externalClientsConfig.clientsUrls.heartbeatManager.heartbeatIntervalMs, - jobType: externalClientsConfig.exportJobAndTaskTypes.jobType, - tilesTaskType: externalClientsConfig.exportJobAndTaskTypes.taskFinalizeType, + jobType: jobDefinitionsConfig.jobs.export.type, + tilesTaskType: jobDefinitionsConfig.tasks.export.type, }; const testTracer = trace.getTracer('testTracer'); diff --git a/tests/mocks/config.ts b/tests/mocks/config.ts index 61917b2..a87075b 100644 --- a/tests/mocks/config.ts +++ b/tests/mocks/config.ts @@ -20,6 +20,7 @@ const setConfigValues = (values: Record): void => { const registerDefaultConfig = (): void => { const config = { + domain: "RASTER", openapiConfig: { filePath: './openapi3.yaml', basePath: '/docs', @@ -65,7 +66,6 @@ const registerDefaultConfig = (): void => { clientsUrls: { jobManager: { url: 'http://raster-catalog-manager', - jobDomain: 'RASTER', dequeueFinalizeIntervalMs: 1000, finalizeTasksAttempts: 5, }, @@ -77,11 +77,6 @@ const registerDefaultConfig = (): void => { heartbeatIntervalMs: 300, }, }, - exportJobAndTaskTypes: { - jobType: 'rasterTilesExporter', - taskTilesType: 'rasterTilesExporter', - taskFinalizeType: 'rasterTilesExporter', - }, httpRetry: { attempts: 5, delay: 'exponential', @@ -89,6 +84,21 @@ const registerDefaultConfig = (): void => { }, disableHttpClientLogs: false, }, + jobDefinitions: { + tasks: { + export: { + type: 'export' + }, + finalize: { + type: 'finalize' + } + }, + jobs: { + export: { + type: 'Export' + } + } + } }; setConfigValues(config); }; diff --git a/tests/mocks/data.ts b/tests/mocks/data.ts index e47e2b7..8a0030d 100644 --- a/tests/mocks/data.ts +++ b/tests/mocks/data.ts @@ -493,7 +493,7 @@ const completedExportJob: IJobResponse = id: 'afbdd5e6-25db-4567-a81f-71e0e7d30761', resourceId: 'string_completed', version: '1.0', - type: 'rasterTilesExporter', + type: 'Export', domain: 'testDomain', description: '', parameters: { @@ -549,7 +549,7 @@ const completedExportJob: IJobResponse = { id: '542ebbfd-f4d1-4c77-bd4d-97ca121f0de7', jobId: 'b0b19b88-aecb-4e74-b694-dfa7eada8bf7', - type: 'rasterTilesExporter', + type: 'export', description: '', parameters: { isNewTarget: true, @@ -575,7 +575,7 @@ const inProgressExportJob: IJobResponse = domain: 'testDomain', resourceId: 'string_inprogress', version: '1.0', - type: 'rasterTilesExporter', + type: 'Export', percentage: 0, description: '', parameters: { @@ -608,7 +608,7 @@ const inProgressExportJob: IJobResponse = { id: '1f765695-338b-4752-b182-a8cbae3c610e', jobId: 'b0b19b88-aecb-4e74-b694-dfa7eada8bf7', - type: 'rasterTilesExporter', + type: 'export', description: '', parameters: { isNewTarget: true, @@ -908,10 +908,10 @@ const jobPayloadWithMixedForFixedStrategyCheck = { ], targetFormat: undefined, }, - type: 'rasterTilesExporter', + type: 'export', }, ], - type: 'rasterTilesExporter', + type: 'Export', version: '1.0', }; diff --git a/tests/mocks/data/mockJob.ts b/tests/mocks/data/mockJob.ts index f75ec82..b816102 100644 --- a/tests/mocks/data/mockJob.ts +++ b/tests/mocks/data/mockJob.ts @@ -8,7 +8,7 @@ export const mockCompletedJob: JobFinalizeResponse = { resourceId: 'testCompleted', domain: 'testDomain', version: '1.0', - type: 'rasterTilesExporter', + type: 'Export', description: 'test job', parameters: { crs: 'EPSG:4326', diff --git a/tests/unit/clients/jobManagerClient.spec.ts b/tests/unit/clients/jobManagerClient.spec.ts index 5f1d75e..d8c88f9 100644 --- a/tests/unit/clients/jobManagerClient.spec.ts +++ b/tests/unit/clients/jobManagerClient.spec.ts @@ -112,7 +112,7 @@ describe('JobManagerClient', () => { describe('Find Job by Status', () => { it('should findExportCompletedJobs successfully', async () => { - const tilesJobType = configMock.get('externalClientsConfig.exportJobAndTaskTypes.jobType'); + const tilesJobType = configMock.get('jobDefinitions.jobs.export.type'); getExportJobs = jest.fn(); const jobManager = jobManagerClient as unknown as { getExportJobs: unknown }; jobManager.getExportJobs = getExportJobs.mockResolvedValue([completedExportJob]); @@ -147,7 +147,7 @@ describe('JobManagerClient', () => { }); it('should findExportInProgressJobs successfully', async () => { - const tilesJobType = configMock.get('externalClientsConfig.exportJobAndTaskTypes.jobType'); + const tilesJobType = configMock.get('jobDefinitions.jobs.export.type'); getExportJobs = jest.fn(); const jobManager = jobManagerClient as unknown as { getExportJobs: unknown }; jobManager.getExportJobs = getExportJobs.mockResolvedValue([inProgressExportJob]); diff --git a/tests/unit/createPackage/models/tasksModel.spec.ts b/tests/unit/createPackage/models/tasksModel.spec.ts index 6602296..f7257ac 100644 --- a/tests/unit/createPackage/models/tasksModel.spec.ts +++ b/tests/unit/createPackage/models/tasksModel.spec.ts @@ -55,7 +55,7 @@ describe('TasksManager', () => { { id: '0a5552f7-01eb-40af-a912-eed8fa9e1561', jobId: '0a5552f7-01eb-40af-a912-eed8fa9e1568', - type: 'rasterTilesExporterd', + type: 'export', description: '', parameters: {} as unknown as ITaskParameters, status: OperationStatus.IN_PROGRESS, @@ -245,7 +245,7 @@ describe('TasksManager', () => { describe('#createFinalizeTask', () => { it('should create new success finalize task', async () => { - const finalizeTaskType = configMock.get('externalClientsConfig.exportJobAndTaskTypes.taskFinalizeType'); + const finalizeTaskType = configMock.get('jobDefinitions.tasks.finalize.type'); const expectedCreateTaskRequest: CreateFinalizeTaskBody = { type: finalizeTaskType, parameters: { exporterTaskStatus: OperationStatus.COMPLETED }, @@ -262,7 +262,7 @@ describe('TasksManager', () => { }); it('should create new failed finalize task', async () => { - const finalizeTaskType = configMock.get('externalClientsConfig.exportJobAndTaskTypes.taskFinalizeType'); + const finalizeTaskType = configMock.get('jobDefinitions.tasks.finalize.type'); const expectedCreateTaskRequest: CreateFinalizeTaskBody = { type: finalizeTaskType, parameters: { reason: 'GPKG corrupted', exporterTaskStatus: OperationStatus.FAILED }, From 67120747ca32cd3296ca22077213c95949081dbb Mon Sep 17 00:00:00 2001 From: razbroc Date: Wed, 30 Oct 2024 18:45:28 +0200 Subject: [PATCH 5/7] style: lint --- config/default.json | 2 +- src/common/interfaces.ts | 8 ++++---- tests/mocks/config.ts | 16 ++++++++-------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/config/default.json b/config/default.json index 50d2214..54fbb1f 100644 --- a/config/default.json +++ b/config/default.json @@ -83,4 +83,4 @@ } } } -} \ No newline at end of file +} diff --git a/src/common/interfaces.ts b/src/common/interfaces.ts index 73e72ff..fe828df 100644 --- a/src/common/interfaces.ts +++ b/src/common/interfaces.ts @@ -201,7 +201,7 @@ export interface IJobManager extends IClientBase { dequeueFinalizeIntervalMs: number; } -export interface IRasterCatalogManager extends IClientBase { } +export interface IRasterCatalogManager extends IClientBase {} export interface IHeartbeatManager extends IClientBase { heartbeatIntervalMs: number; @@ -220,9 +220,9 @@ export interface IExternalClientsConfig { export interface IJobDefinitions { jobs: { - export: { type: string } + export: { type: string }; }; tasks: { - export: { type: string } + export: { type: string }; }; -} \ No newline at end of file +} diff --git a/tests/mocks/config.ts b/tests/mocks/config.ts index a87075b..d64b809 100644 --- a/tests/mocks/config.ts +++ b/tests/mocks/config.ts @@ -20,7 +20,7 @@ const setConfigValues = (values: Record): void => { const registerDefaultConfig = (): void => { const config = { - domain: "RASTER", + domain: 'RASTER', openapiConfig: { filePath: './openapi3.yaml', basePath: '/docs', @@ -87,18 +87,18 @@ const registerDefaultConfig = (): void => { jobDefinitions: { tasks: { export: { - type: 'export' + type: 'export', }, finalize: { - type: 'finalize' - } + type: 'finalize', + }, }, jobs: { export: { - type: 'Export' - } - } - } + type: 'Export', + }, + }, + }, }; setConfigValues(config); }; From 6fa5dff758eacefacfb0a764734eef426abb37aa Mon Sep 17 00:00:00 2001 From: razbroc Date: Thu, 31 Oct 2024 10:31:48 +0200 Subject: [PATCH 6/7] feat: add comment --- src/common/interfaces.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common/interfaces.ts b/src/common/interfaces.ts index fe828df..ab465a5 100644 --- a/src/common/interfaces.ts +++ b/src/common/interfaces.ts @@ -218,6 +218,7 @@ export interface IExternalClientsConfig { disableHttpClientLogs: boolean; } +//consider changing from nested interface export interface IJobDefinitions { jobs: { export: { type: string }; From 53795abab69fd2e4356051775eff93ab041853bd Mon Sep 17 00:00:00 2001 From: razbroc Date: Thu, 31 Oct 2024 10:38:51 +0200 Subject: [PATCH 7/7] fix: fix default json --- config/default.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/default.json b/config/default.json index 2c3a0d2..13dc183 100644 --- a/config/default.json +++ b/config/default.json @@ -82,7 +82,7 @@ "type": "Export" } } - } + }, "roiBufferMeter": 5, "minContainedPercentage": 80 }