Skip to content

Commit 8fe8f38

Browse files
committed
refactor: Organize test files and update README for integration tests
- Moved �ash_test.sh and powershell_test.ps1 from ests/ to ests/integration/ for better organization of integration tests. - Moved sample_payload.json from ests/ to ests/fixtures/ as it serves as a test data fixture. - Updated README.md to reflect the new test file structure. - Modified README.md API usage examples to instruct users to execute the integration test scripts directly, improving clarity and maintainability.
1 parent 689d2db commit 8fe8f38

File tree

4 files changed

+32
-28
lines changed

4 files changed

+32
-28
lines changed

README.md

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,36 @@ This project demonstrates a foundational MLOps workflow for deploying a Breast C
77
```
88
breast-cancer-ops/
99
├── config/ # Configuration files
10-
│ ├── docker-compose.yml # Defines and links multi-container Docker application
11-
│ ├── Dockerfile.api # Dockerfile for the Flask API container
12-
│ └── Dockerfile.streamlit # Dockerfile for the Streamlit UI container
10+
│ ├── docker-compose.yml # Defines and links multi-container Docker application
11+
│ ├── Dockerfile.api # Dockerfile for the Flask API container
12+
│ └── Dockerfile.streamlit # Dockerfile for the Streamlit UI container
1313
├── data/ # Stores the dataset
1414
│ └── data.csv
1515
├── models/ # Stores the trained model pipeline (created locally)
1616
│ └── model.joblib
1717
├── src/ # Source code
18-
│ ├── app.py # Flask API for model inference
19-
│ ├── model/ # Machine Learning model components
20-
│ │ ├── __init__.py # Makes 'model' a Python package
21-
│ │ ├── data_ingestion.py # Handles raw data loading
22-
│ │ ├── data_preprocessing.py # Contains data cleaning and feature preparation
23-
│ │ ├── model_inference.py # Loads trained pipeline and makes predictions
24-
│ │ ├── model_training.py # Orchestrates model training and pipeline saving
25-
│ │ └── pipeline_utils.py # Defines the scikit-learn pipeline structure
26-
│ └── streamlit_app.py # Streamlit user interface for predictions
18+
│ ├── app.py # Flask API for model inference
19+
│ ├── model/ # Machine Learning model components
20+
│ │ ├── __init__.py # Makes 'model' a Python package
21+
│ │ ├── dat-ingestion.py # Handles raw data loading
22+
│ │ ├── data_preprocessing.py # Contains data cleaning and feature preparation
23+
│ │ ├── model_inference.py # Loads trained pipeline and makes predictions
24+
│ │ ├── model_training.py # Orchestrates model training and pipeline saving
25+
│ │ └── pipeline_utils.py # Defines the scikit-learn pipeline structure
26+
│ └── streamlit_app.py # Streamlit user interface for predictions
2727
├── tests/ # For unit and integration tests
2828
│ ├── __init__.py # Makes 'tests' a Python package
2929
│ ├── conftest.py # Shared pytest fixtures across test files
30-
│ ├── bash_test.sh
31-
│ ├── powershell_test.ps1
32-
│ ├── sample_payload.json # For API/integration tests
30+
│ ├── fixtures/
31+
│ │ └── sample_payload.json # For API/integration tests
32+
│ ├── integration/
33+
│ │ ├── bash_test.sh # For Linux/macOS or Git Bash
34+
│ │ └── powershell_test.ps1 # For Windows PowerShell
3335
│ ├── unit/
34-
│ │ ├── __init__.py # Makes 'unit' a Python package
35-
│ │ ├── dat-ingestion/ # Tests for src/model/dat-ingestion.py
36+
│ │ ├── __init__.py # Makes 'unit' a Python package
37+
│ │ ├── dat-ingestion/ # Tests for src/model/dat-ingestion.py
3638
│ │ │ └── test_dat-ingestion.py
37-
│ │ ├── data_preprocessing/ # Tests for src/model/data_preprocessing.py
39+
│ │ ├── data_preprocessing/ # Tests for src/model/data_preprocessing.py
3840
│ │ │ ├── test_drop_unnecessary_columns.py
3941
│ │ │ └── test_map_diagnosis_to_numerical.py
4042
│ │ │ └── test_prepare_features_and_target.py
@@ -128,22 +130,24 @@ With the Flask API running locally (as described in step 6 above), you can test
128130

129131
* **Endpoint:** `POST http://127.0.0.1:5000/predict`
130132
* **Purpose:** Receives a JSON payload of features and returns a prediction.
131-
* **Request Body Example:** `tests/sample_payload.json`
133+
* **Request Body Example:** `tests/fixtures/sample_payload.json`
132134

133-
* **Example Usage:**
135+
* **Example Usage via Test Scripts:**
134136

135-
**PowerShell:**
136-
```powershell
137-
$headers = @{"Content-Type"="application/json"}
138-
$body = Get-Content -Raw -Path "tests/sample_payload.json" | ConvertFrom-Json
139-
Invoke-RestMethod -Uri "http://127.0.0.1:5000/predict" -Method Post -Headers $headers -Body (ConvertTo-Json $body)
140-
```
137+
To test the prediction endpoint using pre-configured scripts:
141138

142-
**cURL (Linux/macOS/Git Bash):**
139+
**For Linux/macOS or Git Bash:**
143140
```bash
144-
curl -X POST -H "Content-Type: application/json" -d @tests/sample_payload.json http://127.0.0.1:5000/predict
141+
./tests/integration/bash_test.sh
145142
```
146143

144+
**For Windows PowerShell:**
145+
```powershell
146+
& ".\tests\integration\powershell_test.ps1"
147+
```
148+
149+
(Ensure the Flask API is running locally as described in step 6 under "Setup and Run" before running these scripts.)
150+
147151
**Expected Output:**
148152
```json
149153
{

0 commit comments

Comments
 (0)