Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.

Release 1.3.0 #116

Merged
merged 85 commits into from
Sep 29, 2021
Merged
Changes from 4 commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
28de310
proper package version
blankdots Jul 23, 2021
26ccdec
add more integration tests
blankdots Jul 23, 2021
88040ae
fix issue with 409 conglict response in registry
blankdots Jul 23, 2021
772e199
Merge pull request #95 from CSCfi/tests/integration
teemukataja Jul 26, 2021
b9aff01
fix apt install
blankdots Jul 26, 2021
a01cb07
Merge pull request #96 from CSCfi/bugfix/libcurl-apt
blankdots Jul 26, 2021
bbecbb4
Bump coveralls from 3.1.0 to 3.2.0
dependabot[bot] Jul 26, 2021
c6f0e07
Merge pull request #97 from CSCfi/263ddependabot/pip/dev/coveralls-3.2.0
blankdots Jul 26, 2021
115c542
added beaconV2 queries and updated some tests
ViMuilu Jul 30, 2021
fdaf003
Merge branch 'dev' into feature/beaconV2_support
ViMuilu Aug 2, 2021
3f7b85f
Bump tox from 3.24.0 to 3.24.1
dependabot[bot] Aug 2, 2021
96040ea
Merge pull request #99 from CSCfi/a95ddependabot/pip/dev/tox-3.24.1
blankdots Aug 2, 2021
5d90c5a
Update aggregator/utils/utils.py
ViMuilu Aug 3, 2021
0ecd64d
Update tests/aggregator/test_aggregator_utils.py
ViMuilu Aug 3, 2021
a630db8
added beacon2.0
ViMuilu Aug 6, 2021
6b35b94
Update int.yml
ViMuilu Aug 6, 2021
792de72
Merge branch 'feature/beaconV2_support' into feature/gh_actions_build…
ViMuilu Aug 6, 2021
cecab11
Merge branch 'feature/gh_actions_build_beacon2.0' of github.com:CSCfi…
ViMuilu Aug 6, 2021
42d5195
changed aggregator url in integration tests
ViMuilu Aug 6, 2021
bb56636
removed cache
ViMuilu Aug 6, 2021
902c9d7
added cache
ViMuilu Aug 6, 2021
a909b58
change to int.yml
ViMuilu Aug 6, 2021
31d5d06
reverted int.yml change
ViMuilu Aug 6, 2021
009a01f
Update int.yml
ViMuilu Aug 6, 2021
c3c3042
removed beacon2.0 db
ViMuilu Aug 6, 2021
031b540
merge
ViMuilu Aug 6, 2021
411495a
changed ports
ViMuilu Aug 6, 2021
571e355
fix to test
ViMuilu Aug 6, 2021
8c36461
changed test expected responses
ViMuilu Aug 6, 2021
b519bbf
changed regsitry ports
ViMuilu Aug 6, 2021
a6f53c2
changed ports
ViMuilu Aug 6, 2021
6ddc36f
changed test number of responses back
ViMuilu Aug 6, 2021
e196f55
added beacon2.0 to docker-compose-test
ViMuilu Aug 6, 2021
2377570
Update int.yml
ViMuilu Aug 6, 2021
5e403d4
fixed url in fixtures
ViMuilu Aug 6, 2021
3f90eae
changed beacon2.x repo
ViMuilu Aug 9, 2021
164753b
changed hostname
ViMuilu Aug 9, 2021
cda5b42
reformat
ViMuilu Aug 9, 2021
3570c43
changed beacon url in fixtures
ViMuilu Aug 9, 2021
e04d927
changed beacon url in fixtures
ViMuilu Aug 9, 2021
20c5dfd
remove beacon2 from docker-compose
ViMuilu Aug 9, 2021
a6d8c78
removed .0
ViMuilu Aug 9, 2021
f8b1503
removed more .0
ViMuilu Aug 9, 2021
8eb61fc
removed .0
ViMuilu Aug 9, 2021
480d1ae
build db before beacon2
ViMuilu Aug 10, 2021
054f7fa
Update int.yml
blankdots Aug 10, 2021
9f1cbb9
create network first, not to fail
blankdots Aug 10, 2021
998451d
increase expected nb of services
blankdots Aug 10, 2021
ff411ac
simplify step of running beacon2
blankdots Aug 10, 2021
02fe841
beacon will be build as part of docker compose
blankdots Aug 10, 2021
1a6ca4f
number of responses from aggregator is 8
blankdots Aug 10, 2021
6169617
bump postgresql verison
blankdots Aug 10, 2021
b73b65e
look for beacon 2.x version but don't fail
blankdots Aug 10, 2021
071be67
Merge pull request #101 from CSCfi/test/beacon-2.x
ViMuilu Aug 10, 2021
8374d4e
Merge pull request #100 from CSCfi/feature/gh_actions_build_beacon2.0
ViMuilu Aug 10, 2021
6470938
Merge pull request #98 from CSCfi/feature/beaconV2_support
ViMuilu Aug 11, 2021
5922137
Bump asyncpg from 0.23.0 to 0.24.0
dependabot[bot] Aug 16, 2021
ee72c29
Merge pull request #103 from CSCfi/82e0dependabot/pip/dev/asyncpg-0.24.0
blankdots Aug 16, 2021
4b60d9f
Bump uvloop from 0.15.3 to 0.16.0
dependabot[bot] Aug 16, 2021
a8e844b
Merge pull request #102 from CSCfi/12afdependabot/pip/dev/uvloop-0.16.0
blankdots Aug 16, 2021
541d3ee
Bump ujson from 4.0.2 to 4.1.0
dependabot[bot] Aug 23, 2021
f5e36b5
cache lfs files
blankdots Aug 24, 2021
4b36c81
Merge pull request #107 from CSCfi/feature/cache-lfs
teemukataja Aug 24, 2021
8289183
Bump black from 21.7b0 to 21.8b0
dependabot[bot] Aug 30, 2021
6175a07
Bump testfixtures from 6.18.0 to 6.18.1
dependabot[bot] Sep 2, 2021
1e22930
Bump tox from 3.24.1 to 3.24.3
dependabot[bot] Sep 2, 2021
3fa055d
Merge pull request #108 from CSCfi/b70cdependabot/pip/dev/black-21.8b0
blankdots Sep 2, 2021
5128124
Merge pull request #106 from CSCfi/f013dependabot/pip/dev/ujson-4.1.0
blankdots Sep 2, 2021
bad4a7b
Merge pull request #105 from CSCfi/2698dependabot/pip/dev/testfixture…
blankdots Sep 2, 2021
c5695c0
Merge branch 'dev' into faecdependabot/pip/dev/tox-3.24.3
blankdots Sep 2, 2021
dd8b655
Merge pull request #104 from CSCfi/faecdependabot/pip/dev/tox-3.24.3
blankdots Sep 2, 2021
810f8fc
switch to ujson
blankdots Sep 2, 2021
aa3d0c8
Merge pull request #109 from CSCfi/feature/ujson
teemukataja Sep 3, 2021
963cc72
use beacon 2 data as url instead of lfs
blankdots Sep 27, 2021
167f25f
Merge pull request #115 from CSCfi/bugfix/beacon-2-data-url
blankdots Sep 27, 2021
ff34b55
Bump black from 21.8b0 to 21.9b0
dependabot[bot] Sep 27, 2021
34cd2ba
Bump sphinx-rtd-theme from 0.5.2 to 1.0.0
dependabot[bot] Sep 27, 2021
ff9d876
Bump tox from 3.24.3 to 3.24.4
dependabot[bot] Sep 27, 2021
9a2c2d8
Bump ujson from 4.1.0 to 4.2.0
dependabot[bot] Sep 27, 2021
410fa86
Merge pull request #110 from CSCfi/f1c1dependabot/pip/dev/black-21.9b0
blankdots Sep 27, 2021
598c3f3
Merge pull request #114 from CSCfi/d649dependabot/pip/dev/ujson-4.2.0
blankdots Sep 27, 2021
18e17e8
Merge pull request #111 from CSCfi/d75adependabot/pip/dev/sphinx-rtd-…
blankdots Sep 27, 2021
0de44a7
Merge pull request #112 from CSCfi/ee47dependabot/pip/dev/tox-3.24.4
blankdots Sep 27, 2021
4ca1c08
Bump testfixtures from 6.18.1 to 6.18.2
dependabot[bot] Sep 27, 2021
69229e9
Merge pull request #113 from CSCfi/1f35dependabot/pip/dev/testfixture…
blankdots Sep 27, 2021
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
16 changes: 16 additions & 0 deletions docker-compose-test.yml
Original file line number Diff line number Diff line change
@@ -138,3 +138,19 @@ services:
networks:
- other_net_registry
- apps

extra_bad_beacon:
hostname: extra_bad_beacon
image: cscfi/beacon-python
environment:
HOST: "0.0.0.0"
PORT: 5053
DATABASE_URL: other_db_registry
DATABASE_USER: user
DATABASE_PASSWORD: pass
DATABASE_NAME: registry
ports:
- 5053:5053
networks:
- other_net_registry
- apps
2 changes: 1 addition & 1 deletion registry/endpoints/services.py
Original file line number Diff line number Diff line change
@@ -105,7 +105,7 @@ async def update_service(request, db_pool):
if new_id_found_service and service_id != new_service_id:
response["message"] = "Service update failed, see error.."
response["error"] = "Another service has already been registered with the new service id."
raise web.HTTPConflict(body=json.dumps(response), content_type="application/json")
raise web.HTTPConflict(text=json.dumps(response), content_type="application/json")
# Request service info from given url
service_info = await http_request_info(url)
# Parse and validate service info object
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -2,15 +2,15 @@

setup(
name="beacon_network",
version="0.2.dev",
version="1.2.0",
description="Beacon Network services",
long_description_content_type="text/markdown",
project_urls={
"Source": "https://github.com/CSCfi/beacon-network",
},
author="CSC - IT Center for Science",
classifiers=[
"Development Status :: 3 - Alpha",
"Development Status :: 3 - Beta",
"Intended Audience :: Developers",
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
"License :: OSI Approved :: Apache Software License",
90 changes: 82 additions & 8 deletions tests/integration/run_tests.py
Original file line number Diff line number Diff line change
@@ -2,26 +2,94 @@
import asyncio
import httpx
import logging
import re
import json

FORMAT = "[%(asctime)s][%(name)s][%(process)d %(processName)s][%(levelname)-8s](L:%(lineno)s) %(funcName)s: %(message)s"
logging.basicConfig(format=FORMAT, datefmt="%Y-%m-%d %H:%M:%S")
LOG = logging.getLogger(__name__)
LOG.setLevel(logging.DEBUG)

SESSION = httpx.AsyncClient()

AGGREGATOR = "http://localhost:5050"
REGISTRY = "http://localhost:8080"
REGISTRY_KEY = "07b4e8ed58a6f97897b03843474c8cc981d154ffe45b10ef88a9f127b15c5c56"


async def test_service_info(endpoint, name, artifact):
"""Test service info endpoint."""
LOG.debug(f"Checking service info endpoint for: {artifact}")
response = await SESSION.get(f"{endpoint}/service-info")
assert response.status_code == 200, "HTTP status code error service info"
data = response.json()
assert data["name"] == name, "Wrong endpoint service name"
assert data["type"]["artifact"] == artifact, "Wrong service artifact"
async with httpx.AsyncClient() as client:
response = await client.get(f"{endpoint}/service-info")
assert response.status_code == 200, "HTTP status code error service info"
data = response.json()
assert data["name"] == name, "Wrong endpoint service name"
assert data["type"]["artifact"] == artifact, "Wrong service artifact"


async def test_get_services(endpoint, expected_nb, expected_beacon):
"""Test GET services registry."""
LOG.debug("Checking registry listing services")
async with httpx.AsyncClient() as client:
response = await client.get(f"{endpoint}/services")
assert response.status_code == 200, "HTTP status code error service info"
data = response.json()
assert len(data) == expected_nb, "We did not find the expected number of services"
assert re.search(f'"id": "{expected_beacon}"', json.dumps(data), re.M), "We did not find the expected beacon"

LOG.debug("Checking registry listing services types")
async with httpx.AsyncClient() as client:
server_types = await client.get(f"{endpoint}/services/types")
data = server_types.json()
assert data == ["service-registry", "beacon-aggregator", "beacon"], "We did not find the expected services types"


async def test_service_operations(endpoint):
"""Test Registry services operations."""
extra_beacon = {"type": "beacon", "url": "http://extra_bad_beacon:5053/service-info"}
update_beacon = {"type": "beacon", "url": "http://bad_beacon:5052/service-info"}

LOG.debug("Add new service to the registry")
async with httpx.AsyncClient() as client:
response = await client.post(f"{endpoint}/services", data=json.dumps(extra_beacon), headers={"Authorization": REGISTRY_KEY})
assert response.status_code == 201, "HTTP status code error service add"
data = response.json()
assert data["serviceId"] == "extra_bad_beacon:5053", "Wrong beacon id obtained"

LOG.debug("Update service from the registry with existing one")
async with httpx.AsyncClient() as client:
conflict_response = await client.put(
f"{endpoint}/services/{data['serviceId']}", data=json.dumps(update_beacon), headers={"Beacon-Service-Key": data["serviceKey"]}
)

conflict_data = conflict_response.json()
assert conflict_response.status_code == 409, "HTTP status code error service update"
assert conflict_data["error"] == "Another service has already been registered with the new service id.", "Conflict error mismatched"

LOG.debug("Update service from the registry correctly")
async with httpx.AsyncClient() as client:
update_response = await client.put(
f"{endpoint}/services/{data['serviceId']}", data=json.dumps(extra_beacon), headers={"Beacon-Service-Key": data["serviceKey"]}
)

updated_data = update_response.json()
assert update_response.status_code == 200, "HTTP status code error service update"

LOG.debug("Remove service from the registry")
async with httpx.AsyncClient() as client:
await client.delete(f"{endpoint}/services/{updated_data['newServiceId']}", headers={"Beacon-Service-Key": data["serviceKey"]})
assert update_response.status_code == 200, "HTTP status code error service delete"


async def test_query_aggregator(endpoint, expected_nb, expected_beacon):
"""Test Aggregatpr query operation."""
LOG.debug("make a query over the aggregator")
params = {"includeDatasetResponses": "HIT", "assemblyId": "GRCh38", "referenceName": "MT", "start": "9", "referenceBases": "T", "alternateBases": "C"}
async with httpx.AsyncClient() as client:
response = await client.get(f"{endpoint}/query", params=params)
data = response.json()
assert response.status_code == 200, "HTTP status code error aggregator query"
assert len(data) == expected_nb, "We did not find the expected number of responses"
assert re.search(f'"service": "{expected_beacon}"', json.dumps(data), re.M), "We did not find the expected beacon"


async def main():
@@ -31,7 +99,13 @@ async def main():
await test_service_info(AGGREGATOR, "ELIXIR-FI Beacon Aggregator", "beacon-aggregator")
await test_service_info(REGISTRY, "ELIXIR-FI Beacon Registry", "service-registry")

await SESSION.aclose()
LOG.debug("=== Test Registry Endpoint ===")

await test_get_services(REGISTRY, 4, "bad_beacon:5052")
await test_service_operations(REGISTRY)

LOG.debug("=== Test Aggregator Endpoint ===")
await test_query_aggregator(AGGREGATOR, 6, "http://bad_beacon:5052/query")


if __name__ == "__main__":