Skip to content

Commit

Permalink
set all graphql context test suites to use code location `test_locati…
Browse files Browse the repository at this point in the history
…on` (#26174)

## Summary & Motivation
updates the various graphql test suites to use code location name
`test_location` rather than `test`. The `graphql_context` is set up with
code location name `test_location`. This was causing issues in a test
where the graphql_context expected the code location to be named
`test_location` but the suite was initialized with code location name
`test`

## How I Tested These Changes
existing tests
  • Loading branch information
jamiedemaria authored Dec 3, 2024
1 parent 3470415 commit 11e0a1f
Show file tree
Hide file tree
Showing 13 changed files with 231 additions and 196 deletions.
4 changes: 2 additions & 2 deletions python_modules/dagster-graphql/dagster_graphql/test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def infer_repository(graphql_context: WorkspaceRequestContext) -> RemoteReposito
assert len(repositories) == 1
return next(iter(repositories.values()))

code_location = graphql_context.get_code_location("test")
code_location = graphql_context.get_code_location(main_repo_location_name())
return code_location.get_repository("test_repo")


Expand All @@ -177,7 +177,7 @@ def infer_repository_selector(graphql_context: WorkspaceRequestContext) -> Selec
assert len(repositories) == 1
repository = next(iter(repositories.values()))
else:
code_location = graphql_context.get_code_location("test")
code_location = graphql_context.get_code_location(main_repo_location_name())
repository = code_location.get_repository("test_repo")

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import pytest
from dagster_graphql import DagsterGraphQLClientError, ReloadRepositoryLocationStatus
from dagster_graphql.test.utils import main_repo_location_name

from dagster_graphql_tests.client_tests.conftest import MockClient, python_client_test_suite
from dagster_graphql_tests.graphql.graphql_context_test_suite import (
Expand Down Expand Up @@ -96,6 +97,6 @@ def test_failure_with_query_error(mock_client: MockClient):
class TestReloadRepositoryLocationWithClient(BaseTestSuite):
def test_reload_location_real(self, graphql_client):
assert (
graphql_client.reload_repository_location("test").status
graphql_client.reload_repository_location(main_repo_location_name()).status
== ReloadRepositoryLocationStatus.SUCCESS
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from dagster._core.errors import DagsterUserCodeUnreachableError
from dagster_graphql import ShutdownRepositoryLocationStatus
from dagster_graphql.client.client_queries import SHUTDOWN_REPOSITORY_LOCATION_MUTATION
from dagster_graphql.test.utils import execute_dagster_graphql
from dagster_graphql.test.utils import execute_dagster_graphql, main_repo_location_name

from dagster_graphql_tests.graphql.graphql_context_test_suite import (
GraphQLContextVariant,
Expand All @@ -22,7 +22,7 @@ def test_shutdown_repository_location_permission_failure(self, graphql_context):
result = execute_dagster_graphql(
graphql_context,
SHUTDOWN_REPOSITORY_LOCATION_MUTATION,
{"repositoryLocationName": "test"},
{"repositoryLocationName": main_repo_location_name()},
)

assert result
Expand All @@ -36,7 +36,7 @@ def test_shutdown_repository_location(self, graphql_client, graphql_context):
origin = next(iter(graphql_context.get_code_location_entries().values())).origin
origin.create_client().heartbeat()

result = graphql_client.shutdown_repository_location("test")
result = graphql_client.shutdown_repository_location(main_repo_location_name())

assert result.status == ShutdownRepositoryLocationStatus.SUCCESS, result.message

Expand Down
Loading

0 comments on commit 11e0a1f

Please sign in to comment.