Skip to content

Commit

Permalink
added tests for alb ip CIDR format
Browse files Browse the repository at this point in the history
  • Loading branch information
Inqnuam committed Jun 8, 2023
1 parent b093f8c commit 55baef5
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/unit/lib/plugins/aws/package/compile/events/alb/index.test.js
Expand Up @@ -123,6 +123,20 @@ describe('test/unit/lib/plugins/aws/package/compile/events/alb/index.test.js', (
},
],
},
fnIpCondition: {
handler: 'index.handler',
events: [
{
alb: {
...validBaseEventConfig,
priority: 10,
conditions: {
ip: ['fe80:0000:0000:0000:0204:61ff:fe9d:f156/6', '192.168.0.1/0'],
},
},
},
],
},
},
},
});
Expand Down Expand Up @@ -347,4 +361,18 @@ describe('test/unit/lib/plugins/aws/package/compile/events/alb/index.test.js', (
expect(config3.Values[1]).to.equal('dummyMultiValue2');
});
});

describe('should set alb ip conditions', () => {
it('should allow IP CIDR format', () => {
const albListenerRuleLogicalId = naming.getAlbListenerRuleLogicalId('fnIpCondition', 10);
const conditions = cfResources[albListenerRuleLogicalId].Properties.Conditions;

expect(conditions).to.have.length(1);
const config = conditions[0].SourceIpConfig;
expect(config.Values).to.deep.equal([
'fe80:0000:0000:0000:0204:61ff:fe9d:f156/6',
'192.168.0.1/0',
]);
});
});
});

0 comments on commit 55baef5

Please sign in to comment.