@backstage/backend-test-utils 1.5.0-next.0 → 1.5.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # @backstage/backend-test-utils
2
2
 
3
+ ## 1.5.0-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/backend-defaults@0.10.0-next.2
9
+ - @backstage/config@1.3.2
10
+ - @backstage/backend-app-api@1.2.3-next.1
11
+ - @backstage/plugin-auth-node@0.6.3-next.1
12
+ - @backstage/backend-plugin-api@1.3.1-next.1
13
+ - @backstage/errors@1.2.7
14
+ - @backstage/types@1.2.1
15
+ - @backstage/plugin-events-node@0.4.11-next.1
16
+
17
+ ## 1.5.0-next.1
18
+
19
+ ### Minor Changes
20
+
21
+ - c6bc67d: Added Valkey support alongside Redis in backend-defaults cache clients, using the new Keyv Valkey package. Also extended backend-test-utils to support Valkey in tests.
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies
26
+ - @backstage/backend-defaults@0.10.0-next.1
27
+ - @backstage/backend-app-api@1.2.3-next.1
28
+ - @backstage/plugin-auth-node@0.6.3-next.1
29
+ - @backstage/backend-plugin-api@1.3.1-next.1
30
+ - @backstage/config@1.3.2
31
+ - @backstage/errors@1.2.7
32
+ - @backstage/types@1.2.1
33
+ - @backstage/plugin-events-node@0.4.11-next.1
34
+
3
35
  ## 1.5.0-next.0
4
36
 
5
37
  ### Minor Changes
@@ -5,6 +5,7 @@ var isDockerDisabledForTests = require('../util/isDockerDisabledForTests.cjs.js'
5
5
  var memcache = require('./memcache.cjs.js');
6
6
  var redis = require('./redis.cjs.js');
7
7
  var types = require('./types.cjs.js');
8
+ var valkey = require('./valkey.cjs.js');
8
9
 
9
10
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
10
11
 
@@ -110,6 +111,8 @@ class TestCaches {
110
111
  return this.initMemcached(properties);
111
112
  case "redis":
112
113
  return this.initRedis(properties);
114
+ case "valkey":
115
+ return this.initValkey(properties);
113
116
  case "memory":
114
117
  return {
115
118
  store: "memory",
@@ -142,6 +145,16 @@ class TestCaches {
142
145
  }
143
146
  return await redis.startRedisContainer(properties.dockerImageName);
144
147
  }
148
+ async initValkey(properties) {
149
+ const envVarName = properties.connectionStringEnvironmentVariableName;
150
+ if (envVarName) {
151
+ const connectionString = process.env[envVarName];
152
+ if (connectionString) {
153
+ return valkey.connectToExternalValkey(connectionString);
154
+ }
155
+ }
156
+ return await valkey.startValkeyContainer(properties.dockerImageName);
157
+ }
145
158
  async shutdown() {
146
159
  const instances = [...this.instanceById.values()];
147
160
  this.instanceById.clear();
@@ -1 +1 @@
1
- {"version":3,"file":"TestCaches.cjs.js","sources":["../../src/cache/TestCaches.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Keyv from 'keyv';\nimport { isDockerDisabledForTests } from '../util/isDockerDisabledForTests';\nimport { connectToExternalMemcache, startMemcachedContainer } from './memcache';\nimport { connectToExternalRedis, startRedisContainer } from './redis';\nimport { Instance, TestCacheId, TestCacheProperties, allCaches } from './types';\n\n/**\n * Encapsulates the creation of ephemeral test cache instances for use inside\n * unit or integration tests.\n *\n * @public\n */\nexport class TestCaches {\n private readonly instanceById: Map<string, Instance>;\n private readonly supportedIds: TestCacheId[];\n private static defaultIds?: TestCacheId[];\n\n /**\n * Creates an empty `TestCaches` instance, and sets up Jest to clean up all of\n * its acquired resources after all tests finish.\n *\n * You typically want to create just a single instance like this at the top of\n * your test file or `describe` block, and then call `init` many times on that\n * instance inside the individual tests. Spinning up a \"physical\" cache\n * instance takes a considerable amount of time, slowing down tests. But\n * wiping the contents of an instance using `init` is very fast.\n */\n static create(options?: {\n ids?: TestCacheId[];\n disableDocker?: boolean;\n }): TestCaches {\n const ids = options?.ids;\n const disableDocker = options?.disableDocker ?? isDockerDisabledForTests();\n\n let testCacheIds: TestCacheId[];\n if (ids) {\n testCacheIds = ids;\n } else if (TestCaches.defaultIds) {\n testCacheIds = TestCaches.defaultIds;\n } else {\n testCacheIds = Object.keys(allCaches) as TestCacheId[];\n }\n\n const supportedIds = testCacheIds.filter(id => {\n const properties = allCaches[id];\n if (!properties) {\n return false;\n }\n // If the caller has set up the env with an explicit connection string,\n // we'll assume that this target will work\n if (\n properties.connectionStringEnvironmentVariableName &&\n process.env[properties.connectionStringEnvironmentVariableName]\n ) {\n return true;\n }\n // If the cache doesn't require docker at all, there's nothing to worry\n // about\n if (!properties.dockerImageName) {\n return true;\n }\n // If the cache requires docker, but docker is disabled, we will fail.\n if (disableDocker) {\n return false;\n }\n return true;\n });\n\n const caches = new TestCaches(supportedIds);\n\n if (supportedIds.length > 0) {\n afterAll(async () => {\n await caches.shutdown();\n });\n }\n\n return caches;\n }\n\n static setDefaults(options: { ids?: TestCacheId[] }) {\n TestCaches.defaultIds = options.ids;\n }\n\n private constructor(supportedIds: TestCacheId[]) {\n this.instanceById = new Map();\n this.supportedIds = supportedIds;\n }\n\n supports(id: TestCacheId): boolean {\n return this.supportedIds.includes(id);\n }\n\n eachSupportedId(): [TestCacheId][] {\n return this.supportedIds.map(id => [id]);\n }\n\n /**\n * Returns a fresh, empty cache for the given driver.\n *\n * @param id - The ID of the cache to use, e.g. 'REDIS_7'\n * @returns Cache connection properties\n */\n async init(\n id: TestCacheId,\n ): Promise<{ store: string; connection: string; keyv: Keyv }> {\n const properties = allCaches[id];\n if (!properties) {\n const candidates = Object.keys(allCaches).join(', ');\n throw new Error(\n `Unknown test cache ${id}, possible values are ${candidates}`,\n );\n }\n if (!this.supportedIds.includes(id)) {\n const candidates = this.supportedIds.join(', ');\n throw new Error(\n `Unsupported test cache ${id} for this environment, possible values are ${candidates}`,\n );\n }\n\n // Ensure that a testcontainers instance is up for this ID\n let instance: Instance | undefined = this.instanceById.get(id);\n if (!instance) {\n instance = await this.initAny(properties);\n this.instanceById.set(id, instance);\n }\n\n // Ensure that it's cleared of data from previous tests\n await instance.keyv.clear();\n\n return {\n store: instance.store,\n connection: instance.connection,\n keyv: instance.keyv,\n };\n }\n\n private async initAny(properties: TestCacheProperties): Promise<Instance> {\n switch (properties.store) {\n case 'memcache':\n return this.initMemcached(properties);\n case 'redis':\n return this.initRedis(properties);\n case 'memory':\n return {\n store: 'memory',\n connection: 'memory',\n keyv: new Keyv(),\n stop: async () => {},\n };\n default:\n throw new Error(`Unknown cache store '${properties.store}'`);\n }\n }\n\n private async initMemcached(\n properties: TestCacheProperties,\n ): Promise<Instance> {\n // Use the connection string if provided\n const envVarName = properties.connectionStringEnvironmentVariableName;\n if (envVarName) {\n const connectionString = process.env[envVarName];\n if (connectionString) {\n return connectToExternalMemcache(connectionString);\n }\n }\n\n return await startMemcachedContainer(properties.dockerImageName!);\n }\n\n private async initRedis(properties: TestCacheProperties): Promise<Instance> {\n // Use the connection string if provided\n const envVarName = properties.connectionStringEnvironmentVariableName;\n if (envVarName) {\n const connectionString = process.env[envVarName];\n if (connectionString) {\n return connectToExternalRedis(connectionString);\n }\n }\n\n return await startRedisContainer(properties.dockerImageName!);\n }\n\n private async shutdown() {\n const instances = [...this.instanceById.values()];\n this.instanceById.clear();\n await Promise.all(\n instances.map(({ stop }) =>\n stop().catch(error => {\n console.warn(`TestCaches: Failed to stop container`, { error });\n }),\n ),\n );\n }\n}\n"],"names":["isDockerDisabledForTests","allCaches","Keyv","connectToExternalMemcache","startMemcachedContainer","connectToExternalRedis","startRedisContainer"],"mappings":";;;;;;;;;;;;AA4BO,MAAM,UAAW,CAAA;A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AAA,uCAAA;AAC9B,IAAA,IAAI,UAAY,EAAA;AACd,MAAM,MAAA,gBAAA,GAAmB,OAAQ,CAAA,GAAA,CAAI,UAAU,CAAA;AAC/C,MAAA,IAAI,gBAAkB,EAAA;AACpB,QAAA,OAAOC,6BAAuB,gBAAgB,CAAA;AAAA;AAChD;AAGF,IAAO,OAAA,MAAMC,yBAAoB,CAAA,UAAA,CAAW,eAAgB,CAAA;AAAA;AAC9D,EAEA,MAAc,QAAW,GAAA;AACvB,IAAA,MAAM,YAAY,CAAC,GAAG,IAAK,CAAA,YAAA,CAAa,QAAQ,CAAA;AAChD,IAAA,IAAA,CAAK,aAAa,KAAM,EAAA;AACxB,IAAA,MAAM,OAAQ,CAAA,GAAA;AAAA,MACZ,SAAU,CAAA,GAAA;AAAA,QAAI,CAAC,EAAE,IAAA,OACf,IAAK,EAAA,CAAE,MAAM,CAAS,KAAA,KAAA;AACpB,UAAA,OAAA,CAAQ,IAAK,CAAA,CAAA,oCAAA,CAAA,EAAwC,EAAE,KAAA,EAAO,CAAA;AAAA,SAC/D;AAAA;AACH,KACF;AAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"TestCaches.cjs.js","sources":["../../src/cache/TestCaches.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Keyv from 'keyv';\nimport { isDockerDisabledForTests } from '../util/isDockerDisabledForTests';\nimport { connectToExternalMemcache, startMemcachedContainer } from './memcache';\nimport { connectToExternalRedis, startRedisContainer } from './redis';\nimport { Instance, TestCacheId, TestCacheProperties, allCaches } from './types';\nimport { connectToExternalValkey, startValkeyContainer } from './valkey';\n\n/**\n * Encapsulates the creation of ephemeral test cache instances for use inside\n * unit or integration tests.\n *\n * @public\n */\nexport class TestCaches {\n private readonly instanceById: Map<string, Instance>;\n private readonly supportedIds: TestCacheId[];\n private static defaultIds?: TestCacheId[];\n\n /**\n * Creates an empty `TestCaches` instance, and sets up Jest to clean up all of\n * its acquired resources after all tests finish.\n *\n * You typically want to create just a single instance like this at the top of\n * your test file or `describe` block, and then call `init` many times on that\n * instance inside the individual tests. Spinning up a \"physical\" cache\n * instance takes a considerable amount of time, slowing down tests. But\n * wiping the contents of an instance using `init` is very fast.\n */\n static create(options?: {\n ids?: TestCacheId[];\n disableDocker?: boolean;\n }): TestCaches {\n const ids = options?.ids;\n const disableDocker = options?.disableDocker ?? isDockerDisabledForTests();\n\n let testCacheIds: TestCacheId[];\n if (ids) {\n testCacheIds = ids;\n } else if (TestCaches.defaultIds) {\n testCacheIds = TestCaches.defaultIds;\n } else {\n testCacheIds = Object.keys(allCaches) as TestCacheId[];\n }\n\n const supportedIds = testCacheIds.filter(id => {\n const properties = allCaches[id];\n if (!properties) {\n return false;\n }\n // If the caller has set up the env with an explicit connection string,\n // we'll assume that this target will work\n if (\n properties.connectionStringEnvironmentVariableName &&\n process.env[properties.connectionStringEnvironmentVariableName]\n ) {\n return true;\n }\n // If the cache doesn't require docker at all, there's nothing to worry\n // about\n if (!properties.dockerImageName) {\n return true;\n }\n // If the cache requires docker, but docker is disabled, we will fail.\n if (disableDocker) {\n return false;\n }\n return true;\n });\n\n const caches = new TestCaches(supportedIds);\n\n if (supportedIds.length > 0) {\n afterAll(async () => {\n await caches.shutdown();\n });\n }\n\n return caches;\n }\n\n static setDefaults(options: { ids?: TestCacheId[] }) {\n TestCaches.defaultIds = options.ids;\n }\n\n private constructor(supportedIds: TestCacheId[]) {\n this.instanceById = new Map();\n this.supportedIds = supportedIds;\n }\n\n supports(id: TestCacheId): boolean {\n return this.supportedIds.includes(id);\n }\n\n eachSupportedId(): [TestCacheId][] {\n return this.supportedIds.map(id => [id]);\n }\n\n /**\n * Returns a fresh, empty cache for the given driver.\n *\n * @param id - The ID of the cache to use, e.g. 'REDIS_7'\n * @returns Cache connection properties\n */\n async init(\n id: TestCacheId,\n ): Promise<{ store: string; connection: string; keyv: Keyv }> {\n const properties = allCaches[id];\n if (!properties) {\n const candidates = Object.keys(allCaches).join(', ');\n throw new Error(\n `Unknown test cache ${id}, possible values are ${candidates}`,\n );\n }\n if (!this.supportedIds.includes(id)) {\n const candidates = this.supportedIds.join(', ');\n throw new Error(\n `Unsupported test cache ${id} for this environment, possible values are ${candidates}`,\n );\n }\n\n // Ensure that a testcontainers instance is up for this ID\n let instance: Instance | undefined = this.instanceById.get(id);\n if (!instance) {\n instance = await this.initAny(properties);\n this.instanceById.set(id, instance);\n }\n\n // Ensure that it's cleared of data from previous tests\n await instance.keyv.clear();\n\n return {\n store: instance.store,\n connection: instance.connection,\n keyv: instance.keyv,\n };\n }\n\n private async initAny(properties: TestCacheProperties): Promise<Instance> {\n switch (properties.store) {\n case 'memcache':\n return this.initMemcached(properties);\n case 'redis':\n return this.initRedis(properties);\n case 'valkey':\n return this.initValkey(properties);\n case 'memory':\n return {\n store: 'memory',\n connection: 'memory',\n keyv: new Keyv(),\n stop: async () => {},\n };\n default:\n throw new Error(`Unknown cache store '${properties.store}'`);\n }\n }\n\n private async initMemcached(\n properties: TestCacheProperties,\n ): Promise<Instance> {\n // Use the connection string if provided\n const envVarName = properties.connectionStringEnvironmentVariableName;\n if (envVarName) {\n const connectionString = process.env[envVarName];\n if (connectionString) {\n return connectToExternalMemcache(connectionString);\n }\n }\n\n return await startMemcachedContainer(properties.dockerImageName!);\n }\n\n private async initRedis(properties: TestCacheProperties): Promise<Instance> {\n // Use the connection string if provided\n const envVarName = properties.connectionStringEnvironmentVariableName;\n if (envVarName) {\n const connectionString = process.env[envVarName];\n if (connectionString) {\n return connectToExternalRedis(connectionString);\n }\n }\n\n return await startRedisContainer(properties.dockerImageName!);\n }\n\n private async initValkey(properties: TestCacheProperties): Promise<Instance> {\n // Use the connection string if provided\n const envVarName = properties.connectionStringEnvironmentVariableName;\n if (envVarName) {\n const connectionString = process.env[envVarName];\n if (connectionString) {\n return connectToExternalValkey(connectionString);\n }\n }\n\n return await startValkeyContainer(properties.dockerImageName!);\n }\n\n private async shutdown() {\n const instances = [...this.instanceById.values()];\n this.instanceById.clear();\n await Promise.all(\n instances.map(({ stop }) =>\n stop().catch(error => {\n console.warn(`TestCaches: Failed to stop container`, { error });\n }),\n ),\n );\n }\n}\n"],"names":["isDockerDisabledForTests","allCaches","Keyv","connectToExternalMemcache","startMemcachedContainer","connectToExternalRedis","startRedisContainer","connectToExternalValkey","startValkeyContainer"],"mappings":";;;;;;;;;;;;;AA6BO,MAAM,UAAW,CAAA;AAAA,EACL,YAAA;AAAA,EACA,YAAA;AAAA,EACjB,OAAe,UAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYf,OAAO,OAAO,OAGC,EAAA;AACb,IAAA,MAAM,MAAM,OAAS,EAAA,GAAA;AACrB,IAAM,MAAA,aAAA,GAAgB,OAAS,EAAA,aAAA,IAAiBA,iDAAyB,EAAA;AAEzE,IAAI,IAAA,YAAA;AACJ,IAAA,IAAI,GAAK,EAAA;AACP,MAAe,YAAA,GAAA,GAAA;AAAA,KACjB,MAAA,IAAW,WAAW,UAAY,EAAA;AAChC,MAAA,YAAA,GAAe,UAAW,CAAA,UAAA;AAAA,KACrB,MAAA;AACL,MAAe,YAAA,GAAA,MAAA,CAAO,KAAKC,eAAS,CAAA;AAAA;AAGtC,IAAM,MAAA,YAAA,GAAe,YAAa,CAAA,MAAA,CAAO,CAAM,EAAA,KAAA;AAC7C,MAAM,MAAA,UAAA,GAAaA,gBAAU,EAAE,CAAA;AAC/B,MAAA,IAAI,CAAC,UAAY,EAAA;AACf,QAAO,OAAA,KAAA;AAAA;AAIT,MAAA,IACE,WAAW,u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AAM,YAAY,CAAC,GAAG,IAAK,CAAA,YAAA,CAAa,QAAQ,CAAA;AAChD,IAAA,IAAA,CAAK,aAAa,KAAM,EAAA;AACxB,IAAA,MAAM,OAAQ,CAAA,GAAA;AAAA,MACZ,SAAU,CAAA,GAAA;AAAA,QAAI,CAAC,EAAE,IAAA,OACf,IAAK,EAAA,CAAE,MAAM,CAAS,KAAA,KAAA;AACpB,UAAA,OAAA,CAAQ,IAAK,CAAA,CAAA,oCAAA,CAAA,EAAwC,EAAE,KAAA,EAAO,CAAA;AAAA,SAC/D;AAAA;AACH,KACF;AAAA;AAEJ;;;;"}
@@ -18,6 +18,12 @@ const allCaches = Object.freeze({
18
18
  MEMORY: {
19
19
  name: "In-memory",
20
20
  store: "memory"
21
+ },
22
+ VALKEY_8: {
23
+ name: "Valkey 8.x",
24
+ store: "valkey",
25
+ dockerImageName: getDockerImageForName.getDockerImageForName("valkey/valkey:8"),
26
+ connectionStringEnvironmentVariableName: "BACKSTAGE_TEST_CACHE_VALKEY8_CONNECTION_STRING"
21
27
  }
22
28
  });
23
29
 
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs.js","sources":["../../src/cache/types.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Keyv from 'keyv';\nimport { getDockerImageForName } from '../util/getDockerImageForName';\n\n/**\n * The possible caches to test against.\n *\n * @public\n */\nexport type TestCacheId = 'MEMORY' | 'REDIS_7' | 'MEMCACHED_1';\n\nexport type TestCacheProperties = {\n name: string;\n store: string;\n dockerImageName?: string;\n connectionStringEnvironmentVariableName?: string;\n};\n\nexport type Instance = {\n store: string;\n connection: string;\n keyv: Keyv;\n stop: () => Promise<void>;\n};\n\nexport const allCaches: Record<TestCacheId, TestCacheProperties> =\n Object.freeze({\n REDIS_7: {\n name: 'Redis 7.x',\n store: 'redis',\n dockerImageName: getDockerImageForName('redis:7'),\n connectionStringEnvironmentVariableName:\n 'BACKSTAGE_TEST_CACHE_REDIS7_CONNECTION_STRING',\n },\n MEMCACHED_1: {\n name: 'Memcached 1.x',\n store: 'memcache',\n dockerImageName: getDockerImageForName('memcached:1'),\n connectionStringEnvironmentVariableName:\n 'BACKSTAGE_TEST_CACHE_MEMCACHED1_CONNECTION_STRING',\n },\n MEMORY: {\n name: 'In-memory',\n store: 'memory',\n },\n });\n"],"names":["getDockerImageForName"],"mappings":";;;;AAwCa,MAAA,SAAA,GACX,OAAO,MAAO,CAAA;AAAA,EACZ,OAAS,EAAA;AAAA,IACP,IAAM,EAAA,WAAA;AAAA,IACN,KAAO,EAAA,OAAA;AAAA,IACP,eAAA,EAAiBA,4CAAsB,SAAS,CAAA;AAAA,IAChD,uCACE,EAAA;AAAA,GACJ;AAAA,EACA,WAAa,EAAA;AAAA,IACX,IAAM,EAAA,eAAA;AAAA,IACN,KAAO,EAAA,UAAA;AAAA,IACP,eAAA,EAAiBA,4CAAsB,aAAa,CAAA;AAAA,IACpD,uCACE,EAAA;AAAA,GACJ;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA,WAAA;AAAA,IACN,KAAO,EAAA;AAAA;AAEX,CAAC;;;;"}
1
+ {"version":3,"file":"types.cjs.js","sources":["../../src/cache/types.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Keyv from 'keyv';\nimport { getDockerImageForName } from '../util/getDockerImageForName';\n\n/**\n * The possible caches to test against.\n *\n * @public\n */\nexport type TestCacheId = 'MEMORY' | 'REDIS_7' | 'VALKEY_8' | 'MEMCACHED_1';\n\nexport type TestCacheProperties = {\n name: string;\n store: string;\n dockerImageName?: string;\n connectionStringEnvironmentVariableName?: string;\n};\n\nexport type Instance = {\n store: string;\n connection: string;\n keyv: Keyv;\n stop: () => Promise<void>;\n};\n\nexport const allCaches: Record<TestCacheId, TestCacheProperties> =\n Object.freeze({\n REDIS_7: {\n name: 'Redis 7.x',\n store: 'redis',\n dockerImageName: getDockerImageForName('redis:7'),\n connectionStringEnvironmentVariableName:\n 'BACKSTAGE_TEST_CACHE_REDIS7_CONNECTION_STRING',\n },\n MEMCACHED_1: {\n name: 'Memcached 1.x',\n store: 'memcache',\n dockerImageName: getDockerImageForName('memcached:1'),\n connectionStringEnvironmentVariableName:\n 'BACKSTAGE_TEST_CACHE_MEMCACHED1_CONNECTION_STRING',\n },\n MEMORY: {\n name: 'In-memory',\n store: 'memory',\n },\n VALKEY_8: {\n name: 'Valkey 8.x',\n store: 'valkey',\n dockerImageName: getDockerImageForName('valkey/valkey:8'),\n connectionStringEnvironmentVariableName:\n 'BACKSTAGE_TEST_CACHE_VALKEY8_CONNECTION_STRING',\n },\n });\n"],"names":["getDockerImageForName"],"mappings":";;;;AAwCa,MAAA,SAAA,GACX,OAAO,MAAO,CAAA;AAAA,EACZ,OAAS,EAAA;AAAA,IACP,IAAM,EAAA,WAAA;AAAA,IACN,KAAO,EAAA,OAAA;AAAA,IACP,eAAA,EAAiBA,4CAAsB,SAAS,CAAA;AAAA,IAChD,uCACE,EAAA;AAAA,GACJ;AAAA,EACA,WAAa,EAAA;AAAA,IACX,IAAM,EAAA,eAAA;AAAA,IACN,KAAO,EAAA,UAAA;AAAA,IACP,eAAA,EAAiBA,4CAAsB,aAAa,CAAA;AAAA,IACpD,uCACE,EAAA;AAAA,GACJ;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA,WAAA;AAAA,IACN,KAAO,EAAA;AAAA,GACT;AAAA,EACA,QAAU,EAAA;AAAA,IACR,IAAM,EAAA,YAAA;AAAA,IACN,KAAO,EAAA,QAAA;AAAA,IACP,eAAA,EAAiBA,4CAAsB,iBAAiB,CAAA;AAAA,IACxD,uCACE,EAAA;AAAA;AAEN,CAAC;;;;"}
@@ -0,0 +1,62 @@
1
+ 'use strict';
2
+
3
+ var Keyv = require('keyv');
4
+ var KeyvValkey = require('@keyv/valkey');
5
+ var uuid = require('uuid');
6
+
7
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
8
+
9
+ var Keyv__default = /*#__PURE__*/_interopDefaultCompat(Keyv);
10
+ var KeyvValkey__default = /*#__PURE__*/_interopDefaultCompat(KeyvValkey);
11
+
12
+ async function attemptValkeyConnection(connection) {
13
+ const startTime = Date.now();
14
+ for (; ; ) {
15
+ try {
16
+ const store = new KeyvValkey__default.default(connection);
17
+ const keyv = new Keyv__default.default({ store });
18
+ const value = uuid.v4();
19
+ await keyv.set("test", value);
20
+ if (await keyv.get("test") === value) {
21
+ return keyv;
22
+ }
23
+ } catch (e) {
24
+ if (Date.now() - startTime > 3e4) {
25
+ throw new Error(
26
+ `Timed out waiting for valkey to be ready for connections, ${e}`
27
+ );
28
+ }
29
+ }
30
+ await new Promise((resolve) => setTimeout(resolve, 100));
31
+ }
32
+ }
33
+ async function connectToExternalValkey(connection) {
34
+ const keyv = await attemptValkeyConnection(connection);
35
+ return {
36
+ store: "valkey",
37
+ connection,
38
+ keyv,
39
+ stop: async () => await keyv.disconnect()
40
+ };
41
+ }
42
+ async function startValkeyContainer(image) {
43
+ const { GenericContainer } = require("testcontainers");
44
+ const container = await new GenericContainer(image).withExposedPorts(6379).start();
45
+ const host = container.getHost();
46
+ const port = container.getMappedPort(6379);
47
+ const connection = `redis://${host}:${port}`;
48
+ const keyv = await attemptValkeyConnection(connection);
49
+ return {
50
+ store: "valkey",
51
+ connection,
52
+ keyv,
53
+ stop: async () => {
54
+ await keyv.disconnect();
55
+ await container.stop({ timeout: 1e4 });
56
+ }
57
+ };
58
+ }
59
+
60
+ exports.connectToExternalValkey = connectToExternalValkey;
61
+ exports.startValkeyContainer = startValkeyContainer;
62
+ //# sourceMappingURL=valkey.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"valkey.cjs.js","sources":["../../src/cache/valkey.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Keyv from 'keyv';\nimport KeyvValkey from '@keyv/valkey';\nimport { v4 as uuid } from 'uuid';\nimport { Instance } from './types';\n\nasync function attemptValkeyConnection(connection: string): Promise<Keyv> {\n const startTime = Date.now();\n\n for (;;) {\n try {\n const store = new KeyvValkey(connection);\n const keyv = new Keyv({ store });\n const value = uuid();\n await keyv.set('test', value);\n if ((await keyv.get('test')) === value) {\n return keyv;\n }\n } catch (e) {\n if (Date.now() - startTime > 30_000) {\n throw new Error(\n `Timed out waiting for valkey to be ready for connections, ${e}`,\n );\n }\n }\n\n await new Promise(resolve => setTimeout(resolve, 100));\n }\n}\n\nexport async function connectToExternalValkey(\n connection: string,\n): Promise<Instance> {\n const keyv = await attemptValkeyConnection(connection);\n return {\n store: 'valkey',\n connection,\n keyv,\n stop: async () => await keyv.disconnect(),\n };\n}\n\nexport async function startValkeyContainer(image: string): Promise<Instance> {\n // Lazy-load to avoid side-effect of importing testcontainers\n const { GenericContainer } =\n require('testcontainers') as typeof import('testcontainers');\n\n const container = await new GenericContainer(image)\n .withExposedPorts(6379)\n .start();\n\n const host = container.getHost();\n const port = container.getMappedPort(6379);\n const connection = `redis://${host}:${port}`;\n\n const keyv = await attemptValkeyConnection(connection);\n\n return {\n store: 'valkey',\n connection,\n keyv,\n stop: async () => {\n await keyv.disconnect();\n await container.stop({ timeout: 10_000 });\n },\n };\n}\n"],"names":["KeyvValkey","Keyv","uuid"],"mappings":";;;;;;;;;;;AAqBA,eAAe,wBAAwB,UAAmC,EAAA;AACxE,EAAM,MAAA,SAAA,GAAY,KAAK,GAAI,EAAA;AAE3B,EAAS,WAAA;AACP,IAAI,IAAA;AACF,MAAM,MAAA,KAAA,GAAQ,IAAIA,2BAAA,CAAW,UAAU,CAAA;AACvC,MAAA,MAAM,IAAO,GAAA,IAAIC,qBAAK,CAAA,EAAE,OAAO,CAAA;AAC/B,MAAA,MAAM,QAAQC,OAAK,EAAA;AACnB,MAAM,MAAA,IAAA,CAAK,GAAI,CAAA,MAAA,EAAQ,KAAK,CAAA;AAC5B,MAAA,IAAK,MAAM,IAAA,CAAK,GAAI,CAAA,MAAM,MAAO,KAAO,EAAA;AACtC,QAAO,OAAA,IAAA;AAAA;AACT,aACO,CAAG,EAAA;AACV,MAAA,IAAI,IAAK,CAAA,GAAA,EAAQ,GAAA,SAAA,GAAY,GAAQ,EAAA;AACnC,QAAA,MAAM,IAAI,KAAA;AAAA,UACR,6DAA6D,CAAC,CAAA;AAAA,SAChE;AAAA;AACF;AAGF,IAAA,MAAM,IAAI,OAAQ,CAAA,CAAA,OAAA,KAAW,UAAW,CAAA,OAAA,EAAS,GAAG,CAAC,CAAA;AAAA;AAEzD;AAEA,eAAsB,wBACpB,UACmB,EAAA;AACnB,EAAM,MAAA,IAAA,GAAO,MAAM,uBAAA,CAAwB,UAAU,CAAA;AACrD,EAAO,OAAA;AAAA,IACL,KAAO,EAAA,QAAA;AAAA,IACP,UAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAM,EAAA,YAAY,MAAM,IAAA,CAAK,UAAW;AAAA,GAC1C;AACF;AAEA,eAAsB,qBAAqB,KAAkC,EAAA;AAE3E,EAAA,MAAM,EAAE,gBAAA,EACN,GAAA,OAAA,CAAQ,gBAAgB,CAAA;AAE1B,EAAM,MAAA,SAAA,GAAY,MAAM,IAAI,gBAAA,CAAiB,KAAK,CAC/C,CAAA,gBAAA,CAAiB,IAAI,CAAA,CACrB,KAAM,EAAA;AAET,EAAM,MAAA,IAAA,GAAO,UAAU,OAAQ,EAAA;AAC/B,EAAM,MAAA,IAAA,GAAO,SAAU,CAAA,aAAA,CAAc,IAAI,CAAA;AACzC,EAAA,MAAM,UAAa,GAAA,CAAA,QAAA,EAAW,IAAI,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA;AAE1C,EAAM,MAAA,IAAA,GAAO,MAAM,uBAAA,CAAwB,UAAU,CAAA;AAErD,EAAO,OAAA;AAAA,IACL,KAAO,EAAA,QAAA;AAAA,IACP,UAAA;AAAA,IACA,IAAA;AAAA,IACA,MAAM,YAAY;AAChB,MAAA,MAAM,KAAK,UAAW,EAAA;AACtB,MAAA,MAAM,SAAU,CAAA,IAAA,CAAK,EAAE,OAAA,EAAS,KAAQ,CAAA;AAAA;AAC1C,GACF;AACF;;;;;"}
package/dist/index.d.ts CHANGED
@@ -15,7 +15,7 @@ import * as express_serve_static_core from 'express-serve-static-core';
15
15
  *
16
16
  * @public
17
17
  */
18
- type TestCacheId = 'MEMORY' | 'REDIS_7' | 'MEMCACHED_1';
18
+ type TestCacheId = 'MEMORY' | 'REDIS_7' | 'VALKEY_8' | 'MEMCACHED_1';
19
19
 
20
20
  /**
21
21
  * Encapsulates the creation of ephemeral test cache instances for use inside
@@ -61,6 +61,7 @@ declare class TestCaches {
61
61
  private initAny;
62
62
  private initMemcached;
63
63
  private initRedis;
64
+ private initValkey;
64
65
  private shutdown;
65
66
  }
66
67
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/backend-test-utils",
3
- "version": "1.5.0-next.0",
3
+ "version": "1.5.0-next.2",
4
4
  "description": "Test helpers library for Backstage backends",
5
5
  "backstage": {
6
6
  "role": "node-library"
@@ -49,16 +49,17 @@
49
49
  "test": "backstage-cli package test"
50
50
  },
51
51
  "dependencies": {
52
- "@backstage/backend-app-api": "1.2.3-next.0",
53
- "@backstage/backend-defaults": "0.9.1-next.0",
54
- "@backstage/backend-plugin-api": "1.3.1-next.0",
52
+ "@backstage/backend-app-api": "1.2.3-next.1",
53
+ "@backstage/backend-defaults": "0.10.0-next.2",
54
+ "@backstage/backend-plugin-api": "1.3.1-next.1",
55
55
  "@backstage/config": "1.3.2",
56
56
  "@backstage/errors": "1.2.7",
57
- "@backstage/plugin-auth-node": "0.6.3-next.0",
58
- "@backstage/plugin-events-node": "0.4.11-next.0",
57
+ "@backstage/plugin-auth-node": "0.6.3-next.1",
58
+ "@backstage/plugin-events-node": "0.4.11-next.1",
59
59
  "@backstage/types": "1.2.1",
60
60
  "@keyv/memcache": "^2.0.1",
61
61
  "@keyv/redis": "^4.0.1",
62
+ "@keyv/valkey": "^1.0.1",
62
63
  "@types/express": "^4.17.6",
63
64
  "@types/express-serve-static-core": "^4.17.5",
64
65
  "@types/keyv": "^4.2.0",
@@ -78,7 +79,7 @@
78
79
  "yn": "^4.0.0"
79
80
  },
80
81
  "devDependencies": {
81
- "@backstage/cli": "0.32.1-next.0",
82
+ "@backstage/cli": "0.32.1-next.2",
82
83
  "@types/jest": "*",
83
84
  "@types/supertest": "^2.0.8",
84
85
  "supertest": "^7.0.0"