Skip to content

Commit dd043df

Browse files
mselim00annapoornanarayan
authored andcommitted
feat(efa): add validation for EFA on single node (aws#657)
1 parent 46aea08 commit dd043df

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

test/cases/efa/commons.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func getEfaNodes(ctx context.Context, config *envconf.Config) ([]corev1.Node, er
7979
}
8080

8181
expectedDeviceCount := aws.ToInt(expectedEFADeviceCount)
82-
if expectedDeviceCount == 0 {
82+
if expectedDeviceCount < 0 {
8383
instanceInfo, err := ec2Client.DescribeInstanceType(instanceType)
8484
if err != nil {
8585
return []corev1.Node{}, err

test/cases/efa/main_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func TestMain(m *testing.M) {
5555
pingPongIters = flag.Int("pingPongIters", 10000, "number of iterations to use for ping pong")
5656
pingPongDeadlineSeconds = flag.Int("pingPongDeadlineSeconds", 120, "maximum run time for a ping pong attempt")
5757
nodeType = flag.String("nodeType", "", "instance type to target for tests")
58-
expectedEFADeviceCount = flag.Int("expectedEFADeviceCount", 0, "expected number of efa devices for the target nodes")
58+
expectedEFADeviceCount = flag.Int("expectedEFADeviceCount", -1, "expected number of efa devices for the target nodes")
5959
verbose = flag.Bool("verbose", true, "use verbose mode for tests")
6060

6161
cfg, err := envconf.NewFromFlags()

test/images/efa/Dockerfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
FROM public.ecr.aws/amazonlinux/amazonlinux:2023
22

3+
ARG EFA_BIN_PATH="/opt/amazon/efa/bin"
4+
35
RUN dnf -y swap gnupg2-minimal gnupg2 && \
46
dnf install -y \
57
gcc gcc-c++ make \
@@ -25,7 +27,7 @@ RUN dnf -y swap gnupg2-minimal gnupg2 && \
2527
tar \
2628
gnupg2
2729

28-
ENV PATH="$PATH:/opt/amazon/efa/bin"
30+
ENV PATH="$PATH:$EFA_BIN_PATH"
2931

3032
RUN cd $HOME \
3133
&& curl -O https://efa-installer.amazonaws.com/aws-efa-installer-latest.tar.gz \
@@ -35,6 +37,10 @@ RUN cd $HOME \
3537
&& tar -xf aws-efa-installer-latest.tar.gz \
3638
&& cd aws-efa-installer \
3739
&& ./efa_installer.sh -y -d --skip-kmod --skip-limit-conf --no-verify \
40+
# TODO: remove this in favor of letting the efa installer add it if that ever becomes an option.
41+
# At the moment, this is only installed if omitting --no-verify, which would require
42+
# building in a context with EFA available
43+
&& install -T -m 0755 efa_test.sh "${EFA_BIN_PATH}/efa_test.sh" \
3844
&& cd $HOME \
3945
&& rm -rf aws-efa-installer
4046

test/images/efa/scripts/unit-test.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,10 @@ else
4141
echo "Verified at least $EXPECTED_EFA_DEVICE_COUNT RDM endpoint(s) are available (found $RDM_ENDPOINT_COUNT)"
4242
fi
4343

44+
45+
echo "Running single-node efa test"
46+
47+
# Run efa_test.sh, a utility added during the build while installing EFA
48+
efa_test.sh
49+
4450
echo "Success!"

0 commit comments

Comments
 (0)