Skip to content

Commit 2b789d8

Browse files
committed
feat!: add cidr to shards
1 parent ac24ff7 commit 2b789d8

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

src/Shard.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
export interface IShardProps {
2+
/**
3+
* The CIDR block for a shard.
4+
*/
5+
readonly cidr: string;
26
/**
37
* The AWS region for a shard.
48
*/
@@ -17,10 +21,12 @@ export interface IShard extends IShardProps {
1721
}
1822

1923
export abstract class Shard implements IShard {
24+
readonly cidr: string;
2025
readonly region: string;
2126
readonly number: number;
2227

2328
constructor(props: IShardProps) {
29+
this.cidr = props.cidr;
2430
this.region = props.region;
2531
this.number = props.number;
2632
}

test/NamedEnv.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ describe('NamedEnv', () => {
4848

4949
describe('NamedEnvFactory', () => {
5050
const shard: IShard = {
51+
cidr: 'fakeCidr',
5152
region: 'us-west-2',
5253
name: 'TestShard',
5354
number: 1,

test/Shard.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,17 @@ class TestShardImpl extends Shard {
77
}
88
}
99

10-
const testShardProps: IShardProps = { region: 'us-west-2', number: 1 };
10+
const testShardProps: IShardProps = { cidr: 'fakeCidr', region: 'us-west-2', number: 1 };
1111

1212
let shard: IShard;
1313
describe('Shard', () => {
1414
beforeEach(() => {
1515
shard = new TestShardImpl(testShardProps);
1616
});
1717

18+
it('sets cidr correctly', () => {
19+
expect(shard.cidr).toEqual(testShardProps.cidr);
20+
});
1821
it('sets region correctly', () => {
1922
expect(shard.region).toEqual(testShardProps.region);
2023
});

0 commit comments

Comments
 (0)