Skip to content

Commit f77d223

Browse files
author
Sean Smith
committed
EFA Test Fixes
Signed-off-by: Sean Smith <[email protected]>
1 parent ea9f040 commit f77d223

File tree

7 files changed

+24
-22
lines changed

7 files changed

+24
-22
lines changed

tests/integration-tests/cfn_stacks_factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
class CfnStack:
2121
"""Identify a CloudFormation stack."""
2222

23-
def __init__(self, name, region, template=None):
23+
def __init__(self, name, region, template):
2424
self.name = name
2525
self.region = region
2626
self.template = template

tests/integration-tests/clusters_factory.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
class Cluster:
2222
"""Contain all static and dynamic data related to a cluster instance."""
2323

24-
def __init__(self, name, ssh_key, config_file=None):
24+
def __init__(self, name, ssh_key, config_file):
2525
self.name = name
2626
self.config_file = config_file
2727
self.ssh_key = ssh_key
@@ -121,7 +121,7 @@ def create_cluster(self, cluster):
121121
# create the cluster
122122
logging.info("Creating cluster {0} with config {1}".format(name, config))
123123
self.__created_clusters[name] = cluster
124-
result = run_command(["pcluster", "create", "--no-rollback", "--config", config, name])
124+
result = run_command(["pcluster", "create", "--norollback", "--config", config, name])
125125
if "Status: {0} - CREATE_COMPLETE".format(cluster.cfn_name) not in result.stdout:
126126
error = "Cluster creation failed for {0} with output: {1}".format(name, result.stdout)
127127
logging.error(error)

tests/integration-tests/conftest.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,15 @@ def clusters_factory(request):
166166
factory = ClustersFactory()
167167

168168
def _cluster_factory(cluster_config):
169-
if request.config.getoption("cluster"):
170-
cluster = Cluster(name=request.config.getoption("cluster"), ssh_key=request.config.getoption("key_path"))
171-
else:
172-
cluster_config = _write_cluster_config_to_outdir(request, cluster_config)
173-
cluster = Cluster(
174-
name="integ-tests-" + random_alphanumeric(),
175-
config_file=cluster_config,
176-
ssh_key=request.config.getoption("key_path"),
177-
)
169+
cluster_config = _write_cluster_config_to_outdir(request, cluster_config)
170+
cluster = Cluster(
171+
name=request.config.getoption("cluster")
172+
if request.config.getoption("cluster")
173+
else "integ-tests-" + random_alphanumeric(),
174+
config_file=cluster_config,
175+
ssh_key=request.config.getoption("key_path"),
176+
)
177+
if not request.config.getoption("cluster"):
178178
factory.create_cluster(cluster)
179179
return cluster
180180

@@ -338,7 +338,8 @@ def vpc_stacks(cfn_stacks_factory, request):
338338
@retry(stop_max_attempt_number=2, wait_fixed=5000)
339339
def _create_vpc_stack(request, template, region, cfn_stacks_factory):
340340
if request.config.getoption("vpc_stack"):
341-
stack = CfnStack(name=request.config.getoption("vpc_stack"), region=region)
341+
logging.info("Using stack {0} in region {1}".format(request.config.getoption("vpc_stack"), region))
342+
stack = CfnStack(name=request.config.getoption("vpc_stack"), region=region, template=template.to_json())
342343
else:
343344
stack = CfnStack(name="integ-tests-vpc-" + random_alphanumeric(), region=region, template=template.to_json())
344345
cfn_stacks_factory.create_stack(stack)

tests/integration-tests/tests/test_efa/test_efa.py

Lines changed: 7 additions & 5 deletions
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 re
1314

1415
import pytest
1516

@@ -20,7 +21,7 @@
2021
INSTANCES_TO_SLOTS_MAP = {"c5n.18xlarge": 72, "p3dn.24xlarge": 96, "i3en.24xlarge": 96}
2122

2223

23-
@pytest.mark.regions(["us-east-1", "eu-west-1"])
24+
@pytest.mark.regions(["us-east-1"])
2425
@pytest.mark.instances(["c5n.18xlarge", "p3dn.24xlarge", "i3en.24xlarge"])
2526
@pytest.mark.oss(["alinux", "centos7", "ubuntu1604"])
2627
@pytest.mark.schedulers(["sge", "slurm"])
@@ -47,7 +48,7 @@ def _test_efa_installed(scheduler_commands, remote_command_executor):
4748
# Output contains:
4849
# 00:06.0 Ethernet controller: Amazon.com, Inc. Device efa0
4950
logging.info("Testing EFA installed")
50-
result = scheduler_commands.submit_command("/sbin/lspci > /shared/lspci.out")
51+
result = scheduler_commands.submit_command("lspci > /shared/lspci.out")
5152

5253
job_id = scheduler_commands.assert_job_submitted(result.stdout)
5354
scheduler_commands.wait_job_completed(job_id)
@@ -58,7 +59,7 @@ def _test_efa_installed(scheduler_commands, remote_command_executor):
5859
assert_that(result.stdout).contains("00:06.0 Ethernet controller: Amazon.com, Inc. Device efa0")
5960

6061
# Check EFA interface not present on master
61-
result = remote_command_executor.run_remote_command("/sbin/lspci")
62+
result = remote_command_executor.run_remote_command("lspci")
6263
assert_that(result.stdout).does_not_contain("00:06.0 Ethernet controller: Amazon.com, Inc. Device efa0")
6364

6465

@@ -91,5 +92,6 @@ def _test_osu_benchmarks(remote_command_executor, scheduler_commands, test_datad
9192
scheduler_commands.wait_job_completed(job_id)
9293
scheduler_commands.assert_job_succeeded(job_id)
9394

94-
# TODO: perform assertions on benchmarks results
95-
remote_command_executor.run_remote_command("cat /shared/osu.out")
95+
output = remote_command_executor.run_remote_command("cat /shared/osu.out").stdout
96+
latency = re.search(r"0\s+(\d\d)\.", output).group(1)
97+
assert_that(int(latency)).is_less_than(20)

tests/integration-tests/tests/test_efa/test_efa/test_efa/init_osu_benchmarks.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ wget http://mvapich.cse.ohio-state.edu/download/mvapich/osu-micro-benchmarks-5.4
66
tar zxvf ./osu-micro-benchmarks-5.4.tar.gz
77
cd osu-micro-benchmarks-5.4/
88
./configure CC=/opt/amazon/efa/bin/mpicc CXX=/opt/amazon/efa/bin/mpicxx
9-
make
10-
# make install in the submit script
9+
make

tests/integration-tests/tests/test_efa/test_efa/test_efa/mpi_submit.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
set -e
33

44
module load openmpi
5-
mpirun -N 1 -np 2 "mpi_hello_world" &> /shared/mpi.out
5+
mpirun -N 1 -np 2 "mpi_hello_world" >> /shared/mpi.out

tests/integration-tests/tests/test_efa/test_efa/test_efa/osu_submit.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
set -e
33

44
module load openmpi
5-
mpirun --map-by ppr:1:node /shared/osu-micro-benchmarks-5.4/mpi/pt2pt/osu_latency &> /shared/osu.out
5+
mpirun --map-by ppr:1:node /shared/osu-micro-benchmarks-5.4/mpi/pt2pt/osu_latency >> /shared/osu.out

0 commit comments

Comments
 (0)