text: import argparse
  import logging
  from typing import Tuple
  from deepdiff import DeepDiff
  import requests
  from requests.adapters import HTTPAdapter
  from urllib3.util import Retry
  from urllib.parse import quote
  import pprint
  from concurrent.futures import ThreadPoolExecutor
  import os
  import json
  import random
  import math
  
  
  def diff_response(args: Tuple[str, str]):
      # Endpoint
      # GET /cves/:id
      # POST /cpes
      # POST /cpes/ids
  
      path = ''
      if args[0] == 'cves':
          path = f'cves/{args[1]}'
      if args[0] == 'cpes':
          path = 'cpes'
      if args[0] == 'cpe_ids':
          path = 'cpes/ids'
  
      session = requests.Session()
      retries = Retry(total=5,
                      backoff_factor=1,
                      status_forcelist=[503, 504])
      session.mount("http://", HTTPAdapter(max_retries=retries))
  
      try:
          if args[0] == 'cves':
              response_old = requests.get(
                  f'http://127.0.0.1:1325/{path}', timeout=(3.0, 10.0)).json()
              response_new = requests.get(
                  f'http://127.0.0.1:1326/{path}', timeout=(3.0, 10.0)).json()
          if args[0] in ['cpes', 'cpe_ids']:
              payload = {"name": args[1]}
              response_old = requests.post(
                  f'http://127.0.0.1:1325/{path}', data=json.dumps(payload), headers={'content-type': 'application/json'}, timeout=(3.0, 30.0)).json()
              response_new = requests.post(
                  f'http://127.0.0.1:1326/{path}', data=json.dumps(payload), headers={'content-type': 'application/json'}, timeout=(3.0, 30.0)).json()
      except requests.ConnectionError as e:
          logger.error(
              f'Failed to Connection..., err: {e}, mode: {args[0]}, args: {args}')
          exit(1)
      except Exception as e:
          logger.error(
              f'Failed to GET request..., err: {e}, mode: {args[0]}, args: {args}')
          exit(1)
  
      diff = DeepDiff(response_old, response_new, ignore_order=True)
      if diff != {}:
          logger.warning(
              f'There is a difference between old and new(or RDB and Redis):\n {pprint.pformat({"mode": args[0], "args": args, "diff": diff}, indent=2)}')
  
  
  parser = argparse.ArgumentParser()
  parser.add_argument('mode', choices=['cves', 'cpes', 'cpe_ids'],
                      help='Specify the mode to test.')
  parser.add_argument("--sample_rate", type=float, default=0.01,
                      help="Adjust the rate of data used for testing (len(test_data) * sample_rate)")
  parser.add_argument(
      '--debug', action=argparse.BooleanOptionalAction, help='print debug message')
  args = parser.parse_args()
  
  logger = logging.getLogger(__name__)
  stream_handler = logging.StreamHandler()
  
  if args.debug:
      logger.setLevel(logging.DEBUG)
      stream_handler.setLevel(logging.DEBUG)
  else:
      logger.setLevel(logging.INFO)
      stream_handler.setLevel(logging.INFO)
  
  formatter = logging.Formatter(
      '%(levelname)s[%(asctime)s] %(message)s', "%m-%d|%H:%M:%S")
  stream_handler.setFormatter(formatter)
  logger.addHandler(stream_handler)
  
  logger.info(
      f'start server mode test(mode: {args.mode})')
  
  list_paths = []
  if args.mode == 'cves':
      list_paths = ["integration/nvd/cves.txt", "integration/jvn/cves.txt"]
  if args.mode in ['cpes', 'cpe_ids']:
      list_paths = ["integration/nvd/cpes.txt", "integration/jvn/cpes.txt"]
  
  for path in list_paths:
      if not os.path.isfile(path):
          logger.error(f'Failed to find list path..., list_path: {path}')
          exit(1)
  
      with open(path) as f:
          list = [s.strip() for s in f.readlines()]
          list = random.sample(list, math.ceil(len(list) * args.sample_rate))
          with ThreadPoolExecutor() as executor:
              ins = ((args.mode, e) for e in list)
              executor.map(diff_response, ins)
  