Created
September 13, 2025 08:06
-
-
Save ngotzmann/e57a6bf0ee1e682dd6c4eae626aa7dff to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function checkNodeConnection(config: any, ungroupedConfig: any) { | |
| expect(config).to.not.be.null; | |
| expect(ungroupedConfig).to.not.be.null; | |
| config.hosts.forEach((h) => { | |
| config.hosts.forEach((hostToPing) => { | |
| validateHostCanPingHosts( | |
| { | |
| host: h.host_name as string, | |
| port: ungroupedConfig.ssh_port as number, | |
| user: ungroupedConfig.ssh_user as string, | |
| sshKey: ungroupedConfig.ssh_key as string, | |
| sshKeyPassphrase: ungroupedConfig.ssh_passphrase as string | |
| } as SshConfig, | |
| hostToPing.host_name | |
| ); | |
| }); | |
| }); | |
| } | |
| function validateHostCanPingHosts(config: SshConfig, hostToPing: string) { | |
| const ssh = establishSSHConnection(config); | |
| const result = ssh.run( | |
| `ping -c 3 -W 3 ${hostToPing} >/dev/null 2>&1 && echo "success" || echo "failed"` | |
| ); | |
| expect(result).to.include('success'); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment