Skip to content

Commit

Permalink
made some changes according to reviews
Browse files Browse the repository at this point in the history
Signed-off-by: Prati28 <[email protected]>
  • Loading branch information
psankhe28 committed Jul 22, 2024
1 parent bfabd56 commit 85eab20
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 17 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ jobs:
- name: Wait for the services to be ready
run: |
echo "Waiting for the services to be ready..."
sleep 30 # Wait for 30 seconds to ensure the services are up
for i in {1..10}; do
if curl -sSf http://localhost:8080/ga4gh/drs/v1 > /dev/null; then
echo "Service is up!"
break
fi
echo "Waiting for the service to be ready..."
sleep 3
done
- name: Set up Python ${{ matrix.python-version }}
uses: actions/[email protected]
Expand Down
38 changes: 22 additions & 16 deletions tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ def test_create_object():

def test_get_objects():
response = requests.get(f"{DRS_FILER_URL}/objects")
assert response.status_code == 200
assert response.json() is not None
assert isinstance(response.json(), list)
if response.status_code == 200:
print("Following are the objects: ")
print(response.json())
Expand All @@ -85,6 +88,8 @@ def test_get_object(get_object_id):
object_id = get_object_id

response = requests.get(f"{DRS_FILER_URL}/objects/{object_id}")
assert response.status_code == 200
assert response.json()['id'] == object_id

if response.status_code == 200:
print(f"Following is the object retrieved based on {object_id}:")
Expand All @@ -102,6 +107,8 @@ def test_get_object(get_object_id):
def test_get_object_access(get_object_id, get_access_id):
object_id = get_object_id
access_id = get_access_id
assert object_id is not None, "Object ID should not be None"
assert access_id is not None, "Access ID should not be None"

response = requests.get(f"{DRS_FILER_URL}/objects/{object_id}/access/{access_id}")

Expand All @@ -128,6 +135,14 @@ def test_update_object(get_object_id):
},
"region": "us-east-1",
"type": "s3"
},
{
"access_url": {
"headers": ["string"],
"url": "string"
},
"region": "us-east-2",
"type": "s3"
}
],
"aliases": ["string"],
Expand Down Expand Up @@ -158,6 +173,7 @@ def test_update_object(get_object_id):
}

response = requests.put(f"{DRS_FILER_URL}/objects/{object_id}", json=data)
assert response.status_code == 200

if response.status_code == 200:
print(f"Updated the object with ID: {object_id}")
Expand Down Expand Up @@ -212,26 +228,16 @@ def test_post_service_info():
}

response = requests.post(f"{DRS_FILER_URL}/service-info", json=data)

assert response.status_code == 201

if response.status_code == 201:
print("Service info was successfully created.")
else:
handle_error(response)

def test_get_service_info():
response = requests.get(f"{DRS_FILER_URL}/service-info")
if response.status_code == 200:
print("Retrieved service info:")
print(response.json())
else:
handle_error(response)

if __name__ == "__main__":
test_get_objects()
test_get_object()
test_get_object_access()
test_update_object()
test_delete_object_access()
test_delete_object()
test_post_service_info()
test_get_service_info()
assert response.status_code == 200
service_info = response.json()
assert "name" in service_info
assert "version" in service_info

0 comments on commit 85eab20

Please sign in to comment.