receiver

package
v0.0.0-...-e6a9d9d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 1, 2024 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const BufferBucket = "wptd-results-buffer"

BufferBucket is the GCS bucket to temporarily store results until they are proccessed.

View Source
const InternalUsername = "_processor"

InternalUsername is a special uploader whose password is kept secret and can only be accessed by services in this AppEngine project via Datastore.

View Source
const ResultsQueue = "results-arrival"

ResultsQueue is the name of the results processing TaskQueue.

View Source
const ResultsTarget = "/api/results/process"

ResultsTarget is the target URL for results processing tasks.

Variables

This section is empty.

Functions

func AuthenticateUploader

func AuthenticateUploader(aeAPI shared.AppEngineAPI, r *http.Request) string

AuthenticateUploader checks the HTTP basic auth against SecretManager, and returns the username if it's valid or "" otherwise.

This function is not defined on API interface for easier reuse in other packages.

func HandleResultsCreate

func HandleResultsCreate(a API, s checks.API, w http.ResponseWriter, r *http.Request)

HandleResultsCreate handles the POST requests for creating test runs.

func HandleResultsUpload

func HandleResultsUpload(a API, w http.ResponseWriter, r *http.Request)

HandleResultsUpload handles the POST requests for uploading results.

func HandleUpdatePendingTestRun

func HandleUpdatePendingTestRun(a API, w http.ResponseWriter, r *http.Request)

HandleUpdatePendingTestRun handles the PATCH request for updating pending test runs.

func RegisterRoutes

func RegisterRoutes()

RegisterRoutes adds all the result receiver route handlers.

Types

type API

type API interface {
	shared.AppEngineAPI

	AddTestRun(testRun *shared.TestRun) (shared.Key, error)
	IsAdmin(*http.Request) bool
	ScheduleResultsTask(uploader string, results, screenshots []string, extraParams map[string]string) (string, error)
	UpdatePendingTestRun(pendingRun shared.PendingTestRun) error
	UploadToGCS(gcsPath string, f io.Reader, gzipped bool) error
}

API abstracts all AppEngine/GCP APIs used by the results receiver.

func NewAPI

func NewAPI(ctx context.Context) API

NewAPI creates a real API from a given context. nolint:ireturn // TODO: Fix ireturn lint error

Directories

Path Synopsis
Package client is a package for simplifying the upload request made by a client to the results receiver upload endpoint (/api/results/upload).
Package client is a package for simplifying the upload request made by a client to the results receiver upload endpoint (/api/results/upload).
Package mock_receiver is a generated GoMock package.
Package mock_receiver is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL