def test_beam_prebuild(self):
    FLAGS.beam_prebuilt = False
    FLAGS.beam_it_module = 'sdks/java'
    FLAGS.beam_runner = 'dataflow'
    FLAGS.beam_filesystem = 'hdfs'
    FLAGS.beam_extra_properties = '[extra_key=extra_value]'

    with mock.patch.object(beam_benchmark_helper, '_GetGradleCommand') as mock_gradle, \
        mock.patch.object(beam_benchmark_helper, '_GetBeamDir'), \
        mock.patch.object(vm_util, 'IssueCommand') as mock_run:

      mock_gradle.return_value = 'gradlew'
      beam_benchmark_helper._PrebuildBeam()

      expected_cmd = [
          'gradlew',
          'clean',
          'assemble',
          '--stacktrace',
          '--info',
          '-p',
          'sdks/java',
          '-DintegrationTestRunner=dataflow',
          '-Dfilesystem=hdfs',
          '-Dextra_key=extra_value'
      ]
      mock_run.assert_called_once_with(expected_cmd,
                                       cwd=beam_benchmark_helper._GetBeamDir(),
                                       timeout=1500)
Ejemplo n.º 2
0
    def test_beam_prebuild(self):
        FLAGS.beam_prebuilt = False
        FLAGS.beam_it_module = ':sdks:java'
        FLAGS.beam_runner = 'dataflow'
        FLAGS.beam_filesystem = 'hdfs'
        FLAGS.beam_extra_properties = '[extra_key=extra_value]'

        with mock.patch.object(beam_benchmark_helper, '_GetGradleCommand') as mock_gradle, \
            mock.patch.object(beam_benchmark_helper, '_GetBeamDir'), \
            mock.patch.object(vm_util, 'IssueCommand') as mock_run:

            mock_gradle.return_value = 'gradlew'
            beam_benchmark_helper._PrebuildBeam()

            expected_cmd = [
                'gradlew', '--stacktrace', '--info', ':sdks:java:clean',
                ':sdks:java:assemble', '-DintegrationTestRunner=dataflow',
                '-Dfilesystem=hdfs', '-Dextra_key=extra_value'
            ]
            mock_run.assert_called_once_with(
                expected_cmd,
                cwd=beam_benchmark_helper._GetBeamDir(),
                timeout=1500)