Skip to content

Commit

Permalink
Revert "Remove hasura secret in integration tests"
Browse files Browse the repository at this point in the history
This reverts commit d81bbb2.
  • Loading branch information
Navarro-Jonathan committed Aug 3, 2023
1 parent 7ed1e98 commit dddea1f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ on:
env:
AERIE_USERNAME: "${{secrets.AERIE_USERNAME}}"
AERIE_PASSWORD: "${{secrets.AERIE_PASSWORD}}"
HASURA_GRAPHQL_ADMIN_SECRET: "${{secrets.HASURA_GRAPHQL_ADMIN_SECRET}}"
HASURA_GRAPHQL_JWT_SECRET: "${{secrets.HASURA_GRAPHQL_JWT_SECRET}}"
POSTGRES_USER: "${{secrets.POSTGRES_USER}}"
POSTGRES_PASSWORD: "${{secrets.POSTGRES_PASSWORD}}"
Expand Down
4 changes: 4 additions & 0 deletions docker-compose-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ services:
container_name: aerie_scheduler
depends_on: ['aerie_merlin', 'postgres']
environment:
HASURA_GRAPHQL_ADMIN_SECRET: '${HASURA_GRAPHQL_ADMIN_SECRET}'
MERLIN_GRAPHQL_URL: http://hasura:8080/v1/graphql
SCHEDULER_DB: 'aerie_scheduler'
SCHEDULER_DB_PASSWORD: '${AERIE_PASSWORD}'
Expand All @@ -89,6 +90,7 @@ services:
container_name: aerie_scheduler_worker
depends_on: ['postgres']
environment:
HASURA_GRAPHQL_ADMIN_SECRET: '${HASURA_GRAPHQL_ADMIN_SECRET}'
MERLIN_GRAPHQL_URL: http://hasura:8080/v1/graphql
MERLIN_LOCAL_STORE: /usr/src/app/merlin_file_store
SCHEDULER_OUTPUT_MODE: UpdateInputPlanWithNewActivities
Expand All @@ -110,6 +112,7 @@ services:
container_name: aerie_sequencing
depends_on: ['postgres']
environment:
HASURA_GRAPHQL_ADMIN_SECRET: '${HASURA_GRAPHQL_ADMIN_SECRET}'
LOG_FILE: console
LOG_LEVEL: debug
MERLIN_GRAPHQL_URL: http://hasura:8080/v1/graphql
Expand All @@ -136,6 +139,7 @@ services:
AERIE_SEQUENCING_DATABASE_URL: 'postgres://${AERIE_USERNAME}:${AERIE_PASSWORD}@postgres:5432/aerie_sequencing'
AERIE_SEQUENCING_URL: 'http://aerie_sequencing:27184'
AERIE_UI_DATABASE_URL: 'postgres://${AERIE_USERNAME}:${AERIE_PASSWORD}@postgres:5432/aerie_ui'
HASURA_GRAPHQL_ADMIN_SECRET: '${HASURA_GRAPHQL_ADMIN_SECRET}'
HASURA_GRAPHQL_DEV_MODE: 'true'
HASURA_GRAPHQL_ENABLE_CONSOLE: 'true'
HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log
Expand Down
26 changes: 14 additions & 12 deletions tests/integration_tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
AUTH_METHOD = AuthMethod.AERIE_NATIVE
USERNAME = ""
PASSWORD = ""
HASURA_ADMIN_SECRET = os.environ.get("HASURA_GRAPHQL_ADMIN_SECRET")

session = AerieHostSession.session_helper(
AUTH_METHOD,
Expand Down Expand Up @@ -69,7 +70,7 @@ def set_up_environment(request):
"Aerie instances are mismatched. Ensure test URLs are the same."

def test_model_clean():
result = runner.invoke(app, ["-c", "localhost", "models", "clean"])
result = runner.invoke(app, ["-c", "localhost", "--hasura-admin-secret", HASURA_ADMIN_SECRET, "models", "clean"])
assert result.exit_code == 0, \
f"\nOutput was: \n\n{result.stdout}"\
f"\nError was: \n\n {result.stderr}"
Expand All @@ -81,7 +82,7 @@ def test_model_clean():
def cli_upload_banana_model():
return runner.invoke(
app,
["-c", "localhost", "models", "upload", "--time-tag-version"],
["-c", "localhost", "--hasura-admin-secret", HASURA_ADMIN_SECRET, "models", "upload", "--time-tag-version"],
input=model_jar
+ "\n"
+ model_name
Expand All @@ -92,6 +93,7 @@ def cli_upload_banana_model():
)

def test_model_upload():
print(f"<<{HASURA_ADMIN_SECRET}>>")
result = cli_upload_banana_model()

# Get model_id of uploaded mission model
Expand All @@ -109,7 +111,7 @@ def test_model_upload():
)

def test_model_list():
result = runner.invoke(app, ["-c", "localhost", "models", "list"])
result = runner.invoke(app, ["-c", "localhost", "--hasura-admin-secret", HASURA_ADMIN_SECRET, "models", "list"])
assert result.exit_code == 0, \
f"\nOutput was: \n\n{result.stdout}"\
f"\nError was: \n\n {result.stderr}"
Expand All @@ -130,7 +132,7 @@ def test_plan_upload():
# Test plan upload
result = runner.invoke(
app,
["-c", "localhost", "plans", "upload", "--time-tag"],
["-c", "localhost", "--hasura-admin-secret", HASURA_ADMIN_SECRET, "plans", "upload", "--time-tag"],
input=plan_json + "\n" + str(model_id) + "\n",
)
assert result.exit_code == 0, \
Expand All @@ -151,7 +153,7 @@ def test_plan_upload():
def test_plan_duplicate():
result = runner.invoke(
app,
["-c", "localhost", "plans", "duplicate"],
["-c", "localhost", "--hasura-admin-secret", HASURA_ADMIN_SECRET, "plans", "duplicate"],
input=str(plan_id) + "\n" + dup_plan_name + "\n",
)
assert result.exit_code == 0, \
Expand All @@ -167,7 +169,7 @@ def test_plan_duplicate():


def test_plan_list():
result = runner.invoke(app, ["-c", "localhost", "plans", "list"])
result = runner.invoke(app, ["-c", "localhost", "--hasura-admin-secret", HASURA_ADMIN_SECRET, "plans", "list"])
assert result.exit_code == 0, \
f"\nOutput was: \n\n{result.stdout}"\
f"\nError was: \n\n {result.stderr}"
Expand All @@ -177,7 +179,7 @@ def test_plan_list():
def test_plan_simulate():
result = runner.invoke(
app,
["-c", "localhost", "plans", "simulate", "--output", "temp.json"],
["-c", "localhost", "--hasura-admin-secret", HASURA_ADMIN_SECRET, "plans", "simulate", "--output", "temp.json"],
input=str(plan_id) + "\n",
catch_exceptions=False
)
Expand All @@ -190,7 +192,7 @@ def test_plan_simulate():
def test_plan_create_config():
result = runner.invoke(
app,
["-c", "localhost", "plans", "create-config"],
["-c", "localhost", "--hasura-admin-secret", HASURA_ADMIN_SECRET, "plans", "create-config"],
input=str(plan_id) + "\n" + args_init + "\n",
)
assert result.exit_code == 0, \
Expand All @@ -204,7 +206,7 @@ def test_plan_create_config():
def test_plan_update_config():
result = runner.invoke(
app,
["-c", "localhost", "plans", "update-config"],
["-c", "localhost", "--hasura-admin-secret", HASURA_ADMIN_SECRET, "plans", "update-config"],
input=str(plan_id) + "\n" + args_update + "\n",
)
assert result.exit_code == 0, \
Expand All @@ -216,15 +218,15 @@ def test_plan_update_config():


def test_plan_delete():
result = runner.invoke(app, ["-c", "localhost", "plans", "delete"], input=str(plan_id) + "\n")
result = runner.invoke(app, ["-c", "localhost", "--hasura-admin-secret", HASURA_ADMIN_SECRET, "plans", "delete"], input=str(plan_id) + "\n")
assert result.exit_code == 0, \
f"\nOutput was: \n\n{result.stdout}"\
f"\nError was: \n\n {result.stderr}"
assert f"ID: {plan_id} has been removed." in result.stdout


def test_plan_clean():
result = runner.invoke(app, ["-c", "localhost", "plans", "clean"])
result = runner.invoke(app, ["-c", "localhost", "--hasura-admin-secret", HASURA_ADMIN_SECRET, "plans", "clean"])
assert result.exit_code == 0, \
f"\nOutput was: \n\n{result.stdout}"\
f"\nError was: \n\n {result.stderr}"
Expand All @@ -234,7 +236,7 @@ def test_plan_clean():
)

def test_model_delete():
result = runner.invoke(app, ["-c", "localhost", "models", "delete"], input=str(model_id))
result = runner.invoke(app, ["-c", "localhost", "--hasura-admin-secret", HASURA_ADMIN_SECRET, "models", "delete"], input=str(model_id))
assert result.exit_code == 0, \
f"\nOutput was: \n\n{result.stdout}"\
f"\nError was: \n\n {result.stderr}"
Expand Down

0 comments on commit dddea1f

Please sign in to comment.