示例#1
0
 def test_create_cluster(self):
     self.add_mock_s3_data({'walrus': {}})
     self.monkey_patch_argv('--quiet', '--no-conf', '--cloud-fs-sync-secs',
                            '0', '--cloud-tmp-dir', 's3://walrus/tmp')
     self.monkey_patch_stdout()
     create_cluster_main()
     self.assertEqual(list(self.mock_emr_clusters.keys()),
                      ['j-MOCKCLUSTER0'])
     self.assertEqual(sys.stdout.getvalue(), b'j-MOCKCLUSTER0\n')
示例#2
0
 def test_create_cluster(self):
     self.add_mock_s3_data({'walrus': {}})
     self.monkey_patch_argv(
         '--quiet', '--no-conf',
         '--cloud-fs-sync-secs', '0',
         '--cloud-tmp-dir', 's3://walrus/tmp')
     self.monkey_patch_stdout()
     create_cluster_main()
     self.assertEqual(list(self.mock_emr_clusters.keys()),
                      ['j-MOCKCLUSTER0'])
     self.assertEqual(sys.stdout.getvalue(), b'j-MOCKCLUSTER0\n')
示例#3
0
    def test_tags(self):
        self.add_mock_s3_data({'walrus': {}})
        self.monkey_patch_argv(
            '--quiet', '--no-conf',
            '--cloud-fs-sync-secs', '0',
            '--cloud-tmp-dir', 's3://walrus/tmp',
            '--tag', 'tag_one=foo',
            '--tag', 'tag_two=bar',
        )
        self.monkey_patch_stdout()
        create_cluster_main()
        self.assertEqual(list(self.mock_emr_clusters.keys()),
                         ['j-MOCKCLUSTER0'])

        mock_cluster = self.mock_emr_clusters['j-MOCKCLUSTER0']
        self.assertEqual(mock_cluster.tags, [
            MockEmrObject(key='tag_one', value='foo'),
            MockEmrObject(key='tag_two', value='bar'),
        ])
    def test_tags(self):
        self.add_mock_s3_data({'walrus': {}})
        self.monkey_patch_argv(
            '--quiet', '--no-conf',
            '--cloud-fs-sync-secs', '0',
            '--cloud-tmp-dir', 's3://walrus/tmp',
            '--tag', 'tag_one=foo',
            '--tag', 'tag_two=bar',
        )
        self.monkey_patch_stdout()
        create_cluster_main()
        self.assertEqual(sorted(self.mock_emr_clusters),
                         ['j-MOCKCLUSTER0'])

        mock_cluster = self.mock_emr_clusters['j-MOCKCLUSTER0']

        self.assertEqual(
            _extract_non_mrjob_tags(mock_cluster),
            dict(tag_one='foo', tag_two='bar'))
示例#5
0
    def test_tags(self):
        self.add_mock_s3_data({'walrus': {}})
        self.monkey_patch_argv(
            '--quiet', '--no-conf',
            '--cloud-fs-sync-secs', '0',
            '--cloud-tmp-dir', 's3://walrus/tmp',
            '--tag', 'tag_one=foo',
            '--tag', 'tag_two=bar',
        )
        self.monkey_patch_stdout()
        create_cluster_main()
        self.assertEqual(list(self.mock_emr_clusters.keys()),
                         ['j-MOCKCLUSTER0'])

        mock_cluster = self.mock_emr_clusters['j-MOCKCLUSTER0']
        self.assertEqual(mock_cluster.tags, [
            MockEmrObject(key='tag_one', value='foo'),
            MockEmrObject(key='tag_two', value='bar'),
        ])
示例#6
0
    def test_tags(self):
        self.add_mock_s3_data({'walrus': {}})
        self.monkey_patch_argv(
            '--quiet', '--no-conf',
            '--cloud-fs-sync-secs', '0',
            '--cloud-tmp-dir', 's3://walrus/tmp',
            '--tag', 'tag_one=foo',
            '--tag', 'tag_two=bar',
        )
        self.monkey_patch_stdout()
        create_cluster_main()
        self.assertEqual(sorted(self.mock_emr_clusters),
                         ['j-MOCKCLUSTER0'])

        mock_cluster = self.mock_emr_clusters['j-MOCKCLUSTER0']

        self.assertEqual(
            _extract_non_mrjob_tags(mock_cluster),
            dict(tag_one='foo', tag_two='bar'))