feat: Add comprehensive testing plan for IPSExtractor, including unit, integration, E2E, stress, and resilience tests. Introduce LaTeX documentation structure with sections for architecture, test strategy, and execution guidelines. Enhance README with setup instructions and k6 stress testing scripts.

This commit is contained in:
erik
2026-07-13 17:45:39 -05:00
parent 103bcea15b
commit 6bf413c4ce
25 changed files with 1662 additions and 0 deletions
@@ -0,0 +1,75 @@
\chapter{Pruebas unitarias}
\label{ch:unitarias}
\section{Gateway}
\begin{longtable}{@{}p{2.4cm}p{4.2cm}p{5.5cm}@{}}
\caption{Unitarias gateway.}\\
\toprule
\textbf{ID} & \textbf{Caso} & \textbf{Criterio de \'exito} \\
\midrule
\endhead
UT-GW-01 & Clasificaci\'on path upload vs JSON & Timeouts 600\,s vs 30\,s correctos \\
UT-GW-02 & Health live sin upstream & Respuesta inmediata \texttt{ok} \\
UT-GW-03 & Health agregado degradado & Si extraction/cleaning fallan $\rightarrow$ \texttt{degraded} \\
\bottomrule
\end{longtable}
\section{Bot-descarga API (\texttt{JobStore})}
Cobertura existente en \texttt{test\_store.py}; ampliar con:
\begin{longtable}{@{}p{2.6cm}p{4.0cm}p{5.5cm}@{}}
\caption{Unitarias bot-descarga API.}\\
\toprule
\textbf{ID} & \textbf{Caso} & \textbf{Criterio de \'exito} \\
\midrule
\endhead
UT-BOT-01 & Register + heartbeat & Worker online; offline tras $>$45\,s \\
UT-BOT-02 & Claim at\'omico & Un solo worker obtiene el job \\
UT-BOT-03 & Cancel pending & Estado \texttt{cancelled} inmediato \\
UT-BOT-04 & Cancel running & \texttt{cancel\_requested=true} \\
UT-BOT-05 & Auth Bearer & Token inv\'alido $\rightarrow$ 401 \\
UT-BOT-06 & Keys MinIO & Prefijos uploads/downloads correctos \\
\bottomrule
\end{longtable}
\section{Agent bot (PC)}
Mantener y extender \texttt{bots/bot\_descarga/tests/}:
\begin{longtable}{@{}p{2.6cm}p{4.0cm}p{5.5cm}@{}}
\caption{Unitarias agent.}\\
\toprule
\textbf{ID} & \textbf{Caso} & \textbf{Criterio de \'exito} \\
\midrule
\endhead
UT-AGT-01 & Excel reader / NIT & Headers y limpieza correctos \\
UT-AGT-02 & PDF validator & Rechaza firmas/pesos inv\'alidos \\
UT-AGT-03 & Cancel mid-run & \texttt{should\_cancel} detiene loop \\
UT-AGT-04 & Browser fatal DNS & \texttt{fatal\_error} en Imaging \\
UT-AGT-05 & MinIO keys & Keys y modo an\'onimo \\
UT-AGT-06 & RemoteApiClient (mock) & register/claim/events con HTTP fake \\
\bottomrule
\end{longtable}
\section{Extraction / Cleaning / Count / Desktop}
\begin{longtable}{@{}p{2.6cm}p{4.2cm}p{5.3cm}@{}}
\caption{Unitarias resto de servicios.}\\
\toprule
\textbf{ID} & \textbf{Caso} & \textbf{Criterio de \'exito} \\
\midrule
\endhead
UT-EXT-01 & Rate limiter LLM & Respeta RPM/TPM configurados \\
UT-EXT-02 & Normalizer JSON & Salida can\'onica estable \\
UT-CLN-01 & Reglas CSV & Numeric/text/special/dates \\
UT-CLN-02 & Type inference & Tipos coherentes con fixtures \\
UT-CNT-01 & Features ML & Vector de features esperado \\
UT-CNT-02 & PDF oversized & Rechazo controlado \\
UT-DES-01 & apiClient errores & Manejo de 4xx/5xx \\
UT-DES-02 & Wizard downloads & Payload job correcto \\
\bottomrule
\end{longtable}
\section{Comandos de ejecuci\'on}
\begin{lstlisting}[language=bash,caption={Suite unitaria r\'apida}]
cd bots/bot_descarga && python -m pytest tests/ -q
cd services/bot_descarga && pytest -q
cd services/desktop_app && npm test
cd services/services-count-facturas-medicas-serving && go test ./...
\end{lstlisting}