Skip to content

Commit

Permalink
Clean up for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
pgrace-google committed Jan 24, 2025
1 parent 8270d0b commit b5a3eb4
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 7 deletions.
Empty file.
26 changes: 26 additions & 0 deletions src/appengine/handlers/cron/external_testcase_reader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Task for uploading externally submitted testcases."""

from clusterfuzz._internal.cron import external_testcase_reader
from handlers import base_handler
from libs import handler


class Handler(base_handler.Handler):
"""Handle externally submitted testcases."""

@handler.cron()
def get(self):
external_testcase_reader.main()
2 changes: 2 additions & 0 deletions src/appengine/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
from handlers import upload_testcase
from handlers import viewer
from handlers.cron import cleanup
from handlers.cron import external_testcase_reader
from handlers.cron import predator_pull
from handlers.cron import triage
from handlers.testcase_detail import crash_stats as crash_stats_on_testcase
Expand Down Expand Up @@ -112,6 +113,7 @@ def register_routes(flask_app, routes):
cron_routes = [
('/cleanup', cleanup.Handler),
('/external-update', external_update.Handler),
('/external-testcase-reader', external_testcase_reader.Handler),
('/fuzzer-stats/cache', fuzzer_stats.RefreshCacheHandler),
('/fuzzer-stats/preload', fuzzer_stats.PreloadHandler),
('/home-cache', home.RefreshCacheHandler),
Expand Down
9 changes: 2 additions & 7 deletions src/clusterfuzz/_internal/cron/external_testcase_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,12 @@ def submit_testcase(issue_id, file, filename, filetype, cmds):

def handle_testcases(tracker):
"""Fetches and submits testcases from bugs or closes unnecssary bugs."""
# TODO(pgrace) remove ID filter once done testing.
issues = tracker.find_issues_with_filters(
keywords=[],
query_filters=['componentid:1600865', 'id:373893311'],
only_open=True)
keywords=[], query_filters=['componentid:1600865'], only_open=True)

if len(issues) == 0:
return

# TODO(pgrace) Cache in redis.
vrp_uploaders = get_vrp_uploaders()

# TODO(pgrace) Implement rudimentary rate limiting.
Expand All @@ -183,8 +179,7 @@ def handle_testcases(tracker):
continue

# Submit valid testcases.
# TODO(pgrace) replace with 0 once testing is complete
attachment_metadata = attachment_metadata[6]
attachment_metadata = attachment_metadata[0]
attachment = tracker.get_attachment(
attachment_metadata['attachmentDataRef']['resourceName'])
submit_testcase(issue.id, attachment, attachment_metadata['filename'],
Expand Down

0 comments on commit b5a3eb4

Please sign in to comment.