Граф коммитов

90 Коммитов

Автор SHA1 Сообщение Дата
Julie Qiu bdcbfe07d1 internal/source: add Client
source.Client is added, which replaces the used of http.DefaultClient
when fetching source code. This also allows us to set a custom timeout
for tests vs when running the worker.

Change-Id: I5b7b0fd32fa7a2cf836b951af1ad471751fade00
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/709198
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-06 17:09:52 -04:00
Andrew Bonventre 1832788466 discovery: move content/static/third_party to top-level directory
This is required per Google’s open source policies.

Change-Id: Iff06d489a30f051c024618e53f65e46d4f89df94
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/697023
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-06 17:09:52 -04:00
Jonathan Amsterdam 2ec475d6de internal/worker: rename etl package to worker
This CL renames the package at internal/worker to "worker".

Updates b/150864416.

Change-Id: I9f3ab58faf57bfd78d14d880b4192e292b37f1b6
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/686703
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-06 15:50:52 -04:00
Jonathan Amsterdam 368146c56a all: rename directories from etl to worker
This CL only renames directories, and makes the minimal
changes needed for tests to pass.

Updates b/150864416.

Change-Id: Iebe977a1a80341e170c306e58851fa1b48ef79e6
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/686700
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-06 15:50:52 -04:00
Jonathan Amsterdam 0f8c7c9210 discovery: fix issues highlighted by mvdan.cc/unparam
I ran unparam (`go get mvdan.cc/unparam`) on our codebase, and
it found a few issues that I fixed.

- etl/main.go:getRedis: Use the context to set the DialTimout option when dialing redis.

- config.go:readOverrideFile: Use the bucketName argument, not a global constant.

- various: Remove unused parameters and return values.

Change-Id: I98a1e5d728d41033b5f632ccc6c22442d91c2b6d
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/678587
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-06 15:50:52 -04:00
Jonathan Amsterdam 67cc71a689 all: rename internal.Version to internal.Module
Rename the type, and any variable of that type.

Rename most functions from *Version* to *Module*, where it made sense.

No other changes.

Updates b/150143758.

Change-Id: I13079411376be0af7e53a577fc6ca1c92c38b6cd
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/677160
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-06 15:50:52 -04:00
Jonathan Amsterdam 66ad1f1dbe all: rename VersionInfo to ModuleInfo
This CL is pure renaming:
- internal.VersionInfo to internal.ModuleInfo
- related variables from vi to mi

Updates b/150143758.

Change-Id: I5da63a07d6f9b731016ffe92e403e5f2d9aadab7
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/673875
Reviewed-by: Julie Qiu <julieqiu@google.com>
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
2020-04-06 15:50:52 -04:00
Andrew Bonventre 20941adfec content/static, internal/frontend: clean up some details page JS and CSS
To be in accordance with golang.org/wiki/CSSStyleGuide

While not noted in the CSS style guide, using the ID attribute should
only be used when a class won’t suffice (linking to a place in the page,
label “for” attribute values, etc.). Otherwise it ends up on the window
object, polluting the global namespace.

Change-Id: Ibc4954d72455b89cc284d5baa87711c9333b83fb
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/672138
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-06 15:50:52 -04:00
Jonathan Amsterdam cfcdc5826a internal/config: make more stateless
As per the bug listed below, we are trying to remove the global cfg
variable from the config package. This CL brings us close to that
goal. There are still two uses of the global that are harder to remove.

Updates b/145301722.

Change-Id: Ia6c350ef5d817ff7fb3125cd207343d10911d64f
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/672580
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2020-04-06 15:50:52 -04:00
Julie Qiu c0dfa6a74d internal/queue: create package
The code for creating a new package is moved to internal/queue. This
allows for adding items to a task queue from the frontend, without
importing the entire internal/etl package.

No logic is changed, except the signature of
queue.InMemoryQueue.process, so that etl.FetchAndUpdateState can be
passed in, and the entire internal/etl package does not need to be
imported by internal/queue, which would lead to a circular import.

Updates b/135954292

Change-Id: I33a6418c73d85e15c4aa5593d633e19eb7e4eb1b
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/671014
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-06 15:50:52 -04:00
Jonathan Amsterdam 5067ee45a4 internal/postgres: read the has_go_mod column
Add VersionInfo.HasGoMod, and read it from the has_go_mod column.

Updates b/148519337.

Change-Id: Ibdab57821f90b845b1ff49ebd62353d16f27c7bd
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/650283
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-03-27 16:46:51 -04:00
Jonathan Amsterdam 9bb19a15fa devtools/pagecheck: add more pages to check
- Check additional packages.

- Reorganize to support checking a list of packages.

- Add a LicenseFilePath field to pagecheck.Page to correctly handle
  checking the license link.

Change-Id: If5c6531ad7ad79a5093eb3c5bfca94ddbcffd398
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/640540
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-03-27 16:46:51 -04:00
Jonathan Amsterdam 47922e29ff many: compute redistributability in the etl
The etl determines whether modules and packages are redistributable,
and saves that information to the database. The frontend just
reads the fields from the DB.

This CL replaces internal/license with internal/licenses throughout
the etl and frontend. A subsequent CL will replace it throughout
the repo, and remove the internal/license package.

Change-Id: If137d7c5e7e2ae326c28d0b5df80ddbeca134313

Fixes b/147505176.

Change-Id: I68a38baa7f55d36db9a63764571e610ca53064a6
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/641370
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-03-27 16:46:51 -04:00
Jonathan Amsterdam 902e38de88 internal/license,licenses: improve license comparison
Improve license comparison for tests so small changes to percentages
don't matter.

Change-Id: Id5f1118f4f2d95c6851a021ca0478e493e8070dc
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/637105
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-03-27 16:46:51 -04:00
Jonathan Amsterdam 372e4ce3d0 internal/fetch,etl: populate the go_mod_path column
fetch.Fetch now returns the module path from the go.mod file, and
the ETL writes it to the DB.

Along the way, simplify the return values of Fetch with a struct.

Change-Id: I191129b37c397ecb00e17aa7ba39e9cb0d0c89b6
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/632524
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-03-27 16:46:50 -04:00
Jonathan Amsterdam c29f9fe3c0 go.mod: update licensecheck
Update licensecheck to the latest version, which ignores Copyright notices
for improved matching.

Change-Id: I34197dfc75df073cac45986dd206295d0b5ae221
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/632521
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-03-27 16:46:50 -04:00
Jonathan Amsterdam a72c2ab9ef internal/fetch: check for mismatched path
Read the go.mod file from the proxy, and check if its path differs
from the module path. If they do differ, fail with an
AlternativeModule error, and record the relationship between the two
paths in a table for future use.

This change means that the discovery site will not serve modules that:

- are case variants of the canonical path
  e.g. github.com/Sirupsen/logrus vs. the correct github.com/sirupsen/logrus

- bypass the vanity import path
  e.g. github.com/gonum/gonum vs. the correct gonum.org/v1/gonum

- are "soft forks" of the module's repo: forks with an unchanged go.mod path
  e.g. github.com/alice02/kubernetes vs. the correct k8s.io/kubernetes

Change-Id: If78c94744440112f5720750885fe10f6a7dc7ab8
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/623922
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-03-27 16:46:50 -04:00
Julie Qiu dbcd26b7e0 internal/fetch: move FetchVersion and FetchAndInsertVersion from etl
We currently import internal/etl into internal/proxydatasource,
because etl.FetchVersion is used by the proxydatasource.

These functions are moved into their own package fetch.

FetchAndInsertVersion may be moved back to internal/etl in a later CL,
since it is only used by the ETL. At the moment, all functionality for
FetchVersion is being tested by FetchAndInsertVersion.

Updates b/146890756

Change-Id: Icaaf1feeac3821c82a85f21e07085d65556328d5
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/626675
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2020-03-27 16:46:50 -04:00
Jonathan Amsterdam 7938acbadb internal/testing/htmlcheck: remove InAt
The same can be achieved with CSS selectors, using :nth-child
and :nth-of-type.

Change-Id: I57486922d5d0060862b20d67f56be808b6c65082
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/617945
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2020-03-27 16:46:49 -04:00
Rob Findley 7dcd30a47e internal/frontend: fix bug where latest badge was shown on a directory
Previously, we were relying on GetPackage returning an error in order
for directories not to show the latest badge. Aside from making an
unnecessary database call, there are some cases where we're serving a
directory for a path, but that path is a valid package at another
version, so GetPackage(..., "latest") actually succeeds. In fact, it's
possible that the latest valid package version is actually *earlier*
than the directory version we're currently serving, which is especially
confusing for the user.

In order to be consistent about showing the badge only on module and
package pages, a new field 'PageType' is introduced on Details to expose
exactly which details handler is serving the page. This is then used in
the latestVersion function.

The new PageType field holds strictly more information than the existing
Namespace field, so Namespace was removed and all uses were updated to
use PageType.

Additionally, the order of 'packagePath' and 'modulePath' in the
latestVersion function was reversed. In all other argument lists
packagePath precedes modulePath (typically pkgPath, modulePath,
version), so this was changed purely for consistency.

Fixes b/143814014

Change-Id: I3d9fd40c44f0d3f02c38755950c3988699a00891
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/616656
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-03-27 16:46:49 -04:00
Rob Findley 8932109c08 internal/frontend: fix directory resolution bugs in servePackagePage
servePackagePage is updated to prefer serving a directory at the
requested version if it exists. This fixes the bug where the breadcrumb
link to github.com/docker/docker fails at any version > 0.9.1 (the
latest version where github.com/docker/docker was a package).

Broken tests in TestModulePackageDirectoryResolution are uncommented.
Notably, the test for github.com/golang/found/dir@latest is updated to
reflect revised behavior: in this case we will serve the latest package.
More discussion of this in


Updates b/143814014

Change-Id: I2822fef16259eb842aeba0c2f60c975a599b3999
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/616023
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-03-27 16:46:49 -04:00
Rob Findley e04c486cb2 internal/testing: add an integration test for pkg/directory resolution
A new integration test, TestModulePackageDirectoryResolution is added to
test the resolution of modules vs. packages vs. directories when a path
is only a valid package a certain versions.

In order for this test to pass I had to fix the return code when we
suggest a search: previously we were returning StatusSeeOther, but that
should really only be used when we're actually redirecting to a
different page via the location header. Instead, we now return
StatusNotFound.

A convenience function htmlcheck.Run is added for running htmlcheck on
the Body of a net/http.Response.

Updates b/143814014
Fixes b/145858138
Updates b/144031201
Updates b/143760329

Change-Id: Ie3f02165a6607b341379a1aea2eb078f300ad405
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/614811
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-03-27 16:46:49 -04:00
Rob Findley f419a8a43c internal/frontend: always return a JSON array for autocomplete
null was being returned when completion results are empty, which causes
autocomplete.js to generate errors.

In order to test this, hook up an HA redis to the integration test and
populate auto-completions.

Updates b/143370178

Change-Id: Ice30c7a6f9f3d4907746103193947bbd5dc5a45b
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/607126
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-03-27 16:46:49 -04:00
Julie Qiu d080da4319 internal: change Package.DocumentationHTML to string type
Previously Package.DocumentationHTML was a type []byte. This is now
changed to a type string, so that is matches its database type (which is
TEXT).

Updates b/144650806

Change-Id: I87784576e719d8aa666b0a21848a9ea6f10f8cf1
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/600048
Reviewed-by: Robert Findley <rfindley@google.com>
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
2020-03-27 16:46:48 -04:00
Julie Qiu 78700411ea internal: change License.Contents to string type
Previously license.License.Contents was a type []byte. This is now
changed to a type string, so that is matches its database type (which is
TEXT).

Updates b/144650806

Change-Id: I4b7cb1c234ccea330d6f3ae7cf50a67ea6021693
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/600047
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-03-27 16:46:48 -04:00
Julie Qiu 9dd390f2db internal: change VersionInfo.ReadmeContents to string type
Previously VersionInfo.ReadmeContents was a type []byte. This is now
changed to a type string, so that is matches its database type (which is
TEXT).

Updates b/144650806

Change-Id: I90e24dc8184b79a39f526e50ed1f75fd6d3895aa
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/600046
Reviewed-by: Robert Findley <rfindley@google.com>
2020-03-27 16:46:48 -04:00
Jonathan Amsterdam 2a84293dd9 internal/frontend: use link version for directory URL
Fixes b/144998202.

Change-Id: Ic3cb0d1b11a0a9b5408388ff09f35c4dbc8f99ff
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/604800
Reviewed-by: Robert Findley <rfindley@google.com>
2020-03-27 16:46:48 -04:00
Jonathan Amsterdam ce884d6fe3 internal/frontend: make latest-version links canonical
Put the link in the latest-version badge in the form
mod@version/suffix.

The best way to do this was to move the latest-badge-link
logic from the template to the server itself.

Also, rename the Suffix field of Package to PathAfterDirectory
to more accurately describe it.

Fixes b/144681389.

Change-Id: I16a78224ee6fa53b60954716338347a298dbef21
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/604414
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2020-03-27 16:46:48 -04:00
Jonathan Amsterdam 65e2b7a804 internal/database, internal/testing/dbtest: site-agnostic DB functionality
Extract into a separate package the core functionality from
internal/postgres that doesn't depend on our particular schema.

This makes it available for other uses, like devtools commands and etl
autocomplete.

Do the same for testing functionality.

We now have three packages where before we had only one:

- internal/postgres: discovery-specific DB operations and test support
- internal/database: discovery-agnostic DB operations
- internal/testing/dbtest: discovery-agnostic DB test support

Change-Id: I54c59aee328dae71ba6c77170a72e7a83da7c785
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/602327
Reviewed-by: Robert Findley <rfindley@google.com>
2020-03-27 16:46:48 -04:00
Jonathan Amsterdam c77f28bf03 internal/pagecheck: add checks for overview pages
Change-Id: I643e59f9eb13f9b9abbf8c30daedb2264a3a65e3
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/602822
Reviewed-by: Robert Findley <rfindley@google.com>
2020-03-27 16:46:48 -04:00
Rob Findley 4e25618631 internal/frontend: add an autocompletion endpoint
Now that completion data is being populated by the ETL, we can use it to
provide a JSON API for search autocompletions at /autocomplete?q=query.

This API reads lexical completions from Redis, sorts according to a
scoring heuristic, and returns the results as a JSON array.

For testing purposes, the pathCompletions function is moved from the etl
package to the complete package, and exported.

Updates b/143370178

Change-Id: I61d75296399222fa9ebfe8aadc909bf048389a23
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/602064
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-03-27 16:46:48 -04:00
Rob Findley 9d2ae5274b internal/etl: add an action to populate completion indexes
We're going to compute auto-completions using redis sorted sets in the
'HA' redis instance (because we don't want them to be evicted by
caching). This data need not be very fresh, and so can be computed by
the ETL every so often, perhaps once a day.

This CL wires the HA redis instance into the ETL, and adds an action to
update these Redis sorted sets. Doing this takes 1-2 minutes and
consumes quite a lot of memory, so there are some optimizations used:
 + the underlying *sql.DB is used for streaming search documents, rather
   than a method on postgres.DB. There is explanation for this in the
   code, and additionally I don't think this is so bad as long as it is
   only done in the ETL.
 + Completions data is loaded into temporary Redis keys and then renamed
   to overwrite the keys that will be used by the frontend, in order to
   minimize disruption while the completion data is being updated.

Updates b/143370178

Change-Id: I48caf77eb26d8ea7b60c2e117481bfa98ef089ca
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/602062
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-03-27 16:46:48 -04:00
Jonathan Amsterdam 91af9c239c internal/frontend: clarify versions
Avoid the use of the naked term "version" in the details
header. Instead, we have:

- DisplayVersion: the version formatted for human readability.

- LinkVersion: the version to use in links to the discovery site.

Also, use the link version in nav tab links:
Fixes b/144873325.

And improve test coverage.

Change-Id: Ida80867b6bd70a32c18f45b21b0b361b9e8e904f
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/603789
Reviewed-by: Robert Findley <rfindley@google.com>
2020-03-27 16:46:48 -04:00
Jonathan Amsterdam d850f268b8 internal/license,internal/postgres: store license coverage in DB
Store the output of licensecheck.Cover in the licenses table.
This will make our lives easier if we ever want to revisit our
coverage parameters.

In the process, generalize scanning of jsonb columns
into Go values.

Change-Id: Iadc89c89c2590e0894fefcdcd461283d90b2e701
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/601900
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-03-27 16:46:48 -04:00
Jonathan Amsterdam 857e664937 internal/frontend: fix module link on overview page for pseudo-version
A recent change (not yet in prod) introduced a bug:
On the overview page of a module with a pseudoversion, the
module link has the formatted version string (e.g. "v0.0.0 (201909091-392039)")
instead of the actual version.

Fixed, and added server tests to check.

Change-Id: I9f88272e45f496f21d741a3f119396c7223c7ee9
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/601903
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-03-27 16:46:48 -04:00
Jonathan Amsterdam 2464f4475d content/static/html/pages: add data-test-id attributes
Add data-test-id attributes to the license and module parts
of the info label, so we can more reliably extract them
for tests.

This practice is suggested by the TotT "Select DOM Elements by User-Facing Properties"


Change-Id: Ie4bf1cac8c3e88b728c2561256d210ab58819968
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/600820
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2020-03-27 16:46:48 -04:00
Jonathan Amsterdam 10c2ba048a content/static/html/pages/details.tmpl: change InfoLabel classes
Change InfoLabel-foo to DetailsHeader-infoLabelFoo.

Change-Id: Ic0ea4d36117381c97019941ea5e913b9316aa77d
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/601141
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2020-03-27 16:46:48 -04:00
Jonathan Amsterdam 9198466588 internal/frontend: move page checkers to a separate package
Factor out common structural checks on pages, so we can
use them in more than one place.

- Add internal/testing/pagecheck for common checks on page contents

- Use in internal/frontend/server_test.go

Change-Id: I744cf090f6bfad8c788be5b21cb5ed80f9adf8de
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/600800
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-03-27 16:46:48 -04:00
Jonathan Amsterdam 22510be30d internal/testing/htmlcheck: package for checking html structure
Move the html-checking code from internal/frontend tests to its own package.
Ths is a first step towards making these structural tests usable elsewhere,
like in an integration test that runs against a live endpoint.

Since these are now exported, give them better names in some cases.

Also, generalize to use regexps where that makes sense.

Change-Id: I1a3e0c09954d9cb07200c087db17e499a9d0d9a7
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/599089
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-03-27 16:46:48 -04:00
Jonathan Amsterdam 3ee4b78d3e internal: add a testing directory
Put all test-related packages there (sample, testhelper, integration).

production risk: none

Change-Id: I06673aaa5c3fd6966410f1c1ad2b34e4f2d88f94
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/599080
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2020-03-27 16:46:48 -04:00