Skip to content

Commit 8040298

Browse files
Merge pull request #59 from asfadmin/test
Patch Release 1.0.8
2 parents 642ba4b + b7e1c0f commit 8040298

20 files changed

Lines changed: 471 additions & 90 deletions
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: "[Bug]"
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Provide an example url to reproduce the behavior.
15+
16+
\*Reminder: If authentication is required **do not** leave any sensitive credentials in the snippet.
17+
18+
19+
**Expected behavior**
20+
A clear and concise description of what you expected to happen.
21+
22+
**Screenshots**
23+
If applicable, add screenshots to help explain your problem.
24+
25+
**Desktop (please complete the following information):**
26+
- OS: [e.g. Ubuntu 20.04]
27+
- Python Version [e.g. python3.11]
28+
- Pip Environment ['python3 -m pip freeze']
29+
30+
**Additional context**
31+
Add any other context about the problem here.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Merge Requirements:
2+
The following requirements must be met for your pull request to be considered for review & merging. Until these requirements are met please mark the pull request as a draft.
3+
4+
## Purpose
5+
Why is this pull request necessary? Provide a reference to a related issue in this repository that your pull request addresses (if applicable).
6+
7+
## Description
8+
A brief description of the changes proposed in the pull request. If there are any changes to packaging requirements please list them. If it's a new endpoint list:
9+
- Supported HTTP methods
10+
- input params
11+
- output
12+
- errors it can raise
13+
14+
## Snippet
15+
If the pull request provides a new feature, provide an example demonstrating the use-case(s) for this pull request (If applicable).
16+
17+
For example, if you are adding a new endpoint, show how we might call it and what kind of output we could expect:
18+
``` bash
19+
curl 'http://127.0.0.1:8080/services/utils/useful_new_endpoint?param1=value1&param2=value2'
20+
```
21+
22+
If it modifies an existing endpoint (like a new output type for `/services/search/param`) show and example of what the output would look like.
23+
24+
## Error/Warning/Regression Free
25+
Your code runs without any unhandled errors, warnings, or regressions
26+
27+
## Unit Tests
28+
29+
You have added unit tests to the test suite see the [README Testing section](https://github.com/asfadmin/Discovery-SearchAPI-v3/tree/dev?tab=readme-ov-file#writing-tests) for an overview on adding tests to the test suite.
30+
31+
## Target Merge Branch
32+
Your pull request targets the `dev` branch
33+
34+
35+
***
36+
37+
### Checklist
38+
- [ ] Purpose
39+
- [ ] Description
40+
- [ ] Snippet
41+
- [ ] Error/Warning/Regression Free
42+
- [ ] Unit Tests
43+
- [ ] Target Merge Branch

.github/workflows/deploy-prod-staging.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ jobs:
7878
with:
7979
aws-account-id: ${{ secrets.AWS_ACCOUNT_ID }}
8080
staging: true
81+
maturity: prod-staging
8182

8283
run-prod-staging-integration-tests:
8384
needs: [deploy-prod-staging]

.github/workflows/deploy-prod.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,5 @@ jobs:
4040
uses: ./.github/workflows/search-api-composite
4141
with:
4242
aws-account-id: ${{ secrets.AWS_ACCOUNT_ID }}
43+
maturity: prod
4344

.github/workflows/deploy-test-staging.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ jobs:
7777
uses: ./.github/workflows/search-api-composite
7878
with:
7979
aws-account-id: ${{ secrets.AWS_ACCOUNT_ID }}
80-
staging: true
80+
maturity: test-staging
8181

8282
run-test-staging-integration-tests:
8383
needs: [deploy-test-staging]

.github/workflows/deploy-test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,4 @@ jobs:
4040
uses: ./.github/workflows/search-api-composite
4141
with:
4242
aws-account-id: ${{ secrets.AWS_ACCOUNT_ID }}
43+
maturity: test

.github/workflows/search-api-composite/action.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ inputs:
1313
security-group:
1414
required: true
1515
type: string
16-
17-
staging:
18-
required: false
19-
type: boolean
16+
maturity:
17+
required: true
18+
type: string
2019

2120
runs:
2221
using: "composite"
@@ -57,5 +56,4 @@ runs:
5756
--context vpc_id=${{ inputs.vpc-id }} \
5857
--context subnet_ids=${{ inputs.subnet-ids }} \
5958
--context security_group=${{ inputs.security-group }} \
60-
--context staging=${{ inputs.staging }}
61-
59+
--context api_stage=${{ inputs.maturity }}

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
2525
-
2626
2727
-->
28+
------
29+
## [1.0.8](https://github.com/asfadmin/Discovery-SearchAPI-v3/compare/v1.0.7...v1.0.8)
30+
### Changed
31+
- bump asf-search to v10.1.1 for NISAR product type file sizes, urgent response now searchable with product types, and ARIA-S1 GUNW Stacking support, better nisar metadata output formatting, OPERA-S1 `TROPO-ZENITH`
32+
33+
### Fixed
34+
- boolean values are properly capitalized in `python` output file
35+
- API maturity set for each level of deployment stage
36+
- API maturity loaded once per api instance
37+
2838
------
2939
## [1.0.7](https://github.com/asfadmin/Discovery-SearchAPI-v3/compare/v1.0.6...v1.0.7)
3040
### Changed

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ FROM public.ecr.aws/docker/library/python:3.12
22
COPY --from=public.ecr.aws/awsguru/aws-lambda-adapter:0.8.3 /lambda-adapter /opt/extensions/lambda-adapter
33
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
44

5+
ARG MATURITY="local"
6+
ENV MATURITY=${MATURITY}
57
ARG HOST=0.0.0.0
68
ENV HOST=${HOST}
79
ARG PORT=8080

README.es.md

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# SearchAPI-v3
2+
3+
[![en](https://img.shields.io/badge/lang-en-red.svg)](./README.md)
4+
5+
6+
SearchAPI-v3 es un contenedor alrededor del [módulo de python asf-search](https://github.com/asfadmin/Discovery-asf_search) utilizando un despliegue sin servidor con el framework FastAPI y AWS Lambda.
7+
8+
### Endpoints principales
9+
10+
<table>
11+
<thead>
12+
<tr>
13+
<th>Endpoint</th>
14+
<th>Descripción</th>
15+
<th>Métodos</th>
16+
</tr>
17+
</thead>
18+
<tbody>
19+
<tr>
20+
<td>`/`</td>
21+
<td>Información de configuración del servidor</td>
22+
<td>`GET`</td>
23+
</tr>
24+
<tr>
25+
<td>`/health`</td>
26+
<td>igual que root `/`</td>
27+
<td>`GET`</td>
28+
</tr>
29+
<tr>
30+
<td>`/services/search/param`</td>
31+
<td>Búsqueda mediante cualquier parámetro válido de asf-search</td>
32+
<td>`GET` `POST` `HEAD`</td>
33+
</tr>
34+
<tr>
35+
<td>`/services/search/baseline`</td>
36+
<td>Crear un stack de línea base a partir de una referencia dada y dataset opcional</td>
37+
<td>`GET` `POST` `HEAD`</td>
38+
</tr>
39+
</tbody>
40+
</table>
41+
42+
## Desarrollo
43+
44+
### Ramificación
45+
46+
<table>
47+
<thead>
48+
<tr>
49+
<th>Instancia</th>
50+
<th>Rama</th>
51+
<th>Descripción, Instrucciones, Notas</th>
52+
</tr>
53+
</thead>
54+
<tbody>
55+
<tr>
56+
<td>Características</td>
57+
<td>feat-*</td>
58+
<td>Siempre crear a partir de dev, para nuevas funciones</td>
59+
</tr>
60+
<tr>
61+
<td>Problemas</td>
62+
<td>bugfix-*</td>
63+
<td>Siempre crear a partir de dev, para correcciones</td>
64+
</tr>
65+
<tr>
66+
<td>desarrollo</td>
67+
<td>dev</td>
68+
<td>Aquí comienza la integración inicial; despliega en el entorno test-staging.</td>
69+
</tr>
70+
<tr>
71+
<td>pruebas</td>
72+
<td>test</td>
73+
<td>Solo acepta fusiones desde la rama development; despliegue en el entorno de prueba</td>
74+
</tr>
75+
<tr>
76+
<td>preproducción e integración</td>
77+
<td>prod-staging</td>
78+
<td>Solo acepta fusiones desde la rama testing; despliegue en el entorno prod-staging</td>
79+
</tr>
80+
<tr>
81+
<td>release</td>
82+
<td>prod</td>
83+
<td>Solo acepta fusiones desde la rama prod-staging; rama de release, despliegue a producción</td>
84+
</tr>
85+
</tbody>
86+
</table>
87+
88+
### Instalación
89+
90+
Para instalar localmente, ejecute lo siguiente en una terminal (se recomienda altamente hacerlo en un entorno virtual):
91+
```bash
92+
pip install -r requirements.txt
93+
pip install .
94+
```
95+
96+
Para instalar los requisitos de prueba:
97+
```bash
98+
pip install -r tests/requirements.txt
99+
```
100+
101+
### Ejecución local
102+
103+
Para ejecutar la API localmente, ejecute lo siguiente en una terminal:
104+
```bash
105+
uvicorn src.SearchAPI.application:app --reload --port 8080
106+
```
107+
La API ahora debería estar disponible en su localhost en http://127.0.0.1:8080 y se puede consultar con su navegador o herramienta de red de preferencia.
108+
109+
110+
111+
112+
## Pruebas
113+
114+
### Ejecutar el conjunto de pruebas localmente
115+
Después de ejecutar la API (vea `Ejecución local` arriba), para correr la suite de pruebas localmente ejecute:
116+
```bash
117+
pytest --api "http://127.0.0.1:8080" -n auto "tests/yml_tests/"
118+
```
119+
120+
### Escribir pruebas
121+
Las pruebas deben escribirse en las subcarpetas y archivos relevantes en `/tests`.
122+
123+
La suite de pruebas usa el plugin `pytest-automation` que permite definir y reutilizar entradas para casos de prueba en formato yaml. Los casos de prueba se escriben en archivos dentro de `tests/yml_tests/`, y los recursos reutilizables en `tests/yml_tests/Resources/`.
124+
125+
```yaml
126+
127+
tests:
128+
- Test Nisar Product L1 RSLC: # este es un caso de prueba
129+
product: NISAR_L1_PR_RSLC_087_039_D_114_2005_DHDH_A_20251102T222008_20251102T222017_T00407_N_P_J_001.yml # este archivo debe estar en `tests/yml_tests/Resources/`. Vea otros archivos yml en la carpeta para observar cómo podría estructurar el objeto yml
130+
product_level: L1
131+
132+
- Test Nisar Product L2 GSLC: # este es otro caso de prueba
133+
product: NISAR_L2_PR_GSLC_087_039_D_112_2005_DHDH_A_20251102T221859_20251102T221935_T00407_N_F_J_001.yml
134+
product_level: L2
135+
```
136+
137+
Podemos crear el mapeo desde nuestros casos de prueba yaml en `tests/yml_tests/pytest-config.yml`, que se usará para llamar la función de python deseada en `tests/yml_tests/pytest-managers.py`.
138+
139+
En `tests/yml_tests/pytest-config.yml`:
140+
```yaml
141+
- Para ejecutar pruebas de ASFProduct:
142+
required_keys: ['product', 'product_level'] # las claves que requiere el caso de prueba
143+
method: test_NISARProduct # la función de Python en pytest-managers.py que será llamada
144+
required_in_title: Test Nisar Product # (OPCIONAL) solo ejecutará los casos de prueba que tengan `Test Nisar Product` en el nombre; por ello, los dos casos anteriores se ejecutarían con nuestras pruebas.
145+
```
146+
147+
En `tests/yml_tests/pytest-managers.py`:
148+
149+
```python
150+
def test_new_endpoint(client=None, **args) -> None:
151+
test_new_endpoint(client=client, **args)
152+
```

0 commit comments

Comments
 (0)