Added keep-alive support for SSH sessions when connecting to a PostgreSQL server via an SSH tunnel. #7016

This commit is contained in:
Akshay Joshi
2023-12-19 16:16:03 +05:30
committed by GitHub
parent 04580652ab
commit a22b2a6074
18 changed files with 141 additions and 81 deletions

View File

@@ -73,6 +73,10 @@ describe('ServerSchema', ()=>{
expect(setError).toHaveBeenCalledWith('tunnel_identity_file', 'SSH Tunnel identity file must be specified.');
state.tunnel_identity_file = '/file/path/xyz.pem';
schemaObj.validate(state, setError);
expect(setError).toHaveBeenCalledWith('tunnel_keep_alive', 'Keep alive must be specified. Specify 0 for no keep alive.');
state.tunnel_keep_alive = 0;
expect(schemaObj.validate(state, setError)).toBe(false);
});
});

View File

@@ -86,27 +86,6 @@ describe('SubscriptionSchema', ()=>{
state.port = 5432;
schemaObj.validate(state, setError);
expect(setError).toHaveBeenCalledWith('pub', 'Publication must be specified.');
state.pub = 'testPub';
state.use_ssh_tunnel = 'Require';
schemaObj.validate(state, setError);
expect(setError).toHaveBeenCalledWith('tunnel_host', 'SSH Tunnel host must be specified.');
state.tunnel_host = 'localhost';
schemaObj.validate(state, setError);
expect(setError).toHaveBeenCalledWith('tunnel_port', 'SSH Tunnel port must be specified.');
state.tunnel_port = 8080;
schemaObj.validate(state, setError);
expect(setError).toHaveBeenCalledWith('tunnel_username', 'SSH Tunnel username must be specified.');
state.tunnel_username = 'jasmine';
state.tunnel_authentication = true;
schemaObj.validate(state, setError);
expect(setError).toHaveBeenCalledWith('tunnel_identity_file', 'SSH Tunnel identity file must be specified.');
state.tunnel_identity_file = '/file/path/xyz.pem';
expect(schemaObj.validate(state, setError)).toBe(false);
});
});