docstr: Tests retry mechanism
docstr_tok: ["Tests","retry","mechanism"]
code: def test_docker_login_retry_exhausted(self, mock_sleep, mock_run):
      """
      Tests retry mechanism
      """
      num_tries = DOCKERHUB_LOGIN_NUM_RETRIES
      mock_session, stub = mock_boto(num_calls=num_tries)
      stub.activate()
      with patch("boto3.Session", return_value=mock_session):
          # Simulate num_tries errors
          mock_run.side_effect = [
              subprocess.CalledProcessError(1, "cmd", "some error")
          ] * num_tries
  
          with self.assertRaises(subprocess.CalledProcessError):
              login_dockerhub(
                  SECRET_NAME,
                  SECRET_ENDPOINT_URL,
                  SECRET_ENDPOINT_REGION,
              )
  
          # Check boto client is properly created
          assert (
              mock_session.client.call_args_list
              == [
                  call(
                      service_name="secretsmanager",
                      region_name="us-east-2",
                      endpoint_url="https://endpoint.url",
                  )
              ]
              * num_tries
          )
  
          # Check that login call passes in the password in the correct way
          cmd = [
              "docker",
              "login",
              "--username",
              "myuser",
              "--password-stdin",
          ]
          assert (
              mock_run.call_args_list
              == [
                  call(
                      cmd,
                      stdout=subprocess.PIPE,
                      input=str.encode("mypass"),
                  )
              ]
              * num_tries
          )
  
          # Assert sleep was called appropriately
          assert mock_sleep.call_args_list == [
              call(2**retry_num * DOCKERHUB_RETRY_SECONDS)
              for retry_num in range(0, num_tries - 1)
          ]
      stub.deactivate()
  
file_path: mxnet/ci/test_docker_login.py
imports: import os
  import subprocess
  import unittest
  from unittest.mock import create_autospec, patch, call, MagicMock
  import boto3
  from boto3 import client
  from botocore.stub import Stubber
  from docker_login import login_dockerhub, logout_dockerhub, main, DOCKERHUB_RETRY_SECONDS, DOCKERHUB_LOGIN_NUM_RETRIES
label_desc: Use image node_id 3 for calling the TestDockerLogin obj's underlying member method code with example usage: obj.test_docker_login_retry_exhausted(mock_sleep, mock_run) without return types