def test_hive_dryrun(self, mock_popen, mock_temp_dir):
        mock_subprocess = MockSubProcess()
        mock_popen.return_value = mock_subprocess
        mock_temp_dir.return_value = "tst"

        op = HiveOperator(task_id='dry_run_basic_hql',
                          hql=self.hql,
                          dag=self.dag)
        op.dry_run()

        hive_cmd = [
            'beeline', '-u', '"jdbc:hive2://localhost:10000/default"',
            '-hiveconf', 'airflow.ctx.dag_id=', '-hiveconf',
            'airflow.ctx.task_id=', '-hiveconf', 'airflow.ctx.execution_date=',
            '-hiveconf', 'airflow.ctx.dag_run_id=', '-hiveconf',
            'airflow.ctx.dag_owner=', '-hiveconf', 'airflow.ctx.dag_email=',
            '-hiveconf', 'mapreduce.job.queuename=airflow', '-hiveconf',
            'mapred.job.queue.name=airflow', '-hiveconf',
            'tez.queue.name=airflow', '-f', '/tmp/airflow_hiveop_tst/tmptst'
        ]
        mock_popen.assert_called_with(hive_cmd,
                                      stdout=mock_subprocess.PIPE,
                                      stderr=mock_subprocess.STDOUT,
                                      cwd="/tmp/airflow_hiveop_tst",
                                      close_fds=True)
Пример #2
0
 def test_hive_dryrun(self):
     t = HiveOperator(task_id='dry_run_basic_hql',
                      hql=self.hql,
                      dag=self.dag)
     t.dry_run()
Пример #3
0
 def test_hive_dryrun(self):
     t = HiveOperator(
         task_id='dry_run_basic_hql', hql=self.hql, dag=self.dag)
     t.dry_run()