uranusjr commented on a change in pull request #19787:
URL: https://github.com/apache/airflow/pull/19787#discussion_r758398368
##########
File path: tests/providers/amazon/aws/hooks/test_glue.py
##########
@@ -75,6 +75,44 @@ def test_get_or_create_glue_job(self, mock_get_conn,
mock_get_iam_execution_role
).get_or_create_glue_job()
assert glue_job == mock_glue_job
+ @mock.patch.object(AwsGlueJobHook, "get_iam_execution_role")
+ @mock.patch.object(AwsGlueJobHook, "get_conn")
+ def test_get_or_create_glue_job_worker_type(self, mock_get_conn,
mock_get_iam_execution_role):
+ mock_get_iam_execution_role.return_value =
mock.MagicMock(Role={'RoleName': 'my_test_role'})
+ some_script = "s3:/glue-examples/glue-scripts/sample_aws_glue_job.py"
+ some_s3_bucket = "my-includes"
+
+ mock_glue_job = mock_get_conn.return_value.get_job()['Job']['Name']
+ glue_job = AwsGlueJobHook(
+ job_name='aws_test_glue_job',
+ desc='This is test case job from Airflow',
+ script_location=some_script,
+ iam_role_name='my_test_role',
+ s3_bucket=some_s3_bucket,
+ region_name=self.some_aws_region,
+ create_job_kwargs={'WorkerType': 'G.2X', 'NumberOfWorkers': 60},
+ ).get_or_create_glue_job()
+ assert glue_job == mock_glue_job
+
+ @mock.patch.object(AwsGlueJobHook, "get_iam_execution_role")
+ @mock.patch.object(AwsGlueJobHook, "get_conn")
+ def test_init_worker_type_value_error(self, mock_get_conn,
mock_get_iam_execution_role):
+ mock_get_iam_execution_role.return_value =
mock.MagicMock(Role={'RoleName': 'my_test_role'})
+ some_script = "s3:/glue-examples/glue-scripts/sample_aws_glue_job.py"
+ some_s3_bucket = "my-includes"
+
+ with self.assertRaises(ValueError, msg="Expected error message here"):
Review comment:
I don’t think this message is right :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]