From 3ef04af549343abd387b69f16ccc578b015802b6 Mon Sep 17 00:00:00 2001 From: razbroc Date: Wed, 15 Apr 2026 13:24:44 +0300 Subject: [PATCH 1/6] feat: add useHttpGet flag to S3 configuration and update related components --- config/custom-environment-variables.json | 6 ++- config/default.json | 3 +- helm/templates/configmap.yaml | 1 + helm/values.yaml | 12 +++--- src/common/cacheProviders/S3Source.ts | 5 ++- src/common/interfaces.ts | 2 + tests/integration/testContainerConfig.ts | 4 +- .../unit/layers/models/layersManager.spec.ts | 40 ++++++++++++++++++- 8 files changed, 62 insertions(+), 11 deletions(-) diff --git a/config/custom-environment-variables.json b/config/custom-environment-variables.json index 3ddf2921..ebb54b96 100644 --- a/config/custom-environment-variables.json +++ b/config/custom-environment-variables.json @@ -60,7 +60,11 @@ "secretAccessKey": "S3_SECRET_ACCESS_KEY", "endpointUrl": "S3_ENDPOINT_URL", "bucket": "S3_BUCKET", - "sslEnabled": "S3_SSL_ENABLED" + "sslEnabled": "S3_SSL_ENABLED", + "useHttpGet": { + "__name": "S3_USE_HTTP_GET", + "__format": "boolean" + } }, "DB": { "host": "DB_HOST", diff --git a/config/default.json b/config/default.json index 68046446..beb705eb 100644 --- a/config/default.json +++ b/config/default.json @@ -45,7 +45,8 @@ "endpointUrl": "http://localhost:9000", "bucket": "", "objectKey": "mapproxy.yaml", - "sslEnabled": false + "sslEnabled": false, + "useHttpGet": true }, "DB": { "host": "localhost", diff --git a/helm/templates/configmap.yaml b/helm/templates/configmap.yaml index 9a51e36a..6e1e1c33 100644 --- a/helm/templates/configmap.yaml +++ b/helm/templates/configmap.yaml @@ -48,6 +48,7 @@ data: S3_ENDPOINT_URL: {{ $s3.endpointUrl }} S3_BUCKET: {{ $s3.tilesBucket }} S3_SSL_ENABLED: {{ $s3.sslEnabled }} + S3_USE_HTTP_GET: {{ $s3.useHttpGet | quote }} {{- end }} {{- if eq (upper $storage.mapproxyConfigProvider) "DB" }} {{- $db := (include "common.db.merged" .) | fromYaml }} diff --git a/helm/values.yaml b/helm/values.yaml index cb19db1c..3e8cbaac 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -10,6 +10,7 @@ global: tilesBucket: "" sslEnabled: false secretName: "" + useHttpGet: false fs: internalPvc: name: "" @@ -67,6 +68,7 @@ storage: tilesBucket: "" sslEnabled: false secretName: "" + useHttpGet: false fs: internalPvc: name: "" @@ -91,10 +93,9 @@ metrics: tracing: enabled: false url: '' - -# add pod annotations -# example: -# podAnnotations: + # add pod annotations + # example: + # podAnnotations: # annotation1: annotation-value-1 # annotation2: annotation-value-2 podAnnotations: {} @@ -153,7 +154,8 @@ ingress: origin: '*' annotations: {} -local: # for local stand alone deployment, external pvc and secrets should be used for full deployment +local: + # for local stand alone deployment, external pvc and secrets should be used for full deployment fs: createComponents: false storageClass: hostPath diff --git a/src/common/cacheProviders/S3Source.ts b/src/common/cacheProviders/S3Source.ts index a533e588..e1c07d71 100644 --- a/src/common/cacheProviders/S3Source.ts +++ b/src/common/cacheProviders/S3Source.ts @@ -2,14 +2,16 @@ import { DependencyContainer } from 'tsyringe'; import { SourceTypes } from '../enums'; import { SERVICES } from '../constants'; -import { ICacheProvider, IMapProxyConfig, IS3Source } from '../interfaces'; +import { ICacheProvider, IMapProxyConfig, IS3Config, IS3Source } from '../interfaces'; import { adjustTilesPath } from '../utils'; class S3Source implements ICacheProvider { private readonly mapproxyConfig: IMapProxyConfig; + private readonly s3Config: IS3Config; public constructor(container: DependencyContainer) { this.mapproxyConfig = container.resolve(SERVICES.MAPPROXY); + this.s3Config = container.resolve(SERVICES.S3); } public getCacheSource(sourcePath: string): IS3Source { @@ -18,6 +20,7 @@ class S3Source implements ICacheProvider { type: sourceCacheType, directory: adjustTilesPath(sourcePath, sourceCacheType), directory_layout: this.mapproxyConfig.cache.directoryLayout, + use_http_get: this.s3Config.useHttpGet, }; return s3Source; diff --git a/src/common/interfaces.ts b/src/common/interfaces.ts index 393b1097..7deb485d 100644 --- a/src/common/interfaces.ts +++ b/src/common/interfaces.ts @@ -64,6 +64,7 @@ export interface IS3Config { bucket: string; objectKey: string; sslEnabled: boolean; + useHttpGet: boolean; } export interface IRedisConfig { @@ -107,6 +108,7 @@ export interface ICacheSource { export interface IS3Source extends ICacheSource { directory: string; directory_layout: string; + use_http_get?: boolean; } export interface IRedisSource extends ICacheSource { diff --git a/tests/integration/testContainerConfig.ts b/tests/integration/testContainerConfig.ts index f756091d..d112c914 100644 --- a/tests/integration/testContainerConfig.ts +++ b/tests/integration/testContainerConfig.ts @@ -1,13 +1,14 @@ import { container } from 'tsyringe'; import config from 'config'; import { SERVICES } from '../../src/common/constants'; -import { IConfigProvider, IFSConfig, IMapProxyConfig, IRedisConfig } from '../../src/common/interfaces'; +import { IConfigProvider, IFSConfig, IMapProxyConfig, IRedisConfig, IS3Config } from '../../src/common/interfaces'; import { MockConfigProvider, init } from '../unit/mock/mockConfigProvider'; function registerTestValues(): void { const mapproxyConfig = config.get('mapproxy'); const redisConfig = config.get('redis'); const fsConfig = config.get('FS'); + const s3Config = config.get('S3'); init(); container.register(SERVICES.CONFIG, { useValue: config }); @@ -15,6 +16,7 @@ function registerTestValues(): void { container.register(SERVICES.MAPPROXY, { useValue: mapproxyConfig }); container.register(SERVICES.REDISCONFIG, { useValue: redisConfig }); container.register(SERVICES.FS, { useValue: fsConfig }); + container.register(SERVICES.S3, { useValue: s3Config }); container.register(SERVICES.CONFIGPROVIDER, { useFactory: (): IConfigProvider => { return MockConfigProvider; diff --git a/tests/unit/layers/models/layersManager.spec.ts b/tests/unit/layers/models/layersManager.spec.ts index b6d70074..c7b8d4b5 100644 --- a/tests/unit/layers/models/layersManager.spec.ts +++ b/tests/unit/layers/models/layersManager.spec.ts @@ -7,7 +7,7 @@ import { BadRequestError, ConflictError, NotFoundError, NotImplementedError } fr import { TileOutputFormat } from '@map-colonies/mc-model-types'; import { lookup as mimeLookup, TilesMimeFormat } from '@map-colonies/types'; import config from 'config'; -import { ILayerPostRequest, IMapProxyCache, IMapProxyConfig, IRedisConfig } from '../../../../src/common/interfaces'; +import { ILayerPostRequest, IMapProxyCache, IMapProxyConfig, IRedisConfig, IS3Config } from '../../../../src/common/interfaces'; import { LayersManager } from '../../../../src/layers/models/layersManager'; import { mockLayerNameAlreadyExists } from '../../mock/mockLayerNameAlreadyExists'; import { mockLayerNameIsNotExists } from '../../mock/mockLayerNameIsNotExists'; @@ -207,6 +207,42 @@ describe('layersManager', () => { // expectation await expect(action).rejects.toThrow(BadRequestError); }); + + it('should successfully add layer with use_http_get set to true', async () => { + const s3ConfigWithHttpGet: IS3Config = { ...config.get('S3'), useHttpGet: true }; + container.register(SERVICES.S3, { useValue: s3ConfigWithHttpGet }); + const mapproxyConfig = container.resolve(SERVICES.MAPPROXY); + const redisConfig = container.resolve(SERVICES.REDISCONFIG); + configManager = new ConfigsManager(logger, mapproxyConfig, MockConfigProvider, tracerMock); + layersManager = new LayersManager(logger, mapproxyConfig, redisConfig, MockConfigProvider, tracerMock, configManager); + jest.spyOn(configManager, 'getConfig').mockResolvedValue(mockData()); + + expect.assertions(3); + await expect(layersManager.addLayer(mockLayerNameIsNotExists)).toResolve(); + + const resultJson = await MockConfigProvider.getJson(); + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + expect(resultJson.caches[mockLayerNameIsNotExists.name].cache.use_http_get).toBe(true); + expect(updateJsonMock).toHaveBeenCalledTimes(1); + }); + + it('should successfully add layer with use_http_get set to false', async () => { + const s3ConfigWithoutHttpGet: IS3Config = { ...config.get('S3'), useHttpGet: false }; + container.register(SERVICES.S3, { useValue: s3ConfigWithoutHttpGet }); + const mapproxyConfig = container.resolve(SERVICES.MAPPROXY); + const redisConfig = container.resolve(SERVICES.REDISCONFIG); + configManager = new ConfigsManager(logger, mapproxyConfig, MockConfigProvider, tracerMock); + layersManager = new LayersManager(logger, mapproxyConfig, redisConfig, MockConfigProvider, tracerMock, configManager); + jest.spyOn(configManager, 'getConfig').mockResolvedValue(mockData()); + + expect.assertions(3); + await expect(layersManager.addLayer(mockLayerNameIsNotExists)).toResolve(); + + const resultJson = await MockConfigProvider.getJson(); + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + expect(resultJson.caches[mockLayerNameIsNotExists.name].cache.use_http_get).toBe(false); + expect(updateJsonMock).toHaveBeenCalledTimes(1); + }); }); describe('#removeLayer', () => { @@ -367,7 +403,7 @@ describe('layersManager', () => { it('should provide s3 cache as source', () => { const cacheType = 's3'; // eslint-disable-next-line @typescript-eslint/naming-convention - const expectedResult = { type: cacheType, directory: mockTilesPath, directory_layout: directoryLayout }; + const expectedResult = { type: cacheType, directory: mockTilesPath, directory_layout: directoryLayout, use_http_get: false }; // mock jest.mock('../../../../src/common/cacheProviders/S3Source'); // action From 55cdbe8938c54c178036884356396f4ce8ce95b4 Mon Sep 17 00:00:00 2001 From: razbroc Date: Wed, 15 Apr 2026 13:31:55 +0300 Subject: [PATCH 2/6] test: add useHttpGet flag to S3 configuration --- config/test.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/config/test.json b/config/test.json index c37c6976..9e4daa4b 100644 --- a/config/test.json +++ b/config/test.json @@ -51,5 +51,14 @@ }, "type": "redis", "default_ttl": 86400 + }, + "S3": { + "accessKeyId": "minioadmin", + "secretAccessKey": "minioadmin", + "endpointUrl": "http://localhost:9000", + "bucket": "", + "objectKey": "mapproxy.yaml", + "sslEnabled": false, + "useHttpGet": false } } From 5c7b8ed4b27b42002148d7b06225468e58516c60 Mon Sep 17 00:00:00 2001 From: razbroc Date: Wed, 15 Apr 2026 16:15:03 +0300 Subject: [PATCH 3/6] refactor: change useHttpGet flag location to in configuration files and update related components --- config/custom-environment-variables.json | 14 ++++++------- config/default.json | 6 +++--- config/test.json | 6 +++--- helm/templates/configmap.yaml | 2 +- helm/values.yaml | 3 +-- src/common/cacheProviders/S3Source.ts | 6 ++---- src/common/interfaces.ts | 4 ++-- .../unit/layers/models/layersManager.spec.ts | 20 +++++++++---------- 8 files changed, 28 insertions(+), 33 deletions(-) diff --git a/config/custom-environment-variables.json b/config/custom-environment-variables.json index ebb54b96..dcc2e02a 100644 --- a/config/custom-environment-variables.json +++ b/config/custom-environment-variables.json @@ -47,7 +47,11 @@ "__name": "MAPPROXY_CACHE_UPSCALE_TILES", "__format": "number" }, - "directoryLayout": "MAPPROXY_CACHE_DIRECTORY_LAYOUT" + "directoryLayout": "MAPPROXY_CACHE_DIRECTORY_LAYOUT", + "useHttpGet": { + "__name": "MAPPROXY_CACHE_USE_HTTP_GET", + "__format": "boolean" + } } }, "FS": { @@ -60,11 +64,7 @@ "secretAccessKey": "S3_SECRET_ACCESS_KEY", "endpointUrl": "S3_ENDPOINT_URL", "bucket": "S3_BUCKET", - "sslEnabled": "S3_SSL_ENABLED", - "useHttpGet": { - "__name": "S3_USE_HTTP_GET", - "__format": "boolean" - } + "sslEnabled": "S3_SSL_ENABLED" }, "DB": { "host": "DB_HOST", @@ -118,4 +118,4 @@ "__format": "number" } } -} +} \ No newline at end of file diff --git a/config/default.json b/config/default.json index beb705eb..ec447885 100644 --- a/config/default.json +++ b/config/default.json @@ -31,7 +31,8 @@ "grids": "WorldCRS84", "upscaleTiles": 18, "directoryLayout": "tms", - "gpkgExt": ".gpkg" + "gpkgExt": ".gpkg", + "useHttpGet": true } }, "FS": { @@ -45,8 +46,7 @@ "endpointUrl": "http://localhost:9000", "bucket": "", "objectKey": "mapproxy.yaml", - "sslEnabled": false, - "useHttpGet": true + "sslEnabled": false }, "DB": { "host": "localhost", diff --git a/config/test.json b/config/test.json index 9e4daa4b..213c6b9a 100644 --- a/config/test.json +++ b/config/test.json @@ -17,7 +17,8 @@ "grids": "epsg4326dir", "upscale_tiles": 18, "type": "s3", - "directory_layout": "tms" + "directory_layout": "tms", + "useHttpGet": false } }, "redis": { @@ -58,7 +59,6 @@ "endpointUrl": "http://localhost:9000", "bucket": "", "objectKey": "mapproxy.yaml", - "sslEnabled": false, - "useHttpGet": false + "sslEnabled": false } } diff --git a/helm/templates/configmap.yaml b/helm/templates/configmap.yaml index 6e1e1c33..ca7a2fae 100644 --- a/helm/templates/configmap.yaml +++ b/helm/templates/configmap.yaml @@ -27,6 +27,7 @@ data: MAPPROXY_CACHE_GRIDS: {{ quote .Values.env.mapproxyCache.grids }} MAPPROXY_CACHE_UPSCALE_TILES: {{ quote .Values.env.mapproxyCache.upscaleTiles }} MAPPROXY_CACHE_DIRECTORY_LAYOUT: {{ quote .Values.env.mapproxyCache.directoryLayout }} + MAPPROXY_CACHE_USE_HTTP_GET: {{ .Values.env.mapproxyCache.useHttpGet | quote }} REDIS_ENABLED: {{ quote $redis.enabled }} {{ if $redis.enabled }} REDIS_HOST: {{ quote $redis.host }} @@ -48,7 +49,6 @@ data: S3_ENDPOINT_URL: {{ $s3.endpointUrl }} S3_BUCKET: {{ $s3.tilesBucket }} S3_SSL_ENABLED: {{ $s3.sslEnabled }} - S3_USE_HTTP_GET: {{ $s3.useHttpGet | quote }} {{- end }} {{- if eq (upper $storage.mapproxyConfigProvider) "DB" }} {{- $db := (include "common.db.merged" .) | fromYaml }} diff --git a/helm/values.yaml b/helm/values.yaml index 3e8cbaac..53296260 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -10,7 +10,6 @@ global: tilesBucket: "" sslEnabled: false secretName: "" - useHttpGet: false fs: internalPvc: name: "" @@ -68,7 +67,6 @@ storage: tilesBucket: "" sslEnabled: false secretName: "" - useHttpGet: false fs: internalPvc: name: "" @@ -112,6 +110,7 @@ env: grids: WorldCRS84 upscaleTiles: 18 directoryLayout: tms + useHttpGet: false resources: enabled: true diff --git a/src/common/cacheProviders/S3Source.ts b/src/common/cacheProviders/S3Source.ts index e1c07d71..f4d452b5 100644 --- a/src/common/cacheProviders/S3Source.ts +++ b/src/common/cacheProviders/S3Source.ts @@ -2,16 +2,14 @@ import { DependencyContainer } from 'tsyringe'; import { SourceTypes } from '../enums'; import { SERVICES } from '../constants'; -import { ICacheProvider, IMapProxyConfig, IS3Config, IS3Source } from '../interfaces'; +import { ICacheProvider, IMapProxyConfig, IS3Source } from '../interfaces'; import { adjustTilesPath } from '../utils'; class S3Source implements ICacheProvider { private readonly mapproxyConfig: IMapProxyConfig; - private readonly s3Config: IS3Config; public constructor(container: DependencyContainer) { this.mapproxyConfig = container.resolve(SERVICES.MAPPROXY); - this.s3Config = container.resolve(SERVICES.S3); } public getCacheSource(sourcePath: string): IS3Source { @@ -20,7 +18,7 @@ class S3Source implements ICacheProvider { type: sourceCacheType, directory: adjustTilesPath(sourcePath, sourceCacheType), directory_layout: this.mapproxyConfig.cache.directoryLayout, - use_http_get: this.s3Config.useHttpGet, + use_http_get: this.mapproxyConfig.cache.useHttpGet, }; return s3Source; diff --git a/src/common/interfaces.ts b/src/common/interfaces.ts index 7deb485d..39101b78 100644 --- a/src/common/interfaces.ts +++ b/src/common/interfaces.ts @@ -48,6 +48,7 @@ export interface IMapProxyConfig { upscaleTiles: number; directoryLayout: string; gpkgExt: string; + useHttpGet: boolean; }; } @@ -64,7 +65,6 @@ export interface IS3Config { bucket: string; objectKey: string; sslEnabled: boolean; - useHttpGet: boolean; } export interface IRedisConfig { @@ -135,7 +135,7 @@ export interface IGpkgSource extends ICacheSource { table_name: string; } -export interface IFSSource extends IS3Source {} +export interface IFSSource extends IS3Source { } export interface IMapProxyCache { // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/tests/unit/layers/models/layersManager.spec.ts b/tests/unit/layers/models/layersManager.spec.ts index c7b8d4b5..072dd029 100644 --- a/tests/unit/layers/models/layersManager.spec.ts +++ b/tests/unit/layers/models/layersManager.spec.ts @@ -7,7 +7,7 @@ import { BadRequestError, ConflictError, NotFoundError, NotImplementedError } fr import { TileOutputFormat } from '@map-colonies/mc-model-types'; import { lookup as mimeLookup, TilesMimeFormat } from '@map-colonies/types'; import config from 'config'; -import { ILayerPostRequest, IMapProxyCache, IMapProxyConfig, IRedisConfig, IS3Config } from '../../../../src/common/interfaces'; +import { ILayerPostRequest, IMapProxyCache, IMapProxyConfig, IRedisConfig } from '../../../../src/common/interfaces'; import { LayersManager } from '../../../../src/layers/models/layersManager'; import { mockLayerNameAlreadyExists } from '../../mock/mockLayerNameAlreadyExists'; import { mockLayerNameIsNotExists } from '../../mock/mockLayerNameIsNotExists'; @@ -209,12 +209,11 @@ describe('layersManager', () => { }); it('should successfully add layer with use_http_get set to true', async () => { - const s3ConfigWithHttpGet: IS3Config = { ...config.get('S3'), useHttpGet: true }; - container.register(SERVICES.S3, { useValue: s3ConfigWithHttpGet }); - const mapproxyConfig = container.resolve(SERVICES.MAPPROXY); + const mapproxyConfigWithHttpGet: IMapProxyConfig = { ...config.get('mapproxy'), cache: { ...config.get('mapproxy').cache, useHttpGet: true } }; + container.register(SERVICES.MAPPROXY, { useValue: mapproxyConfigWithHttpGet }); const redisConfig = container.resolve(SERVICES.REDISCONFIG); - configManager = new ConfigsManager(logger, mapproxyConfig, MockConfigProvider, tracerMock); - layersManager = new LayersManager(logger, mapproxyConfig, redisConfig, MockConfigProvider, tracerMock, configManager); + configManager = new ConfigsManager(logger, mapproxyConfigWithHttpGet, MockConfigProvider, tracerMock); + layersManager = new LayersManager(logger, mapproxyConfigWithHttpGet, redisConfig, MockConfigProvider, tracerMock, configManager); jest.spyOn(configManager, 'getConfig').mockResolvedValue(mockData()); expect.assertions(3); @@ -227,12 +226,11 @@ describe('layersManager', () => { }); it('should successfully add layer with use_http_get set to false', async () => { - const s3ConfigWithoutHttpGet: IS3Config = { ...config.get('S3'), useHttpGet: false }; - container.register(SERVICES.S3, { useValue: s3ConfigWithoutHttpGet }); - const mapproxyConfig = container.resolve(SERVICES.MAPPROXY); + const mapproxyConfigWithoutHttpGet: IMapProxyConfig = { ...config.get('mapproxy'), cache: { ...config.get('mapproxy').cache, useHttpGet: false } }; + container.register(SERVICES.MAPPROXY, { useValue: mapproxyConfigWithoutHttpGet }); const redisConfig = container.resolve(SERVICES.REDISCONFIG); - configManager = new ConfigsManager(logger, mapproxyConfig, MockConfigProvider, tracerMock); - layersManager = new LayersManager(logger, mapproxyConfig, redisConfig, MockConfigProvider, tracerMock, configManager); + configManager = new ConfigsManager(logger, mapproxyConfigWithoutHttpGet, MockConfigProvider, tracerMock); + layersManager = new LayersManager(logger, mapproxyConfigWithoutHttpGet, redisConfig, MockConfigProvider, tracerMock, configManager); jest.spyOn(configManager, 'getConfig').mockResolvedValue(mockData()); expect.assertions(3); From a14fa48e2697bbc863eaaf82b97b80498a1a34a7 Mon Sep 17 00:00:00 2001 From: razbroc Date: Thu, 16 Apr 2026 09:40:03 +0300 Subject: [PATCH 4/6] style: lint fix --- config/custom-environment-variables.json | 2 +- src/common/interfaces.ts | 2 +- tests/unit/layers/models/layersManager.spec.ts | 10 ++++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/config/custom-environment-variables.json b/config/custom-environment-variables.json index dcc2e02a..70f22b4a 100644 --- a/config/custom-environment-variables.json +++ b/config/custom-environment-variables.json @@ -118,4 +118,4 @@ "__format": "number" } } -} \ No newline at end of file +} diff --git a/src/common/interfaces.ts b/src/common/interfaces.ts index 39101b78..776dde0b 100644 --- a/src/common/interfaces.ts +++ b/src/common/interfaces.ts @@ -135,7 +135,7 @@ export interface IGpkgSource extends ICacheSource { table_name: string; } -export interface IFSSource extends IS3Source { } +export interface IFSSource extends IS3Source {} export interface IMapProxyCache { // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/tests/unit/layers/models/layersManager.spec.ts b/tests/unit/layers/models/layersManager.spec.ts index 072dd029..5d808566 100644 --- a/tests/unit/layers/models/layersManager.spec.ts +++ b/tests/unit/layers/models/layersManager.spec.ts @@ -209,7 +209,10 @@ describe('layersManager', () => { }); it('should successfully add layer with use_http_get set to true', async () => { - const mapproxyConfigWithHttpGet: IMapProxyConfig = { ...config.get('mapproxy'), cache: { ...config.get('mapproxy').cache, useHttpGet: true } }; + const mapproxyConfigWithHttpGet: IMapProxyConfig = { + ...config.get('mapproxy'), + cache: { ...config.get('mapproxy').cache, useHttpGet: true }, + }; container.register(SERVICES.MAPPROXY, { useValue: mapproxyConfigWithHttpGet }); const redisConfig = container.resolve(SERVICES.REDISCONFIG); configManager = new ConfigsManager(logger, mapproxyConfigWithHttpGet, MockConfigProvider, tracerMock); @@ -226,7 +229,10 @@ describe('layersManager', () => { }); it('should successfully add layer with use_http_get set to false', async () => { - const mapproxyConfigWithoutHttpGet: IMapProxyConfig = { ...config.get('mapproxy'), cache: { ...config.get('mapproxy').cache, useHttpGet: false } }; + const mapproxyConfigWithoutHttpGet: IMapProxyConfig = { + ...config.get('mapproxy'), + cache: { ...config.get('mapproxy').cache, useHttpGet: false }, + }; container.register(SERVICES.MAPPROXY, { useValue: mapproxyConfigWithoutHttpGet }); const redisConfig = container.resolve(SERVICES.REDISCONFIG); configManager = new ConfigsManager(logger, mapproxyConfigWithoutHttpGet, MockConfigProvider, tracerMock); From ceb46a17957610223b42f28db414417e1d8f7054 Mon Sep 17 00:00:00 2001 From: razbroc Date: Mon, 20 Apr 2026 13:47:43 +0300 Subject: [PATCH 5/6] fix: test configuration default values --- config/test.json | 10 +--------- helm/values.yaml | 2 +- tests/integration/testContainerConfig.ts | 2 -- tests/unit/layers/models/layersManager.spec.ts | 2 +- 4 files changed, 3 insertions(+), 13 deletions(-) diff --git a/config/test.json b/config/test.json index 213c6b9a..f56a6b80 100644 --- a/config/test.json +++ b/config/test.json @@ -18,7 +18,7 @@ "upscale_tiles": 18, "type": "s3", "directory_layout": "tms", - "useHttpGet": false + "useHttpGet": true } }, "redis": { @@ -52,13 +52,5 @@ }, "type": "redis", "default_ttl": 86400 - }, - "S3": { - "accessKeyId": "minioadmin", - "secretAccessKey": "minioadmin", - "endpointUrl": "http://localhost:9000", - "bucket": "", - "objectKey": "mapproxy.yaml", - "sslEnabled": false } } diff --git a/helm/values.yaml b/helm/values.yaml index 53296260..137c1472 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -110,7 +110,7 @@ env: grids: WorldCRS84 upscaleTiles: 18 directoryLayout: tms - useHttpGet: false + useHttpGet: true resources: enabled: true diff --git a/tests/integration/testContainerConfig.ts b/tests/integration/testContainerConfig.ts index d112c914..ef755865 100644 --- a/tests/integration/testContainerConfig.ts +++ b/tests/integration/testContainerConfig.ts @@ -8,7 +8,6 @@ function registerTestValues(): void { const mapproxyConfig = config.get('mapproxy'); const redisConfig = config.get('redis'); const fsConfig = config.get('FS'); - const s3Config = config.get('S3'); init(); container.register(SERVICES.CONFIG, { useValue: config }); @@ -16,7 +15,6 @@ function registerTestValues(): void { container.register(SERVICES.MAPPROXY, { useValue: mapproxyConfig }); container.register(SERVICES.REDISCONFIG, { useValue: redisConfig }); container.register(SERVICES.FS, { useValue: fsConfig }); - container.register(SERVICES.S3, { useValue: s3Config }); container.register(SERVICES.CONFIGPROVIDER, { useFactory: (): IConfigProvider => { return MockConfigProvider; diff --git a/tests/unit/layers/models/layersManager.spec.ts b/tests/unit/layers/models/layersManager.spec.ts index 5d808566..1a5666c4 100644 --- a/tests/unit/layers/models/layersManager.spec.ts +++ b/tests/unit/layers/models/layersManager.spec.ts @@ -407,7 +407,7 @@ describe('layersManager', () => { it('should provide s3 cache as source', () => { const cacheType = 's3'; // eslint-disable-next-line @typescript-eslint/naming-convention - const expectedResult = { type: cacheType, directory: mockTilesPath, directory_layout: directoryLayout, use_http_get: false }; + const expectedResult = { type: cacheType, directory: mockTilesPath, directory_layout: directoryLayout, use_http_get: true }; // mock jest.mock('../../../../src/common/cacheProviders/S3Source'); // action From 0cc8c0f73baf092f7f793c5c19ba9aeccd57a587 Mon Sep 17 00:00:00 2001 From: razbroc Date: Mon, 20 Apr 2026 17:21:27 +0300 Subject: [PATCH 6/6] refactor: remove unused IS3Config import from testContainerConfig --- tests/integration/testContainerConfig.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/testContainerConfig.ts b/tests/integration/testContainerConfig.ts index ef755865..f756091d 100644 --- a/tests/integration/testContainerConfig.ts +++ b/tests/integration/testContainerConfig.ts @@ -1,7 +1,7 @@ import { container } from 'tsyringe'; import config from 'config'; import { SERVICES } from '../../src/common/constants'; -import { IConfigProvider, IFSConfig, IMapProxyConfig, IRedisConfig, IS3Config } from '../../src/common/interfaces'; +import { IConfigProvider, IFSConfig, IMapProxyConfig, IRedisConfig } from '../../src/common/interfaces'; import { MockConfigProvider, init } from '../unit/mock/mockConfigProvider'; function registerTestValues(): void {