Skip to content

Commit

Permalink
[#204] Upon adding a second acceptor update the port number
Browse files Browse the repository at this point in the history
When user adds a second acceptor, updated port number to 5555+n instead of a static 5555.
  • Loading branch information
Msarawan committed Jul 26, 2024
1 parent d7d7b63 commit 91a9864
Show file tree
Hide file tree
Showing 4 changed files with 199 additions and 8 deletions.
120 changes: 120 additions & 0 deletions src/reducers/7.12/reducer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ describe('test the creation broker reducer', () => {
const initialState = newArtemisCRState('namespace');
const newState = artemisCrReducer(initialState, {
operation: ArtemisReducerOperations.addAcceptor,
payload: {
name: 'acceptors0',
port: 5555,
},
});
expect(newState.cr.spec.acceptors).toHaveLength(1);
expect(newState.cr.spec.acceptors[0].name).toBe('acceptors0');
Expand All @@ -34,6 +38,10 @@ describe('test the creation broker reducer', () => {
const initialState = newArtemisCRState('namespace');
const newState = artemisCrReducer(initialState, {
operation: ArtemisReducerOperations.addConnector,
payload: {
name: 'connectors0',
port: 5555,
},
});
expect(newState.cr.spec.connectors).toHaveLength(1);
expect(newState.cr.spec.connectors[0].name).toBe('connectors0');
Expand Down Expand Up @@ -70,6 +78,10 @@ describe('test the creation broker reducer', () => {
const initialState = newArtemisCRState('namespace');
const stateWith1Acceptor = artemisCrReducer(initialState, {
operation: ArtemisReducerOperations.addAcceptor,
payload: {
name: 'acceptors0',
port: 5555,
},
});
const newState2 = artemisCrReducer(stateWith1Acceptor, {
operation: ArtemisReducerOperations.deleteAcceptor,
Expand All @@ -85,6 +97,10 @@ describe('test the creation broker reducer', () => {
const initialState = newArtemisCRState('namespace');
const stateWith1Connector = artemisCrReducer(initialState, {
operation: ArtemisReducerOperations.addConnector,
payload: {
name: 'connectors0',
port: 5555,
},
});
const newState2 = artemisCrReducer(stateWith1Connector, {
operation: ArtemisReducerOperations.deleteConnector,
Expand Down Expand Up @@ -118,6 +134,10 @@ describe('test the creation broker reducer', () => {
const initialState = newArtemisCRState('namespace');
const stateWith1Acceptor = artemisCrReducer(initialState, {
operation: ArtemisReducerOperations.addAcceptor,
payload: {
name: 'acceptors0',
port: 5555,
},
});
expect(stateWith1Acceptor.cr.spec.acceptors[0].bindToAllInterfaces).toBe(
undefined,
Expand All @@ -144,6 +164,10 @@ describe('test the creation broker reducer', () => {
const initialState = newArtemisCRState('namespace');
const stateWith1Acceptor = artemisCrReducer(initialState, {
operation: ArtemisReducerOperations.addAcceptor,
payload: {
name: 'acceptors0',
port: 5555,
},
});
const newState2 = artemisCrReducer(stateWith1Acceptor, {
operation: ArtemisReducerOperations.setAcceptorName,
Expand All @@ -162,9 +186,17 @@ describe('test the creation broker reducer', () => {
const initialState = newArtemisCRState('namespace');
const stateWith1Acceptor = artemisCrReducer(initialState, {
operation: ArtemisReducerOperations.addAcceptor,
payload: {
name: 'acceptors0',
port: 5555,
},
});
const stateWith2Acceptor = artemisCrReducer(stateWith1Acceptor, {
operation: ArtemisReducerOperations.addAcceptor,
payload: {
name: 'acceptors0',
port: 5555,
},
});
const newState3 = artemisCrReducer(stateWith2Acceptor, {
operation: ArtemisReducerOperations.setAcceptorName,
Expand All @@ -181,6 +213,10 @@ describe('test the creation broker reducer', () => {
const initialState = newArtemisCRState('namespace');
const stateWith1Acceptor = artemisCrReducer(initialState, {
operation: ArtemisReducerOperations.addAcceptor,
payload: {
name: 'acceptors0',
port: 5555,
},
});
const newState2 = artemisCrReducer(stateWith1Acceptor, {
operation: ArtemisReducerOperations.setAcceptorOtherParams,
Expand Down Expand Up @@ -217,6 +253,10 @@ describe('test the creation broker reducer', () => {
const initialState = newArtemisCRState('namespace');
const stateWith1Acceptor = artemisCrReducer(initialState, {
operation: ArtemisReducerOperations.addAcceptor,
payload: {
name: 'acceptors0',
port: 5555,
},
});
const newState2 = artemisCrReducer(stateWith1Acceptor, {
operation: ArtemisReducerOperations.setAcceptorPort,
Expand All @@ -232,6 +272,10 @@ describe('test the creation broker reducer', () => {
const initialState = newArtemisCRState('namespace');
const stateWith1Acceptor = artemisCrReducer(initialState, {
operation: ArtemisReducerOperations.addAcceptor,
payload: {
name: 'acceptors0',
port: 5555,
},
});
const newState2 = artemisCrReducer(stateWith1Acceptor, {
operation: ArtemisReducerOperations.setAcceptorProtocols,
Expand All @@ -247,6 +291,10 @@ describe('test the creation broker reducer', () => {
const initialState = newArtemisCRState('namespace');
const stateWith1Acceptor = artemisCrReducer(initialState, {
operation: ArtemisReducerOperations.addAcceptor,
payload: {
name: 'acceptors0',
port: 5555,
},
});
const newState2 = artemisCrReducer(stateWith1Acceptor, {
operation: ArtemisReducerOperations.setAcceptorSSLEnabled,
Expand All @@ -262,6 +310,10 @@ describe('test the creation broker reducer', () => {
const initialState = newArtemisCRState('namespace');
const stateWith1Acceptor = artemisCrReducer(initialState, {
operation: ArtemisReducerOperations.addAcceptor,
payload: {
name: 'acceptors0',
port: 5555,
},
});
const newState2 = artemisCrReducer(stateWith1Acceptor, {
operation: ArtemisReducerOperations.setAcceptorSecret,
Expand Down Expand Up @@ -297,6 +349,10 @@ describe('test the creation broker reducer', () => {
const initialState = newArtemisCRState('namespace');
const stateWith1Connector = artemisCrReducer(initialState, {
operation: ArtemisReducerOperations.addConnector,
payload: {
name: 'connectors0',
port: 5555,
},
});
expect(stateWith1Connector.cr.spec.connectors[0].bindToAllInterfaces).toBe(
undefined,
Expand All @@ -323,6 +379,10 @@ describe('test the creation broker reducer', () => {
const initialState = newArtemisCRState('namespace');
const stateWith1Connector = artemisCrReducer(initialState, {
operation: ArtemisReducerOperations.addConnector,
payload: {
name: 'connectors0',
port: 5555,
},
});
const newState2 = artemisCrReducer(stateWith1Connector, {
operation: ArtemisReducerOperations.setConnectorHost,
Expand All @@ -338,6 +398,10 @@ describe('test the creation broker reducer', () => {
const initialState = newArtemisCRState('namespace');
const stateWith1Connector = artemisCrReducer(initialState, {
operation: ArtemisReducerOperations.addConnector,
payload: {
name: 'connectors0',
port: 5555,
},
});
const newState2 = artemisCrReducer(stateWith1Connector, {
operation: ArtemisReducerOperations.setConnectorName,
Expand All @@ -356,9 +420,17 @@ describe('test the creation broker reducer', () => {
const initialState = newArtemisCRState('namespace');
const stateWith1Connector = artemisCrReducer(initialState, {
operation: ArtemisReducerOperations.addConnector,
payload: {
name: 'connectors0',
port: 5555,
},
});
const stateWith2Connector = artemisCrReducer(stateWith1Connector, {
operation: ArtemisReducerOperations.addConnector,
payload: {
name: 'connectors0',
port: 5555,
},
});
const newState3 = artemisCrReducer(stateWith2Connector, {
operation: ArtemisReducerOperations.setConnectorName,
Expand All @@ -375,6 +447,10 @@ describe('test the creation broker reducer', () => {
const initialState = newArtemisCRState('namespace');
const stateWith1Connector = artemisCrReducer(initialState, {
operation: ArtemisReducerOperations.addConnector,
payload: {
name: 'connectors0',
port: 5555,
},
});
const newState2 = artemisCrReducer(stateWith1Connector, {
operation: ArtemisReducerOperations.setConnectorOtherParams,
Expand Down Expand Up @@ -411,6 +487,10 @@ describe('test the creation broker reducer', () => {
const initialState = newArtemisCRState('namespace');
const stateWith1Connector = artemisCrReducer(initialState, {
operation: ArtemisReducerOperations.addConnector,
payload: {
name: 'connectors0',
port: 5555,
},
});
const newState2 = artemisCrReducer(stateWith1Connector, {
operation: ArtemisReducerOperations.setConnectorPort,
Expand All @@ -426,6 +506,10 @@ describe('test the creation broker reducer', () => {
const initialState = newArtemisCRState('namespace');
const stateWith1Connector = artemisCrReducer(initialState, {
operation: ArtemisReducerOperations.addConnector,
payload: {
name: 'connectors0',
port: 5555,
},
});
const newState2 = artemisCrReducer(stateWith1Connector, {
operation: ArtemisReducerOperations.setConnectorProtocols,
Expand All @@ -441,6 +525,10 @@ describe('test the creation broker reducer', () => {
const initialState = newArtemisCRState('namespace');
const stateWith1Connector = artemisCrReducer(initialState, {
operation: ArtemisReducerOperations.addConnector,
payload: {
name: 'connectors0',
port: 5555,
},
});
const newState2 = artemisCrReducer(stateWith1Connector, {
operation: ArtemisReducerOperations.setConnectorSSLEnabled,
Expand All @@ -456,6 +544,10 @@ describe('test the creation broker reducer', () => {
const initialState = newArtemisCRState('namespace');
const stateWith1Connector = artemisCrReducer(initialState, {
operation: ArtemisReducerOperations.addConnector,
payload: {
name: 'connectors0',
port: 5555,
},
});
const newState2 = artemisCrReducer(stateWith1Connector, {
operation: ArtemisReducerOperations.setConnectorSecret,
Expand Down Expand Up @@ -561,6 +653,10 @@ describe('test the creation broker reducer', () => {
const initialState = newArtemisCRState('namespace');
const stateWith1Acceptor = artemisCrReducer(initialState, {
operation: ArtemisReducerOperations.addAcceptor,
payload: {
name: 'acceptors0',
port: 5555,
},
});
const newState2 = artemisCrReducer(stateWith1Acceptor, {
operation: ArtemisReducerOperations.updateAcceptorFactoryClass,
Expand Down Expand Up @@ -588,6 +684,10 @@ describe('test the creation broker reducer', () => {
const initialState = newArtemisCRState('namespace');
const stateWith1Acceptor = artemisCrReducer(initialState, {
operation: ArtemisReducerOperations.addConnector,
payload: {
name: 'connectors0',
port: 5555,
},
});
const newState2 = artemisCrReducer(stateWith1Acceptor, {
operation: ArtemisReducerOperations.updateConnectorFactoryClass,
Expand Down Expand Up @@ -615,6 +715,10 @@ describe('test the creation broker reducer', () => {
const initialState = newArtemisCRState('namespace');
const stateWith1Acceptor = artemisCrReducer(initialState, {
operation: ArtemisReducerOperations.addAcceptor,
payload: {
name: 'acceptors0',
port: 5555,
},
});
const stateWithPEM = artemisCrReducer(stateWith1Acceptor, {
operation: ArtemisReducerOperations.activatePEMGenerationForAcceptor,
Expand Down Expand Up @@ -743,6 +847,10 @@ describe('test the creation broker reducer', () => {
const initialState = newArtemisCRState('namespace');
const stateWith1Acceptor = artemisCrReducer(initialState, {
operation: ArtemisReducerOperations.addAcceptor,
payload: {
name: 'acceptors0',
port: 5555,
},
});
const stateWithPEM = artemisCrReducer(stateWith1Acceptor, {
operation: ArtemisReducerOperations.activatePEMGenerationForAcceptor,
Expand All @@ -764,6 +872,10 @@ describe('test the creation broker reducer', () => {
const initialState = newArtemisCRState('namespace');
const stateWith1Acceptor = artemisCrReducer(initialState, {
operation: ArtemisReducerOperations.addAcceptor,
payload: {
name: 'acceptors0',
port: 5555,
},
});
const stateExposeModeIngress = artemisCrReducer(stateWith1Acceptor, {
operation: ArtemisReducerOperations.setAcceptorExposeMode,
Expand All @@ -781,6 +893,10 @@ describe('test the creation broker reducer', () => {
const initialState = newArtemisCRState('namespace');
const stateWith1Acceptor = artemisCrReducer(initialState, {
operation: ArtemisReducerOperations.addAcceptor,
payload: {
name: 'acceptors0',
port: 5555,
},
});
const stateExposeModeIngress = artemisCrReducer(stateWith1Acceptor, {
operation: ArtemisReducerOperations.setAcceptorIngressHost,
Expand All @@ -798,6 +914,10 @@ describe('test the creation broker reducer', () => {
const initialState = newArtemisCRState('namespace');
const stateWith1Acceptor = artemisCrReducer(initialState, {
operation: ArtemisReducerOperations.addAcceptor,
payload: {
name: 'acceptors0',
port: 5555,
},
});
const stateExposeModeIngress = artemisCrReducer(stateWith1Acceptor, {
operation: ArtemisReducerOperations.setIsAcceptorExposed,
Expand Down
Loading

0 comments on commit 91a9864

Please sign in to comment.