Skip to content

Commit 633cd2d

Browse files
fellowsebCopilot
andcommitted
fix(tests): expect proxy config keys as injected in connector-migration-test
config/test.json configures http_proxy, https_proxy and no_proxy, so injectProxyConfiguration always adds HTTP_PROXY, HTTPS_PROXY, NO_PROXY, and HTTPS_PROXY_REJECT_UNAUTHORIZED (always injected regardless of config) to manager_contract_configuration in this test environment. The previous fix incorrectly assumed these were only injected when configured and therefore absent, causing the assertion on HTTP_PROXY to fail. Move these keys from EXCLUDED_RUNTIME_KEYS to INJECTED_KEYS, matching actual runtime behavior confirmed by running the integration test. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 1b1ddbc commit 633cd2d

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

opencti-platform/opencti-graphql/tests/03-integration/02-resolvers/connector-migration-test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,17 +197,19 @@ describe('Check connector migration', () => {
197197
const rawConfig = managedConnector.manager_contract_configuration;
198198

199199
// ManagedConnector.manager_contract_configuration injects these keys dynamically at read time
200-
// (see computeManagerConnectorConfiguration), they are not part of the persisted/schema-driven config.
201-
const INJECTED_KEYS = ['CONNECTOR_ID', 'CONNECTOR_NAME', 'CONNECTOR_TYPE', 'OPENCTI_TOKEN'];
200+
// (see computeManagerConnectorConfiguration / injectProxyConfiguration), they are not part of the
201+
// persisted/schema-driven config. Proxy vars are injected because config/test.json configures
202+
// http_proxy, https_proxy and no_proxy, and https_proxy_reject_unauthorized is always injected.
203+
const INJECTED_KEYS = ['CONNECTOR_ID', 'CONNECTOR_NAME', 'CONNECTOR_TYPE', 'OPENCTI_TOKEN', 'HTTP_PROXY', 'HTTPS_PROXY', 'NO_PROXY', 'HTTPS_PROXY_REJECT_UNAUTHORIZED'];
202204
INJECTED_KEYS.forEach((injectedKey) => {
203205
const found = rawConfig.find((c: { key: string }) => c.key === injectedKey);
204206
expect(found).toBeDefined();
205207
});
206208

207209
// These runtime keys are never persisted/returned in manager_contract_configuration:
208210
// OPENCTI_URL and CONNECTOR_RUN_AND_TERMINATE are excluded from the contract's config
209-
// (same exclusion as catalog-domain), and proxy vars are only injected when configured.
210-
const EXCLUDED_RUNTIME_KEYS = ['OPENCTI_URL', 'CONNECTOR_RUN_AND_TERMINATE', 'HTTP_PROXY', 'HTTPS_PROXY', 'NO_PROXY', 'HTTPS_PROXY_REJECT_UNAUTHORIZED'];
211+
// (same exclusion as catalog-domain) and never re-injected by this resolver.
212+
const EXCLUDED_RUNTIME_KEYS = ['OPENCTI_URL', 'CONNECTOR_RUN_AND_TERMINATE'];
211213
EXCLUDED_RUNTIME_KEYS.forEach((runtimeKey) => {
212214
const found = rawConfig.find((c: { key: string }) => c.key === runtimeKey);
213215
expect(found).toBeUndefined();

0 commit comments

Comments
 (0)