Exemplo n.º 1
0
 def testSingleNodeClusterCreation(self):
     kwargs = copy.copy(BASE_REDSHIFT_SPEC)
     kwargs['node_count'] = 1
     spec = benchmark_config_spec._EdwServiceSpec('NAME', **kwargs)
     redshift_local = redshift.Redshift(spec)
     self.assertIsNone(redshift_local.snapshot)
     with mock.patch(vm_util.__name__ + '.IssueCommand',
                     return_value=('out_', 'err_', 0)) as mock_issue:
         redshift_local.Initialize(redshift_local.cluster_identifier,
                                   redshift_local.node_type,
                                   redshift_local.node_count,
                                   redshift_local.user,
                                   redshift_local.password,
                                   FakeRedshiftClusterParameterGroup(),
                                   FakeRedshiftClusterSubnetGroup())
         mock_issue.assert_called_once()
         mock_issue.assert_called_with([
             'aws', '--output', 'json', '--region', 'us-east-1', 'redshift',
             'create-cluster', '--cluster-identifier', PKB_CLUSTER,
             '--cluster-type', 'single-node', '--node-type',
             REDSHIFT_NODE_TYPE, '--master-username', USERNAME,
             '--master-user-password', PASSWORD,
             '--cluster-parameter-group-name',
             'fake_redshift_cluster_parameter_group',
             '--cluster-subnet-group-name',
             'fake_redshift_cluster_subnet_group', '--publicly-accessible',
             '--automated-snapshot-retention-period=0'
         ])
Exemplo n.º 2
0
 def testInstallAndAuthenticateRunner(self):
     kwargs = copy.copy(_BASE_ATHENA_SPEC)
     spec = benchmark_config_spec._EdwServiceSpec('NAME', **kwargs)
     athena_local = athena.Athena(spec)
     athena_local.InstallAndAuthenticateRunner(
         vm=FakeRemoteVMCreateLambdaRole(),
         benchmark_name='fake_benchmark_name')
 def testPkbManagedGetClusterIdentifier(self):
     kwargs = copy.copy({'db': _PKB_CLUSTER_DATABASE})
     spec = benchmark_config_spec._EdwServiceSpec('NAME', **kwargs)
     edw_local = FakeEdwService(spec)
     self.assertEqual('pkb-' + FLAGS.run_uri,
                      edw_local.GetClusterIdentifier(spec))
     self.assertEqual('pkb-' + FLAGS.run_uri, edw_local.cluster_identifier)
 def testIsUserManaged(self):
     kwargs = copy.copy({
         'cluster_identifier': _PKB_CLUSTER,
         'db': _PKB_CLUSTER_DATABASE
     })
     spec = benchmark_config_spec._EdwServiceSpec('NAME', **kwargs)
     edw_local = FakeEdwService(spec)
     self.assertTrue(edw_local.IsUserManaged(spec))
Exemplo n.º 5
0
 def testInstallAndAuthenticateRunner(self):
   kwargs = copy.copy(_BASE_BIGQUERY_SPEC)
   spec = benchmark_config_spec._EdwServiceSpec('NAME', **kwargs)
   bigquery_local = bigquery.Bigquery(spec)
   with mock.patch(util.__name__ +
                   '.AuthenticateServiceAccount') as mock_issue:
     bigquery_local.InstallAndAuthenticateRunner(
         vm=FakeRemoteVM(), benchmark_name='fake_benchmark_name')
     mock_issue.assert_called_once()
Exemplo n.º 6
0
 def testInstallAndAuthenticateRunner(self):
     kwargs = copy.copy(_BASE_AZURE_DW_SPEC)
     spec = benchmark_config_spec._EdwServiceSpec('NAME', **kwargs)
     azure_sql_data_warehouse_local = azure_sql_data_warehouse.Azuresqldatawarehouse(
         spec)
     with mock.patch(vm_util.__name__ + '.IssueCommand',
                     return_value=('out_', 'err_', 0)) as mock_issue:
         azure_sql_data_warehouse_local.InstallAndAuthenticateRunner(
             vm=FakeRemoteVM(), benchmark_name='fake_benchmark_name')
         mock_issue.assert_called_once()
         mock_issue.assert_called_with([
             'az', 'sql', 'server', 'firewall-rule', 'create', '--name',
             _FAKE_IP_ADDRESS, '--resource-group', 'helix-westus2',
             '--server', 'helix-ds-1t', '--end-ip-address',
             'fake_ip_address', '--start-ip-address', 'fake_ip_address'
         ])
Exemplo n.º 7
0
 def testGetScriptExecutionResultsMocked(self):
     kwargs = copy.copy(BASE_REDSHIFT_SPEC)
     spec = benchmark_config_spec._EdwServiceSpec('NAME', **kwargs)
     edw_local = FakeEdwService(spec)
     client_vm = ClientVm()
     with mock.patch.object(client_vm,
                            'RemoteCommand',
                            return_value=(json.dumps({
                                'test.sql': {
                                    'execution_time': 1.0,
                                    'job_id': 'test_job_id'
                                }
                            }), '')):
         performance, _ = edw_local.GetScriptExecutionResults(
             'test.sql', client_vm)
         self.assertEqual(performance, 1.0)
Exemplo n.º 8
0
 def testInvalidClusterCreationError(self):
     kwargs = copy.copy(BASE_REDSHIFT_SPEC)
     kwargs['node_count'] = None
     with self.assertRaises(errors.Config.InvalidValue):
         benchmark_config_spec._EdwServiceSpec('NAME', **kwargs)
 def testIsPkbManaged(self):
     kwargs = copy.copy({'db': _PKB_CLUSTER_DATABASE})
     spec = benchmark_config_spec._EdwServiceSpec('NAME', **kwargs)
     edw_local = FakeEdwService(spec)
     self.assertFalse(edw_local.IsUserManaged(spec))
Exemplo n.º 10
0
 def testAlwaysExists(self):
     kwargs = copy.copy(_BASE_SNOWFLAKE_SPEC)
     spec = benchmark_config_spec._EdwServiceSpec('NAME', **kwargs)
     snowflake_local = snowflake.Snowflake(spec)
     self.assertTrue(snowflake_local._Exists())
Exemplo n.º 11
0
 def testCreateRequestError(self):
     kwargs = copy.copy(_BASE_SNOWFLAKE_SPEC)
     spec = benchmark_config_spec._EdwServiceSpec('NAME', **kwargs)
     snowflake_local = snowflake.Snowflake(spec)
     with self.assertRaises(NotImplementedError):
         snowflake_local._Create()
Exemplo n.º 12
0
 def testPrepareClientVm(self):
     kwargs = copy.copy({'db': _PKB_CLUSTER_DATABASE})
     spec = benchmark_config_spec._EdwServiceSpec('NAME', **kwargs)
     edw_local = FakeEdwService(spec)
     edw_local.PrepareClientVm(vm=PreparedClientVm(),
                               benchmark_name='fake_benchmark_name')
Exemplo n.º 13
0
 def testRunCommandHelper(self):
     kwargs = copy.copy(_BASE_SNOWFLAKE_SPEC)
     spec = benchmark_config_spec._EdwServiceSpec('NAME', **kwargs)
     snowflake_local = snowflake.Snowflake(spec)
     self.assertEqual('--connection fake_connection',
                      snowflake_local.RunCommandHelper())
Exemplo n.º 14
0
 def testInstallAndAuthenticateRunner(self):
     kwargs = copy.copy(_BASE_SNOWFLAKE_SPEC)
     spec = benchmark_config_spec._EdwServiceSpec('NAME', **kwargs)
     snowflake_local = snowflake.Snowflake(spec)
     snowflake_local.InstallAndAuthenticateRunner(
         vm=FakeRemoteVMCreateLambdaRole(), benchmark_name='fake_benchmark')