Skip to content

Commit

Permalink
fix(ssh_tunnel): Fix bug on database edition for databases with ssh t…
Browse files Browse the repository at this point in the history
…unnels (#23006)

Co-authored-by: Lyndsi Kay Williams <55605634+lyndsiWilliams@users.noreply.github.com>
  • Loading branch information
Antonio-RiveroMartnez and lyndsiWilliams committed Feb 8, 2023
1 parent 7bb9b81 commit ddd8d17
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1510,6 +1510,27 @@ describe('DatabaseModal', () => {
expect(allowFileUploadText).not.toBeInTheDocument();
expect(schemasForFileUploadText).not.toBeInTheDocument();
});

it('if the SSH Tunneling toggle is not displayed, nothing should get displayed', async () => {
const SSHTunnelingToggle = screen.queryByTestId('ssh-tunnel-switch');
expect(SSHTunnelingToggle).not.toBeInTheDocument();
const SSHTunnelServerAddressInput = screen.queryByTestId(
'ssh-tunnel-server_address-input',
);
expect(SSHTunnelServerAddressInput).not.toBeInTheDocument();
const SSHTunnelServerPortInput = screen.queryByTestId(
'ssh-tunnel-server_port-input',
);
expect(SSHTunnelServerPortInput).not.toBeInTheDocument();
const SSHTunnelUsernameInput = screen.queryByTestId(
'ssh-tunnel-username-input',
);
expect(SSHTunnelUsernameInput).not.toBeInTheDocument();
const SSHTunnelPasswordInput = screen.queryByTestId(
'ssh-tunnel-password-input',
);
expect(SSHTunnelPasswordInput).not.toBeInTheDocument();
});
});

describe('DatabaseModal w errors as objects', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1154,10 +1154,10 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
}, [passwordsNeeded]);

useEffect(() => {
if (db) {
if (db && isSSHTunneling) {
setUseSSHTunneling(!isEmpty(db?.ssh_tunnel));
}
}, [db]);
}, [db, isSSHTunneling]);

const onDbImport = async (info: UploadChangeParam) => {
setImportingErrorMessage('');
Expand Down

0 comments on commit ddd8d17

Please sign in to comment.