Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
fix for ut
Browse files Browse the repository at this point in the history
  • Loading branch information
knakazawa99 committed Mar 17, 2024
1 parent d92238d commit 5a4fd2d
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions tests/test_glue_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async def test_fetch_result(aws_credentials, glue_job_client):
JobName="test_job_name",
Arguments={},
)["JobRunId"]
glue_job_run = GlueJobRun(job_name="test_job_name", arguments={"arg1": "value1"})
glue_job_run = GlueJobRun(job_name="test_job_name", job_id="test_job_name")
glue_job_run.job_id = job_run_id
glue_job_run.client = glue_job_client
result = await glue_job_run.fetch_result()
Expand All @@ -33,16 +33,17 @@ def test_wait_for_completion(aws_credentials, glue_job_client):
glue_job_client.create_job(
Name="test_job_name", Role="test-role", Command={}, DefaultArguments={}
)
glue_job_run = GlueJobRun(
job_name="test_job_name",
arguments={"arg1": "value1"},
job_watch_poll_interval=0.1,
)
job_run_id = glue_job_client.start_job_run(
JobName="test_job_name",
Arguments={},
)["JobRunId"]

glue_job_run = GlueJobRun(
job_name="test_job_name",
job_id=job_run_id,
job_watch_poll_interval=0.1,
)

glue_job_client.get_job_run = MagicMock(
side_effect=[
{
Expand All @@ -69,15 +70,10 @@ def test_wait_for_completion_fail(aws_credentials, glue_job_client):
glue_job_client.create_job(
Name="test_job_name", Role="test-role", Command={}, DefaultArguments={}
)
glue_job_run = GlueJobRun(
job_name="test_job_name", arguments={"arg1": "value1"}
)
job_run_id = glue_job_client.start_job_run(
JobName="test_job_name",
Arguments={},
)["JobRunId"]
glue_job_run.client = glue_job_client
glue_job_run.job_id = job_run_id
glue_job_client.get_job_run = MagicMock(
side_effect=[
{
Expand All @@ -89,6 +85,10 @@ def test_wait_for_completion_fail(aws_credentials, glue_job_client):
},
]
)

glue_job_run = GlueJobRun(
job_name="test_job_name", job_id=job_run_id, client=glue_job_client
)
with pytest.raises(RuntimeError):
glue_job_run.wait_for_completion()

Expand All @@ -104,10 +104,8 @@ def test__get_job_run(aws_credentials, glue_job_client):
)["JobRunId"]

glue_job_run = GlueJobRun(
job_name="test_job_name", arguments={"arg1": "value1"}
job_name="test_job_name", job_id=job_run_id, client=glue_job_client
)
glue_job_run.job_id = job_run_id
glue_job_run.client = glue_job_client
response = glue_job_run._get_job_run()
assert response["JobRun"]["JobRunState"] == "SUCCEEDED"

Expand Down

0 comments on commit 5a4fd2d

Please sign in to comment.