# Packages
No description provided by the author
Package sharedtest is a generated GoMock package.
# Functions
AddRoute is a helper for registering a handler for an http path (route).
AlwaysCachable is a helper for returning true for all requests.
CacheStatusOK is a hlper for indicating that a request is cacheable iff the status code is http.StatusOK.
CropString conditionally crops a string to the given length, if it is longer.
DefaultLoggerCtxKey returns the default key where a logger instance should be stored in a context.Context object.
DeleteCache deletes the object stored at key in Redis.
ExplodePossibleFilenames explodes the given single filename into the test names that could be created for it at runtime.
ExplodePossibleRenames returns a map of equivalent renames for the given file rename.
ExtractRunIDsBodyParam extracts {"run_ids": <run ids>} from a request JSON body.
FetchJSON fetches the given URL, which is expected to be JSON, and unmarshals it into the given value pointer, fatally logging any errors.
FetchLatestRuns fetches the TestRun metadata for the latest runs, using the API on the given host.
FetchRunForSpec loads the wpt.fyi TestRun metadata for the given spec.
FetchRunResultsJSON fetches the results JSON summary for the given test run, but does not include subtests (since a full run can span 20k files).
FetchRunResultsJSONForParam fetches the results JSON blob for the given [product]@[SHA] param.
FetchRunResultsJSONForSpec fetches the result JSON blob for the given spec.
FetchRuns fetches the TestRun metadata for the given sha / labels, using the API on the given host.
FilterandExtractBSFData filters rawBSFdata based on query filters `from` and `to`, and generates BSFData for bsf_handler.
FlushCache purges everything from Memorystore.
GetDefaultBrowserNames returns an alphabetically-ordered array of the names of the browsers which are to be included by default.
GetDefaultProducts returns the default set of products to show on wpt.fyi.
GetFeatureFlags returns all feature flag defaults set in the datastore.
GetLogger retrieves a non-nil Logger that is appropriate for use in ctx.
GetMetadataByteMap collects and parses all META.yml files from the wpt-metadata repository.
GetMetadataFilePath appends MetadataFileName to a Metadata folder path.
GetMetadataResponse retrieves the response to a WPT Metadata query.
GetMetadataResponseOnProducts constructs the response to a WPT Metadata query, given ProductSpecs.
GetResultsDiff returns a map of test name to an array of [newly-passing, newly-failing, total-delta], for tests which had different results counts in their map (which is test name to array of [count-passed, total]).
GetResultsURL constructs the URL to the result of a single test file in the given run.
GetSecret is a helper wrapper for loading a token's secret from the datastore by name.
GetSharedPath gets the longest path shared between the given paths.
GetTestRunIDs extracts the TestRunIDs from loaded datastore keys.
GetUploader gets the Uploader by the given name.
GetUserFromCookie extracts the User and GitHub OAuth token from a request's session cookie, if it exists.
GetUserLabel prefixes the given username with the prefix for using as a label.
GetWPTMetadataArchive iterates through wpt-metadata repository and returns a map that maps a test path to its META.yml file content, using a given ref.
GetWPTMetadataMasterSHA returns the SHA of the master branch of the wpt-metadata repo.
GetWPTTestPath concatenates a folder path and a test name into a WPT test path.
HandleWithLogging handles the request with the given handler, setting the logger on the request's context to be either a logrus logger (when running locally) or a Google Cloud logger (when running on GCP).
IsBrowserName determines whether the given name string is a valid browser name.
IsFeatureEnabled returns true if a feature with the given flag name exists, and Enabled is set to true.
IsLatest returns whether a SHA[0:10] is empty or "latest", both of which are treated as looking up the latest run for each browser.
IsStableBrowserName determines whether the given name string is a valid browser name of a stable browser (i.e.
MapStringKeys returns the keys in the given string-keyed map.
NewAppEngineAPI returns an AppEngineAPI for the given context.
NewAppEngineDatastore creates a Datastore implementation, or a Datastore implementation with Redis in front to cache all TestRun reads if cached is true.
NewAppEngineSecretManager instantiates a new secret manager for a given context.
NewByteCachedStore produces a CachedStore that composes a ReadWritable cache and a Readable store, operating over the input context.Context.
NewCachingHandler produces a caching handler with an underlying delegate handler, cache, cacheability decision function, and cache key producer.
NewCachingResponseWriter wraps the input http.ResponseWriter with a caching implementation.
NewCloudDatastore creates a Datastore implementation that is backed by a given Cloud Datastore client.
NewDiffAPI return and implementation of the DiffAPI interface.
NewFetchBSF returns an instance of FetchBSF for apiBSFHandler.
NewGitHubAccessControl returns a GitHubAccessControl for checking the permission of a logged-in GitHub user.
NewGitHubAccessControlFromRequest returns a GitHubAccessControl for checking the permission of a logged-in GitHub user from a request.
NewGitHubClientFromToken returns a new GitHub client from an access token.
NewGitHubOAuth returns an instance of GitHubOAuth for loginHandler and oauthHandler.
NewGitHubWebFeaturesClient constructs an instance of GitHubWebFeaturesClient with default values.
NewGZReadWritable produces a ReadWritable that ungzips on read and gzips on write, and delegates the input argument.
NewHTTPReadable produces a Readable bound to the input context.Context.
NewJSONObjectCache constructs a new JSON object cache, bound to the input context.Context and delgating to the input ReadWritable.
NewMultiError creates a MultiError from a slice of errors.
NewMultiErrorFromChan creates a MultiError by reading from an error channel.
NewNilLogger returns a new logger that silently ignores all Logger calls.
NewObjectCachedStore constructs a new CachedStore backed by an ObjectCache and ObjectStore.
NewRedisReadWritable produces a ReadWritable that performs read/write operations via the App Engine redis API through the input context.Context.
NewRedisSet returns a new redisSetReadWritable.
NewSecureCookie returns a SecureCookie instance for wpt.fyi.
NewSetFromStringSlice is a helper for the inability to cast []string to []interface{}.
NewTestDiff computes the differences between two test-run pass-count summaries, namely an array of [passing, total] counts.
NewTestRunQuery creates a concrete TestRunQuery backed by a Datastore interface.
NewTriageMetadata returns an instance of the triageMetadata struct to run Triage() method.
ParseAlignedParam parses the "aligned" param.
ParseBeforeAndAfterParams parses the before and after params used when intending to diff two test runs.
ParseBooleanParam parses the given param name as a bool.
ParseBrowserParam parses and validates the 'browser' param for the request.
ParseBrowsersParam returns a list of browser params for the request.
ParseDateTimeParam flexibly parses a date/time param with the given name as a time.Time.
ParseDiffFilterParams collects the diff filtering params for the given request.
ParseIntParam parses the result of ParseParam as int64.
ParseLabelsParam returns a set list of test-run labels to include, or nil if no labels are provided.
ParseMaxCountParam parses the 'max-count' parameter as an integer.
ParseMaxCountParamWithDefault parses the 'max-count' parameter as an integer, or returns the default when no param is present, or on error.
ParseOffsetParam parses the 'offset' parameter as an integer.
ParsePageToken decodes a base64 encoding of a TestRunFilter struct.
ParsePathsParam returns a set list of test paths to include, or nil if no filter is provided (and all tests should be included).
ParseProduct parses the `browser-version-os-version` input as a Product struct.
ParseProductOrBrowserParams parses the product (or, browser) params present in the given request.
ParseProductParam parses and validates the 'product' param for the request.
ParseProductsParam returns a list of product params for the request.
ParseProductSpec parses a test-run spec into a ProductAtRevision struct.
ParseProductSpecs parses multiple product specs.
ParseProductSpecUnsafe ignores any potential error parsing the given product spec.
ParsePRParam parses the "pr" parameter.
ParseQueryFilterParams parses shared params for the search APIs.
ParseQueryParamInt parses the URL query parameter at key.
ParseRepeatedInt64Param parses the result of ParseRepeatedParam as int64.
ParseRepeatedParam parses a param that may be a plural name, with all values comma-separated, or a repeated singular param.
ParseRunIDsParam parses the "run_ids" parameter.
ParseSHA parses and validates the given 'sha'.
ParseSHAParam parses and validates any 'sha' param(s) for the request.
ParseTestRunFilterParams parses all of the filter params for a TestRun query.
ParseTestURL parses a WPT test URL and returns its file path and query components.
ParseVersion parses the given version as a semantically versioned string.
ParseViewParam parses the 'view' parameter and ensures it is a valid value.
PrepareLinkFilter maps a MetadataResult test name to its URLs.
PrepareTestLabelFilter maps a MetadataResult test name to its labels.
ProductChannelToLabel maps known product-specific channel names to the wpt.fyi model's equivalent.
Router returns the global mux.Router used for handling all requests.
RunDiffFromSearchResponse builds a RunDiff from a searchcache response.
SetFeature puts a feature with the given flag name and enabled state.
SetHTTPClientForGitHubWebFeatures overrides the http client used to download the found asset from the release.
SplitWPTTestPath splits a WPT test path into a folder path and a test name.
StringSliceContains returns true if the given slice contains the given string.
TestStatusValueFromString returns the enum value associated with str (if any), or else TestStatusDefault.
ToStringSlice converts a set to a typed string slice.
URLAsCacheKey is a helper for returning the request's full URL as a cache key.
VersionPrefix returns the given query with a prefix filter on the given field name, using the >= and < filters.
WrapApplicationJSON wraps the given handler func in one that sets a Content-Type header of "text/json" on the response.
WrapHSTS wraps the given handler func in one that sets the Strict-Transport-Security header on the response.
WrapPermissiveCORS wraps the given handler func in one that sets an all-permissive CORS header on the response.
WrapTrustedCORS wraps the given handler func in one that sets an Allow-Credentials CORS header with specified origins and methods on the response.
# Constants
BetaLabel is the implicit label present for runs marked 'beta'.
ExperimentalLabel is the implicit label present for runs marked 'experimental'.
LatestSHA is a helper for the 'latest' keyword/special case.
MasterLabel is the implicit label present for runs marked 'master', i.e.
MaxCountMaxValue is the maximum allowed value for the max-count param.
MaxCountMinValue is the minimum allowed value for the max-count param.
MaxKeysPerLookup is the max number of keys allowed per lookup (e.g.
MetadataFileName is the name of Metadata files in the wpt-metadata repo.
PendingMetadataCacheKey is the key for the set that stores a list of pending metadata PRs in Redis.
PendingMetadataCachePrefix is the key prefix for pending metadata stored in Redis.
PRBaseLabel is the implicit label for running just the affected tests on a PR but without the changes (i.e.
PRHeadLabel is the implicit label for running just the affected tests on the head of a PR (with the changes).
ShowMetadataParam determines whether Metadata Information returns along with a test result query request.
SourceOwner is the owner name of the wpt-metadata repo.
SourceRepo is the wpt-metadata repo.
StableLabel is the implicit label present for runs marked 'stable'.
Constant enums for PendingTestRunStage.
Constant enums for PendingTestRunStage.
Constant enums for PendingTestRunStage.
Constant enums for PendingTestRunStage.
Constant enums for PendingTestRunStage.
Constant enums for PendingTestRunStage.
Constant enums for PendingTestRunStage.
Constant enums for PendingTestRunStage.
Constant enums for PendingTestRunStage.
Constant enums for PendingTestRunStage.
Constant enums for PendingTestRunStage.
Constant enums for PendingTestRunStage.
TestStatusAssert indicates that a non-fatal assertion failed.
TestStatusCrash indicates that the WPT test runner crashed attempting to run the test.
TestStatusDefault is the default value used when a status string cannot be interpreted.
TestStatusError indicates that some tests did not complete successfully.
TestStatusFail indicates that a test failed.
TestStatusNameAssert is the string representation of a test result where a non-fatal assertion failed.
TestStatusNameCrash is the string representation of a test result where the test runner crashed.
TestStatusNameDefault is the default string used when a status value cannot be interpreted.
TestStatusNameError is the string representation for a test result where a test harness error was encountered at test runtime.
TestStatusNameFail is the string representation of a test result where the test failed.
TestStatusNameNotRun is the string representation for a test result where the test exists but was not run.
TestStatusNameOK is the string represnetation of a test result where the test ran completely but may not have passed (and/or not all of its subtests passed).
TestStatusNamePass is the string representation of a test result where the test passed.
TestStatusNameSkip is the string representation of a test result where the test was disabled for this test run.
TestStatusNameTimeout is the string representation for a test result where the test timed out.
TestStatusNameUnknown is the string representation for an uninitialized TestStatus and should not be used.
TestStatusNotRun indicates that a test was not run.
TestStatusOK indicates that all tests completed successfully.
TestStatusPass indicates that all tests completed successfully and passed.
TestStatusSkip indicates that the test was disabled for this test run.
TestStatusTimeout indicates that some tests timed out.
TestStatusUnknown is an uninitialized TestStatus and should not be used.
UserLabelPrefix is a prefix used to denote a label for a user's GitHub handle, prefixed because usernames are essentially user input.
WebFeatureManifestRepo is where the web feature manifest is published.
WPTRepoName is the repo name for the GitHub wpt repo.
WPTRepoOwner is the owner (username) for the GitHub wpt repo.
# Variables
Clients is a singleton containing heavyweight (e.g.
ErrEntityAlreadyExists is returned by Datastore.Insert when the entity already exists.
ErrInvalidManifest is the error returned when the manifest is a valid JSON but without the correct structure.
ErrNoSuchEntity is returned by Datastore.Get when the key doesn't exist.
ErrRunNotInSearchCache is an error for 422 responses from the searchcache.
SHARegex is the pattern for a valid SHA1 hash that's at least 7 characters long.
# Structs
Browser holds objects that appear in browsers.json.
BSFData stores BSF data of the latest WPT revision.
CheckSuite entities represent a GitHub check request that has been noted by wpt.fyi, and will cause creation of a completed check_run when results arrive for the PR.
CloudSecretManager is the implementation of the SecretManager for GCP.
DiffFilterParam represents the types of changed test paths to include.
Flag represents an enviroment feature flag's default state.
GitHubWebFeaturesClient is the entrypoint to retrieving web features from GitHub.
LegacySearchRunResult is the results data from legacy test summarys.
LoggerCtxKey is a key for attaching a Logger to a context.Context.
Manifest represents a JSON blob of all the WPT tests.
Metadata represents a wpt-metadata META.yml file.
MetadataLink is an item in the `links` node of a wpt-metadata META.yml file, which lists an external reference, optionally filtered by product and a specific test.
MetadataTestResult is a filter for test results to which the Metadata link should apply.
MultiError is a convenient wrapper of multiple errors and is itself an implementation of the error interface.
PendingTestRun represents a TestRun that has started, but is not yet completed.
Product uniquely defines a browser version, running on an OS version.
ProductAtRevision defines a WPT run for a specific product, at a specific hash of the WPT repo.
ProductSpec is a struct representing a parsed product spec string.
ProductTestRunKeys is a tuple of a product and test run keys loaded for it.
ProductTestRuns is a tuple of a product and test runs loaded for it.
QueryFilter represents the ways search results can be filtered in the webapp search API.
RunDiff represents a summary of the differences between 2 runs.
SearchResponse contains a response to search API calls, including specific runs whose results were searched and the search results themselves.
SearchResult contains data regarding a particular test file over a collection of runs.
TestHistoryEntry formats Test History data for the datastore.
TestRun stores metadata for a test run (produced by run/run.py).
TestRunFilter represents the ways TestRun entities can be filtered in the webapp and api.
Token is used for test result uploads.
Uploader is a username/password combo accepted by the results receiver.
User represents an authenticated GitHub user.
Version is a struct for a parsed version string.
# Interfaces
AppEngineAPI is an abstraction of some appengine context helper methods.
CachedStore is a read-only interface that attempts to read from a cache, and when entities are not found, read from a store and write the result to the cache.
CachingResponseWriter is an http.ResponseWriter that can produce a new io.Reader instances that can replay the response.
Datastore abstracts a datastore, hiding the distinctions between cloud and appengine's datastores.
DiffAPI is an abstraction for computing run differences.
FetchBSF encapsulates the Fetch(isExperimental bool) method for testing.
GitHubAccessControl encapsulates implementation details of access control for the wpt-metadata repository.
GitHubOAuth encapsulates implementation details of GitHub OAuth flow.
Iterator abstracts a datastore.Iterator.
Key abstracts an int64 based datastore.Key.
Logger is an abstract logging interface that contains an intersection of logrus and GAE logging functionality.
MetadataFetcher is an abstract interface that encapsulates the Fetch() method.
ObjectCache is an ObjectStore that also supports Put() for arbitrary id/value pairs.
ObjectStore is a store that populates an arbitrary output object on Get().
Query abstracts a datastore.Query.
Readable is a provider interface for an io.ReadCloser.
ReadWritable is a provider interface for io.ReadCloser and io.WriteCloser.
RedisSet is an interface for an redisSetReadWritable, which performs Add/Remove/GetAll operations via the App Engine Redis API.
SecretManager is a simple interface for getting secrets.
TestRunQuery abstracts complex queries of TestRun entities.
TriageMetadata encapsulates the Triage() method for testing.
# Type aliases
ByBrowserName is a []Product sortable by BrowserName values.
A GitHubWebFeaturesClientOption configures GitHubWebFeaturesClient.
KeysByProduct is an array of tuples of {product, matching keys}, returned when a TestRun key query is executed.
MetadataLinks is a helper type for a MetadataLink slice.
MetadataResults is a map from test paths to all of the links under that test path.
PendingTestRunByUpdated sorts the pending test runs by updated (asc).
PendingTestRunStage represents the stage of a test run in its life cycle.
ProductSpecs is a helper type for a slice of ProductSpec structs.
ResultsDiff is a collection of test diffs, keyed by the test path.
ResultsSummary is a collection of [pass, total] summary pairs, keyed by test.
SHAs is a helper type for a slice of commit/revision SHAs.
TestDiff is an array of differences between 2 tests.
TestRunIDs is a helper for an array of TestRun IDs.
TestRuns is a helper type for an array of TestRun entities.
TestRunsByProduct is an array of tuples of {product, matching runs}, returned when a TestRun query is executed.
TestStatus represents the possible test result statuses.
TestSummary is a pair of [passing, total] counts for a test file.
WebFeaturesData is the public data type that represents the data parsed from a given manifest file.