�
k�h�0 � � � d Z ddlZddlZddlZddlZddlmZ ddlmZm Z m
Z
ddlZddlmZ ddl
Z
G d� d� � ZdS )zq
Rate limiting stress tester for MCP Time Server
Tests various rate limiting scenarios including bypass attempts
� N)�Path)�Dict�Any�List)�datetimec �0 � e Zd ZdZddedefd�Zdeeef fd�Z dd
edeeef fd�Z
dd
edeeef fd�Zddedeeef fd�Zdeeef defd�Z
dej fd�Zdej fd�Zdeeef dej deeef fd�ZdS )�RateLimitStressTesterz(Stress test rate limiting implementation�d �`� �
rate_limit� window_msc � � || _ || _ t t � � j dz | _ | j � d�� � dS )z#Initialize rate limit stress tester�resultsT)�exist_okN)r r
r �__file__�parent�results_dir�mkdir)�selfr r
s �H/home/pshempel/src/local/time-node_tdd/tests/stress/rate_limit_stress.py�__init__zRateLimitStressTester.__init__ sF � �$���"�����>�>�0�9�<���������-�-�-�-�-� �returnc � � t d| j � d�� � dt j � � � � � | j | j ddg d�}| � � � } t | j dz � � D ]�}| � d|dz dd i d
�d�|� � }d|v rR|d � d
� � dk r|dxx dz
cc<