Skip to content

Commit

Permalink
fix: config.json files and add template config test (#1998)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcroote authored May 13, 2024
1 parent 9261e5b commit 228d91d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .changeset/young-seahorses-crash.md
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"heartbeat": {
"enabled": true,
"apiKey": "${HEARTBEAT_API_KEY}",
"id": "${HEARTBEAT_ID}",
"url": "${HEARTBEAT_URL}"
},
"httpGateway": {
Expand Down
10 changes: 6 additions & 4 deletions packages/airnode-deployer/test/fixtures/config.gcp.valid.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@
{
"maxConcurrency": 100,
"authorizers": {
"requesterEndpointAuthorizers": []
"requesterEndpointAuthorizers": [],
"crossChainRequesterAuthorizers": [],
"requesterAuthorizersWithErc721": [],
"crossChainRequesterAuthorizersWithErc721": []
},
"authorizations": {
"requesterEndpointAuthorizations": {}
},
"contracts": {
"AirnodeRrp": "0x534DfA0d242e7fDCFD096C2B1a3D70F172008778"
},
"id": "4",
"id": "11155111",
"providers": {
"rinkeby": {
"sepolia": {
"url": "${PROVIDER_URL}"
}
},
Expand All @@ -37,7 +40,6 @@
"heartbeat": {
"enabled": true,
"apiKey": "${HEARTBEAT_API_KEY}",
"id": "${HEARTBEAT_ID}",
"url": "${HEARTBEAT_URL}"
},
"httpGateway": {
Expand Down
17 changes: 17 additions & 0 deletions packages/airnode-validator/src/config/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"', () => {
Expand Down

0 comments on commit 228d91d

Please sign in to comment.