Skip to content

Commit 8a63fc8

Browse files
committed
Add test to test ssh key for node IP address
* Add test to verify that aws/aws-parallelcluster-node#188 is working * The warning message will no longer be in mpi_run.sh output because the IP address is already in known_hosts file Signed-off-by: Rex <[email protected]>
1 parent ce3516f commit 8a63fc8

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

tests/integration-tests/tests/scaling/test_mpi.py

+19-5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied.
1111
# See the License for the specific language governing permissions and limitations under the License.
1212
import logging
13+
import socket
1314

1415
import pytest
1516

@@ -58,7 +59,7 @@ def test_mpi(scheduler, region, os, instance, pcluster_config_reader, clusters_f
5859
)
5960

6061

61-
@pytest.mark.regions(["eu-west-1"])
62+
@pytest.mark.regions(["us-east-2"])
6263
@pytest.mark.instances(["c5.xlarge"])
6364
@pytest.mark.schedulers(["slurm", "sge", "torque"])
6465
@pytest.mark.usefixtures("region", "instance")
@@ -79,12 +80,25 @@ def _test_mpi_ssh(remote_command_executor, scheduler, os, test_datadir):
7980
compute_node = scheduler_commands.get_compute_nodes()
8081
assert_that(len(compute_node)).is_equal_to(1)
8182
remote_host = compute_node[0]
83+
84+
# Gets remote host ip from hostname
85+
remote_host_ip = remote_command_executor.run_remote_command(
86+
"getent hosts {0} | cut -d' ' -f1".format(remote_host)
87+
).stdout
88+
89+
# Below job will timeout if the IP address is not in known_hosts
90+
mpirun_out_ip = remote_command_executor.run_remote_script(
91+
str(test_datadir / "mpi_ssh.sh"), args=[mpi_module, remote_host_ip]
92+
).stdout.splitlines()
93+
94+
# mpirun_out_ip = "ip-10-0-127-71"
95+
assert_that(len(mpirun_out_ip)).is_equal_to(1)
96+
assert_that(mpirun_out_ip[-1]).is_equal_to(remote_host)
97+
8298
mpirun_out = remote_command_executor.run_remote_script(
8399
str(test_datadir / "mpi_ssh.sh"), args=[mpi_module, remote_host]
84100
).stdout.splitlines()
85101

86-
# mpirun_out =
87-
# "Warning: Permanently added the RSA host key for IP address '10.0.127.71' to the list of known hosts.\n
88-
# ip-10-0-127-71"
89-
assert_that(len(mpirun_out)).is_greater_than_or_equal_to(1)
102+
# mpirun_out = "ip-10-0-127-71"
103+
assert_that(len(mpirun_out)).is_equal_to(1)
90104
assert_that(mpirun_out[-1]).is_equal_to(remote_host)

0 commit comments

Comments
 (0)