예제 #1
0
 def test_all_users_privileged(self):
   """Test when all_users_privileged is set."""
   test_helpers.patch(self, ['config.local_config.AuthConfig'])
   self.mock.AuthConfig.return_value = mock_config.MockConfig({
       'all_users_privileged': True,
   })
   self.assertTrue(access._is_privileged_user('*****@*****.**'))
 def test_no_topic(self):
   """Test when no topic is specified."""
   self.mock.ProjectConfig.return_value = mock_config.MockConfig({})
   issue_filer.notify_issue_update(self.testcase, 'new')
   messages = self.pubsub_client.pull_from_subscription(
       self.subscription, max_messages=16)
   self.assertEqual(0, len(messages))
  def setUp(self):
    helpers.patch(self, [
        'config.local_config.ProjectConfig',
    ])

    self.topic = 'projects/project/topics/issue-updates'
    self.subscription = 'projects/project/subscriptions/issue-updates'

    self.mock.ProjectConfig.return_value = mock_config.MockConfig({
        'issue_updates': {
            'pubsub_topic': self.topic,
        },
    })

    self.pubsub_client = pubsub.PubSubClient()
    self.pubsub_client.create_topic(self.topic)
    self.pubsub_client.create_subscription(self.subscription, self.topic)

    self.testcase = data_types.Testcase(
        crash_address='0xffff',
        security_flag=True,
        crash_type='CRASH TYPE',
        crash_state='CRASH STATE',
        bug_information='123')
    self.testcase.put()
예제 #4
0
  def setUp(self):
    helpers.patch(self, [
        'build_management.revisions.get_component_range_list',
        'config.local_config.ProjectConfig',
        'google_cloud_utils.blobs.read_key',
        'google_cloud_utils.pubsub.PubSubClient.publish',
    ])

    data_types.FuzzTarget(
        id='libFuzzer_proj_target',
        engine='libFuzzer',
        project='proj',
        binary='target').put()

    self.testcase = data_types.Testcase(
        bug_information='1337',
        job_type='libfuzzer_asan_proj',
        fuzzer_name='libFuzzer',
        overridden_fuzzer_name='libFuzzer_proj_target',
        regression='123:456',
        fixed='123:456')
    self.testcase.put()

    self.mock.read_key.return_value = b'reproducer'
    self.mock.get_component_range_list.return_value = [
        {
            'link_text': 'old:new',
        },
    ]

    self.mock.ProjectConfig.return_value = mock_config.MockConfig({
        'bisect_service': {
            'pubsub_topic': '/projects/project/topics/topic',
        }
    })
예제 #5
0
    def setUp(self):
        helpers.patch_environ(self)

        helpers.patch(self, [
            'build_management.build_manager.get_primary_bucket_path',
            'build_management.build_manager.get_revisions_list',
            'build_management.revisions.get_component_range_list',
            'config.local_config.ProjectConfig',
            'google_cloud_utils.blobs.read_key',
            'google_cloud_utils.pubsub.PubSubClient.publish',
        ])
        self.mock.ProjectConfig.return_value = mock_config.MockConfig({
            'env': {
                'PROJECT_NAME': 'test-project',
            },
            'bisect_service': {
                'pubsub_topic': '/projects/project/topics/topic',
            }
        })

        data_types.FuzzTarget(id='libFuzzer_proj_target',
                              engine='libFuzzer',
                              project='proj',
                              binary='target').put()

        self.testcase = data_types.Testcase(
            timestamp=datetime.datetime(2021, 1, 1),
            crash_type='crash-type',
            crash_state='A\nB\nC',
            security_flag=True,
            bug_information='1337',
            job_type='libfuzzer_asan_proj',
            fuzzer_name='libFuzzer',
            overridden_fuzzer_name='libFuzzer_proj_target',
            regression='123:456',
            fixed='123:456',
            crash_revision=3,
            security_severity=data_types.SecuritySeverity.MEDIUM,
            additional_metadata='{"last_tested_crash_revision": 4}')
        self.testcase.put()

        self.mock.read_key.return_value = b'reproducer'
        self.mock.get_component_range_list.return_value = [
            {
                'link_text': 'old:new',
            },
        ]
예제 #6
0
  def setUp(self):
    helpers.patch_environ(self)
    helpers.patch(
        self,
        [
            "base.utils.default_project_name",
            "base.memoize.FifoOnDisk.get",
            "base.memoize.FifoOnDisk.put",
            "config.local_config.ProjectConfig",
        ],
    )

    self.mock.get.return_value = None
    self.mock.default_project_name.return_value = "project"
    self.mock.ProjectConfig.return_value = mock_config.MockConfig({
        "env": {
            "REVISION_VARS_URL":
                "https://chromium.googlesource.com/chromium/src/+/%s/DEPS"
                "?format=text"
        }
    })

    os.environ[
        "REVISION_VARS_URL"] = "https://chromium.googlesource.com/chromium/src/+/%s/DEPS?format=text"
    data_types.Job(
        name=ANDROID_JOB_TYPE,
        environment_string=(
            "HELP_URL = help_url\n"
            "REVISION_VARS_URL = https://commondatastorage.googleapis.com/"
            "chrome-test-builds/android/revisions/%s"),
    ).put()
    data_types.Job(
        name=BASIC_JOB_TYPE,
        environment_string=("HELP_URL = help_url\n")).put()
    data_types.Job(
        name=SRCMAP_JOB_TYPE,
        environment_string=(
            "PROJECT_NAME = libass\n"
            "HELP_URL = help_url\n"
            "REVISION_VARS_URL = https://commondatastorage.googleapis.com/"
            "blah-%s.srcmap.json"),
    ).put()
    data_types.Job(
        name=CUSTOM_BINARY_JOB_TYPE,
        environment_string=("CUSTOM_BINARY = True\n")).put()
예제 #7
0
  def setUp(self):
    helpers.patch_environ(self)
    helpers.patch(self, [
        'base.utils.default_project_name',
        'base.memoize.FifoOnDisk.get',
        'base.memoize.FifoOnDisk.put',
        'config.local_config.ProjectConfig',
    ])

    self.mock.get.return_value = None
    self.mock.default_project_name.return_value = 'project'
    self.mock.ProjectConfig.return_value = mock_config.MockConfig({
        'env': {
            'REVISION_VARS_URL':
                'https://chromium.googlesource.com/chromium/src/+/%s/DEPS'
                '?format=text'
        }
    })

    os.environ['REVISION_VARS_URL'] = (
        'https://chromium.googlesource.com/chromium/src/+/%s/DEPS?format=text')
    data_types.Job(
        name=ANDROID_JOB_TYPE,
        environment_string=(
            'HELP_URL = help_url\n'
            'REVISION_VARS_URL = https://commondatastorage.googleapis.com/'
            'chrome-test-builds/android/revisions/%s')).put()
    data_types.Job(
        name=BASIC_JOB_TYPE,
        environment_string=('HELP_URL = help_url\n')).put()
    data_types.Job(
        name=SRCMAP_JOB_TYPE,
        environment_string=(
            'PROJECT_NAME = libass\n'
            'HELP_URL = help_url\n'
            'REVISION_VARS_URL = https://commondatastorage.googleapis.com/'
            'blah-%s.srcmap.json')).put()
    data_types.Job(
        name=CUSTOM_BINARY_JOB_TYPE,
        environment_string=('CUSTOM_BINARY = True\n')).put()