Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow job queries with names longer than 20 characters #1020

Merged
merged 4 commits into from
May 19, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## [2.17.2]
### Fixed
- `GET /jobs` requests now accept `name` parameters up to 100 characters. Fixes [#1019](https://github.com/ASFHyP3/hyp3/issues/1019).

## [2.17.1]
### Fixed
- Fix how we fetch jobs that are waiting for step function execution, so that we actually start up to 400 executions at a time.
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/hyp3_api/api-spec/openapi-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ components:
description: User provided text to name the job
type: string
minLength: 1
maxLength: 20
maxLength: 100
example: Job Name

start_token:
Expand Down
12 changes: 11 additions & 1 deletion tests/test_api/test_list_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,12 @@ def test_list_jobs(client, tables):


def test_list_jobs_by_name(client, tables):
long_name = 'item with a long name' + '-' * 79
assert len(long_name) == 100

items = [
make_db_record('0ddaeb98-7636-494d-9496-03ea4a7df266', name='item1'),
make_db_record('27836b79-e5b2-4d8f-932f-659724ea02c3', name='item2')
make_db_record('27836b79-e5b2-4d8f-932f-659724ea02c3', name=long_name)
]
for item in items:
tables.jobs_table.put_item(Item=item)
Expand All @@ -66,6 +69,13 @@ def test_list_jobs_by_name(client, tables):
assert response.status_code == HTTPStatus.OK
assert response.json == {'jobs': []}

response = client.get(JOBS_URI, query_string={'name': long_name})
assert response.status_code == HTTPStatus.OK
assert response.json == {'jobs': [items[1]]}

response = client.get(JOBS_URI, query_string={'name': long_name + '-'})
assert response.status_code == HTTPStatus.BAD_REQUEST


def test_list_jobs_by_type(client, tables):
items = [
Expand Down