From 228d91d7fd08f370dd852787c8eae1174d84aefa Mon Sep 17 00:00:00 2001 From: Derek Croote Date: Mon, 13 May 2024 07:25:02 -0700 Subject: [PATCH] fix: config.json files and add template config test (#1998) --- .changeset/young-seahorses-crash.md | 6 ++++++ .../test/fixtures/config.aws.valid.json | 1 - .../test/fixtures/config.gcp.valid.json | 10 ++++++---- .../airnode-validator/src/config/config.test.ts | 17 +++++++++++++++++ 4 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 .changeset/young-seahorses-crash.md diff --git a/.changeset/young-seahorses-crash.md b/.changeset/young-seahorses-crash.md new file mode 100644 index 0000000000..83672e32cc --- /dev/null +++ b/.changeset/young-seahorses-crash.md @@ -0,0 +1,6 @@ +--- +"@api3/airnode-validator": patch +"@api3/airnode-deployer": patch +--- + +Fix deployer test config files and add an airnode-validator valid template test diff --git a/packages/airnode-deployer/test/fixtures/config.aws.valid.json b/packages/airnode-deployer/test/fixtures/config.aws.valid.json index 01de4f359d..cb134518a1 100644 --- a/packages/airnode-deployer/test/fixtures/config.aws.valid.json +++ b/packages/airnode-deployer/test/fixtures/config.aws.valid.json @@ -40,7 +40,6 @@ "heartbeat": { "enabled": true, "apiKey": "${HEARTBEAT_API_KEY}", - "id": "${HEARTBEAT_ID}", "url": "${HEARTBEAT_URL}" }, "httpGateway": { diff --git a/packages/airnode-deployer/test/fixtures/config.gcp.valid.json b/packages/airnode-deployer/test/fixtures/config.gcp.valid.json index 105f4e7d75..7ce1d2013c 100644 --- a/packages/airnode-deployer/test/fixtures/config.gcp.valid.json +++ b/packages/airnode-deployer/test/fixtures/config.gcp.valid.json @@ -3,7 +3,10 @@ { "maxConcurrency": 100, "authorizers": { - "requesterEndpointAuthorizers": [] + "requesterEndpointAuthorizers": [], + "crossChainRequesterAuthorizers": [], + "requesterAuthorizersWithErc721": [], + "crossChainRequesterAuthorizersWithErc721": [] }, "authorizations": { "requesterEndpointAuthorizations": {} @@ -11,9 +14,9 @@ "contracts": { "AirnodeRrp": "0x534DfA0d242e7fDCFD096C2B1a3D70F172008778" }, - "id": "4", + "id": "11155111", "providers": { - "rinkeby": { + "sepolia": { "url": "${PROVIDER_URL}" } }, @@ -37,7 +40,6 @@ "heartbeat": { "enabled": true, "apiKey": "${HEARTBEAT_API_KEY}", - "id": "${HEARTBEAT_ID}", "url": "${HEARTBEAT_URL}" }, "httpGateway": { diff --git a/packages/airnode-validator/src/config/config.test.ts b/packages/airnode-validator/src/config/config.test.ts index aa1b605999..789c49c7bf 100644 --- a/packages/airnode-validator/src/config/config.test.ts +++ b/packages/airnode-validator/src/config/config.test.ts @@ -291,6 +291,23 @@ describe('templates', () => { ]) ); }); + + it('allows a valid template', () => { + const config = JSON.parse( + readFileSync(join(__dirname, '../../test/fixtures/interpolated-config.valid.json')).toString() + ); + config.nodeSettings.airnodeWalletMnemonic = + 'answer tobacco wave sausage age report congress cannon fever hammer happy budget'; + const validTemplates = [ + { + templateId: '0x0058c1abb08d25f0c397673931eb30b94682f47a7d2509e6eebb92fc8b292a3c', + endpointId: '0xfb87102cdabadf905321521ba0b3cbf74ad09c5d400ac2eccdbef8d6143e78c4', + encodedParameters: + '0x3173000000000000000000000000000000000000000000000000000000000000636f696e49640000000000000000000000000000000000000000000000000000657468657265756d000000000000000000000000000000000000000000000000', + }, + ]; + expect(() => configSchema.parse({ ...config, templates: validTemplates })).not.toThrow(); + }); }); it('fails if a securitySchemeName is enabled and it is of type "apiKey" or "http" but is missing credentials in "apiCredentials"', () => {