Skip to content

Commit

Permalink
chore(service): disable migration check optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
m-alisafaee committed Dec 22, 2021
1 parent 915c471 commit 4db8931
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 7 deletions.
11 changes: 7 additions & 4 deletions renku/service/controllers/cache_migrations_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,11 @@ def renku_op(self):
def to_response(self):
"""Execute controller flow and serialize to service response."""

if "project_id" in self.context:
# use regular flow using cache
return result_response(self.RESPONSE_SERIALIZER, self.execute_op())
return result_response(self.RESPONSE_SERIALIZER, self.execute_op())

return result_response(self.RESPONSE_SERIALIZER, self._fast_op_without_cache())
# TODO: Enable this once the problem with anonymous access in gitlab provider is resolved
# if "project_id" in self.context:
# # use regular flow using cache
# return result_response(self.RESPONSE_SERIALIZER, self.execute_op())
#
# return result_response(self.RESPONSE_SERIALIZER, self._fast_op_without_cache())
3 changes: 2 additions & 1 deletion renku/service/views/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
accepts_json,
handle_common_except,
handle_migration_except,
optional_identity,
requires_cache,
requires_identity,
)
Expand Down Expand Up @@ -182,7 +183,7 @@ def migrate_project_view(user_data, cache):
@cache_blueprint.route("/cache.migrations_check", methods=["GET"], provide_automatic_options=False, versions=[V1_0])
@handle_common_except
@requires_cache
@requires_identity
@optional_identity
def migration_check_project_view(user_data, cache):
"""
Retrieve migration information for a project.
Expand Down
4 changes: 2 additions & 2 deletions renku/service/views/v0_9/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
from renku.service.gateways.gitlab_api_provider import GitlabAPIProvider
from renku.service.serializers.v0_9.cache import ProjectMigrationCheckResponseRPC_0_9
from renku.service.views.api_versions import V0_9
from renku.service.views.decorators import handle_common_except, requires_cache, requires_identity
from renku.service.views.decorators import handle_common_except, optional_identity, requires_cache


@handle_common_except
@requires_cache
@requires_identity
@optional_identity
def migration_check_project_view_0_9(user_data, cache):
"""
Retrieve migration information for a project.
Expand Down
6 changes: 6 additions & 0 deletions tests/service/fixtures/service_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ def it_remote_repo_url():
return IT_REMOTE_REPO_URL


@pytest.fixture(scope="module")
def it_remote_public_repo_url():
"""Returns a remote path to a public integration test repository."""
return "https://dev.renku.ch/gitlab/renku-python-integration-tests/no-renku"


@pytest.fixture(scope="function")
def it_remote_repo_url_temp_branch(it_remote_repo_url):
"""Returns a remote path to integration test repository."""
Expand Down
13 changes: 13 additions & 0 deletions tests/service/views/test_cache_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,3 +806,16 @@ def test_cache_gets_synchronized(

assert any(d.name == "my_dataset" for d in datasets)
assert any(d.name == payload["name"] for d in datasets)


@pytest.mark.service
@pytest.mark.integration
def test_check_migrations_remote_anonymous_0_9(svc_client, it_remote_public_repo_url):
"""Test anonymous users can check for migration of public projects."""
response = svc_client.get(
"/1.0/cache.migrations_check", query_string={"git_url": it_remote_public_repo_url}, headers={}
)

assert 200 == response.status_code

assert response.json["result"]["core_compatibility_status"]["migration_required"]
13 changes: 13 additions & 0 deletions tests/service/views/v0_9/test_cache_views_0_9.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,16 @@ def test_check_no_migrations_0_9(svc_client_with_repo):
assert not response.json["result"]["template_update_possible"]
assert not response.json["result"]["docker_update_possible"]
assert response.json["result"]["project_supported"]


@pytest.mark.service
@pytest.mark.integration
def test_check_migrations_remote_anonymous_0_9(svc_client, it_remote_public_repo_url):
"""Test anonymous users can check for migration of public projects."""
response = svc_client.get(
"/0.9/cache.migrations_check", query_string={"git_url": it_remote_public_repo_url}, headers={}
)

assert 200 == response.status_code

assert response.json["result"]["migration_required"]

0 comments on commit 4db8931

Please sign in to comment.