From c24daf766254795066129a4b5891809a8504f01a Mon Sep 17 00:00:00 2001 From: Pavani Panakanti Date: Thu, 22 Aug 2024 00:43:25 +0000 Subject: [PATCH] Update test cases and mocks --- templates/test/cases/max-pods-cni-1-18-0.sh | 21 +++++++++++ .../c6in-32xlarge.json | 36 +++++++++++++++++++ .../describe-instance-types/m4-xlarge.json | 24 +++++++++++-- .../describe-instance-types/m5-8xlarge.json | 24 +++++++++++-- 4 files changed, 101 insertions(+), 4 deletions(-) create mode 100755 templates/test/cases/max-pods-cni-1-18-0.sh create mode 100644 templates/test/mocks/describe-instance-types/c6in-32xlarge.json diff --git a/templates/test/cases/max-pods-cni-1-18-0.sh b/templates/test/cases/max-pods-cni-1-18-0.sh new file mode 100755 index 000000000..cddf133f6 --- /dev/null +++ b/templates/test/cases/max-pods-cni-1-18-0.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +set -euo pipefail + +echo "-> Should calc max-pods successfully for c6in.32xlarge VPC CNI 1.18.0" +exit_code=0 +out=$(/etc/eks/max-pods-calculator.sh \ + --instance-type c6in.32xlarge \ + --cni-version 1.18.0 \ + --show-max-allowed || exit_code=$?) +echo $out + +if [[ ${exit_code} -ne 0 ]]; then + echo "❌ Test Failed: expected a non-zero exit code but got '${exit_code}'" + exit 1 +fi +expected_max_pods="394" +actual_max_pods=$(grep -o '[0-9]\+' <<< ${out}) +if [[ ${actual_max_pods} -ne ${expected_max_pods} ]]; then + echo "❌ Test Failed: expected max-pods for c6in.32xlarge w/ CNI 1.18.5 to be '${expected_max_pods}', but got '${actual_max_pods}'" + exit 1 +fi diff --git a/templates/test/mocks/describe-instance-types/c6in-32xlarge.json b/templates/test/mocks/describe-instance-types/c6in-32xlarge.json new file mode 100644 index 000000000..d05f1435a --- /dev/null +++ b/templates/test/mocks/describe-instance-types/c6in-32xlarge.json @@ -0,0 +1,36 @@ +{ + "Hypervisor": "nitro", + "NetworkInfo": { + "NetworkPerformance": "200 Gigabit", + "MaximumNetworkInterfaces": 16, + "MaximumNetworkCards": 2, + "DefaultNetworkCardIndex": 0, + "NetworkCards": [ + { + "NetworkCardIndex": 0, + "NetworkPerformance": "Up to 170 Gigabit", + "MaximumNetworkInterfaces": 8, + "BaselineBandwidthInGbps": 200.0, + "PeakBandwidthInGbps": 200.0 + }, + { + "NetworkCardIndex": 1, + "NetworkPerformance": "Up to 170 Gigabit", + "MaximumNetworkInterfaces": 8, + "BaselineBandwidthInGbps": 200.0, + "PeakBandwidthInGbps": 200.0 + } + ], + "Ipv4AddressesPerInterface": 50, + "Ipv6AddressesPerInterface": 50, + "Ipv6Supported": true, + "EnaSupport": "required", + "EfaSupported": true, + "EfaInfo": { + "MaximumEfaInterfaces": 2 + }, + "EncryptionInTransitSupported": true, + "EnaSrdSupported": false + }, + "CpuCount": 128 +} \ No newline at end of file diff --git a/templates/test/mocks/describe-instance-types/m4-xlarge.json b/templates/test/mocks/describe-instance-types/m4-xlarge.json index 0239966bc..ba8d85484 100644 --- a/templates/test/mocks/describe-instance-types/m4-xlarge.json +++ b/templates/test/mocks/describe-instance-types/m4-xlarge.json @@ -1,6 +1,26 @@ { "Hypervisor": "xen", - "EniCount": 4, - "PodsPerEniCount": 15, + "NetworkInfo": { + "NetworkPerformance": "High", + "MaximumNetworkInterfaces": 4, + "MaximumNetworkCards": 1, + "DefaultNetworkCardIndex": 0, + "NetworkCards": [ + { + "NetworkCardIndex": 0, + "NetworkPerformance": "High", + "MaximumNetworkInterfaces": 4, + "BaselineBandwidthInGbps": 0.75, + "PeakBandwidthInGbps": 2.8 + } + ], + "Ipv4AddressesPerInterface": 15, + "Ipv6AddressesPerInterface": 15, + "Ipv6Supported": true, + "EnaSupport": "unsupported", + "EfaSupported": false, + "EncryptionInTransitSupported": false, + "EnaSrdSupported": false + }, "CpuCount": 4 } diff --git a/templates/test/mocks/describe-instance-types/m5-8xlarge.json b/templates/test/mocks/describe-instance-types/m5-8xlarge.json index 840091225..1b03044d7 100644 --- a/templates/test/mocks/describe-instance-types/m5-8xlarge.json +++ b/templates/test/mocks/describe-instance-types/m5-8xlarge.json @@ -1,6 +1,26 @@ { "Hypervisor": "nitro", - "EniCount": 8, - "PodsPerEniCount": 30, + "NetworkInfo": { + "NetworkPerformance": "10 Gigabit", + "MaximumNetworkInterfaces": 8, + "MaximumNetworkCards": 1, + "DefaultNetworkCardIndex": 0, + "NetworkCards": [ + { + "NetworkCardIndex": 0, + "NetworkPerformance": "10 Gigabit", + "MaximumNetworkInterfaces": 8, + "BaselineBandwidthInGbps": 10.0, + "PeakBandwidthInGbps": 10.0 + } + ], + "Ipv4AddressesPerInterface": 30, + "Ipv6AddressesPerInterface": 30, + "Ipv6Supported": true, + "EnaSupport": "required", + "EfaSupported": false, + "EncryptionInTransitSupported": false, + "EnaSrdSupported": false + }, "CpuCount": 32 }