Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/cases/efa/commons.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func getEfaNodes(ctx context.Context, config *envconf.Config) ([]corev1.Node, er
}

expectedDeviceCount := aws.ToInt(expectedEFADeviceCount)
if expectedDeviceCount == 0 {
if expectedDeviceCount < 0 {
instanceInfo, err := ec2Client.DescribeInstanceType(instanceType)
if err != nil {
return []corev1.Node{}, err
Expand Down
2 changes: 1 addition & 1 deletion test/cases/efa/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func TestMain(m *testing.M) {
pingPongIters = flag.Int("pingPongIters", 10000, "number of iterations to use for ping pong")
pingPongDeadlineSeconds = flag.Int("pingPongDeadlineSeconds", 120, "maximum run time for a ping pong attempt")
nodeType = flag.String("nodeType", "", "instance type to target for tests")
expectedEFADeviceCount = flag.Int("expectedEFADeviceCount", 0, "expected number of efa devices for the target nodes")
expectedEFADeviceCount = flag.Int("expectedEFADeviceCount", -1, "expected number of efa devices for the target nodes")
verbose = flag.Bool("verbose", true, "use verbose mode for tests")

cfg, err := envconf.NewFromFlags()
Expand Down
8 changes: 7 additions & 1 deletion test/images/efa/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM public.ecr.aws/amazonlinux/amazonlinux:2023

ARG EFA_BIN_PATH="/opt/amazon/efa/bin"

RUN dnf -y swap gnupg2-minimal gnupg2 && \
dnf install -y \
gcc gcc-c++ make \
Expand All @@ -25,7 +27,7 @@ RUN dnf -y swap gnupg2-minimal gnupg2 && \
tar \
gnupg2

ENV PATH="$PATH:/opt/amazon/efa/bin"
ENV PATH="$PATH:$EFA_BIN_PATH"

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

Expand Down
6 changes: 6 additions & 0 deletions test/images/efa/scripts/unit-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,10 @@ else
echo "Verified at least $EXPECTED_EFA_DEVICE_COUNT RDM endpoint(s) are available (found $RDM_ENDPOINT_COUNT)"
fi


echo "Running single-node efa test"

# Run efa_test.sh, a utility added during the build while installing EFA
efa_test.sh

echo "Success!"