Skip to content

Commit

Permalink
Add test to detect drift in expected optimized platforms
Browse files Browse the repository at this point in the history
In the documentation, we document which instance types use the CRT
S3 client when in ``auto`` mode. This test ensures when we update
the CRT, we are alerted of any changes to optimized platforms and
subsequently update the ``auto`` preferred client documentation.
  • Loading branch information
kyleknap committed Nov 13, 2023
1 parent 6e0d669 commit 9fcf024
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/unit/customizations/s3/test_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
import awscrt.s3
import pytest
from awscli.testutils import unittest, mock, FileCreator

Expand Down Expand Up @@ -70,6 +71,25 @@ def s3_params():
}


def test_crt_get_optimized_platforms_match_expected_platforms():
expected_platforms = {
'p4d.24xlarge',
'p4de.24xlarge',
'p5.48xlarge',
'trn1n.32xlarge',
'trn1.32xlarge',
}
actual_platforms = set(awscrt.s3.get_optimized_platforms())
assert expected_platforms == actual_platforms, (
'Expected set of CRT optimized platforms does not match result from '
'CRT. The result from CRT determines which platforms the CLI will '
'automatically use the S3 CRT client for. If the change in optimized '
'platforms is expected/appropriate, update the expected_platforms '
'set in this test and the list of CRT optimized platforms in the '
'documentation located at: awscli/topics/s3-config.rst'
)


class TestClientFactory(unittest.TestCase):
def setUp(self):
self.session = mock.Mock(Session)
Expand Down

0 comments on commit 9fcf024

Please sign in to comment.