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

1541 Коммитов

Автор SHA1 Сообщение Дата
Julie Qiu cda440f0c4 internal/postgres: delete unused code
Change-Id: Id4ca835afc9a11889be8f4812f89c9caf37ed8b7
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/724415
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-22 15:23:35 +00:00
Jonathan Amsterdam a0a7578cac internal/frontend: the copy button puts the path on the clipboard
The copy button at the top of a details page now puts just the path
on the clipboard, rather than

   import "path"

Updates golang/go#36809.
Updates golang/go#38514.

Change-Id: I7f475d0415f67a4ff72e95abef750d2604717a51
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/722967
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-21 20:46:41 +00:00
Jonathan Amsterdam edfe7a85d2 internal/worker: run status page queries in parallel
Speed up the loading of the worker status page.

Change-Id: I1503b5448fa6ef686a91fdc8fbd0490bf354177c
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/721278
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-21 16:19:38 +00:00
Julie Qiu bf4620d6e9 internal/postgres: log errors from deleting package_version_states
Change-Id: Ib6c36be1c493277e6581fabae464c0854075a0a7
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/720897
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-17 18:20:33 +00:00
Julie Qiu 371f7b3d46 internal/fetch: add experiment InsertPlaygroundLinks
Inserting playground links is now done behind a feature flag. There were
issues in dev when batch processing our entire dataset due to the load
we were putting on the playground server.

Updates b/154333737

Change-Id: I4119d9e48943bd693a6e46f74ea5a7cf8f0ad9a9
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/720896
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-17 18:20:00 +00:00
Julie Qiu 9ac5b09b1b internal/postgres: sort values for documentation, readme, and package_imports
Sort values inside postgres.insertDirectories properly before inserting
to prevent deadlocks.

Fixes b/154304606

Change-Id: Ide364d01fa585c702a078d85120f0c4088c54f7c
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/720887
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-17 18:19:16 +00:00
Julie Qiu 3841e59916 internal/postgres: use BulkInsertReturning instead of getPathIDs
Fixes b/154309056

Change-Id: I8308d813c8de6c053812425743d5c1f2b100d288
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/720885
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-17 18:19:01 +00:00
Julie Qiu 2a4e864814 internal/xcontent: fix staticcheck error SA1029
Fix staticcheck error:

	should not use built-in type string as key for value; define
	your own type to avoid collisions (SA1029)

Change-Id: I3f52e988113b51cef990fe0d4c86366010689b8f
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/720886
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-17 18:18:54 +00:00
Jonathan Amsterdam f6468b9e99 internal/xcontext,worker: detach context for fetch
Introduce internal/xcontext, which provides a way to "detach"
a context from its parent's timeout and cancellation signals.
(Copied from golang.org/x/tools.)

Use it when the worker does a fetch, to prevent the fetch
from being canceled while retaining the parent context's values.

Change-Id: I91fd7a5790b5654983ee72d8054fb74c45f9b417
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/720905
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-17 13:39:19 +00:00
Jonathan Amsterdam 195c752495 internal/fetch: log source info error at Info level
If getting the source info fails, log at Info rather than Error
to avoid cluttering the logs with non-serious errors.

Fixes b/154274456.

Change-Id: I5b5128a9bc242c2e94423c95c5e3c5d9786c78b2
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/720901
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-17 12:42:26 +00:00
Jonathan Amsterdam 48c5ef607b internal/queue: change task IDs more frequently
Have the task IDs change every hour, instead of every 3 hours.

We want to be able to retry a task more frequently.

Fixes #154277084.

Change-Id: Ib687775705e019ac62ea75efd29eff540e6fa2d8
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/720902
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-17 12:42:15 +00:00
Julie Qiu 8791d3ad85 internal: fix experiments for worker
Previously experiments were always inactive for the worker, because:

(1) X-Forwarded-For was empty since the request was coming from
Cloud Tasks. This is fixed by setting all experiments with rollout=100
to always be on. (There shouldn't be any case where worker flags
would only be partially on).

(2) Experiments were not being set on the new context produced by
trace.StartSpan and when a contextWithCancel was created and passed to
fetch.FetchModule. These are now set with the new
experiment.WithExperiment function.

Change-Id: Ie14b699bf435fecc8791c3ad435f73afe579812f
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/720661
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-17 12:19:11 +00:00
Julie Qiu b05b0bb71e internal/postgres: fix invalid byte seq for readme contents
An error occurred when inserting into readmes:
	invalid byte sequence for encoding "UTF8"

This is now fixed.

Change-Id: I51f7d0c22f833b052daabc405495518c4c5e47a4
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/720665
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-17 11:59:34 +00:00
Julie Qiu a67aa7573d internal/postgres: fix deadlock on package_imports
There are 500 errors when inserting into package_imports due to
deadlines. We had this problem in the past with imports, and sorting by
path previously solved the issue.

Change-Id: Ia49408d4aa448852434b4dfa2fa6b1261fbfdaee
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/720664
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-17 11:59:24 +00:00
Jonathan Amsterdam 83419ea86b internal/log: log active experiments
Change-Id: I677a3dec9de6f56ec0efc87fd169308ad89ecb72
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/720366
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-16 22:57:31 +00:00
Jonathan Amsterdam 26de0025b3 internal/database: support returning values from a bulk insert
Add DB.BulkInsertReturning, which supports the INSERT ... RETURNING
feature.

Change-Id: I8b7ca21295addde1ef29331d6f3d587bd848b4fd
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/719741
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-16 18:58:15 +00:00
Julie Qiu 890b9ef865 migrations: add index to paths.module_id
Change-Id: I9f3f4cc76988dd2107988c1e42f47f7c9c70a8f1
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/720341
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-16 18:22:42 +00:00
Julie Qiu ae04dfa4db all.bash: use unparam
unparam wasn't being used previously - it now runs when running
all.bash.

Change-Id: I71ee838b817ce1eb32c0fb60b34c5ef4c7cd4d25
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/718554
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-16 18:20:53 +00:00
Julie Qiu 75c81ce593 internal/fetch: rename FetchVersion to FetchModule
Change-Id: Ic1ff97a19199940f8d6b28c3f23d368fff2dbbbc
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/717235
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-16 18:08:12 +00:00
Julie Qiu 4ef67a5e1f internal/worker: make log messages clearer
Make log messages clearer by logging the function that finished when
logging successes.

Change-Id: I5f60683628c6a37c878d3c60208fa7f2d29156c9
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/719982
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-16 18:05:15 +00:00
Jonathan Amsterdam 940aaaec5f migrations: add indexes to version_map
Change-Id: I8da86a74f529b32f79a439837a7b0a85913939b6
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/720358
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-16 18:03:53 +00:00
Julie Qiu 2db72a9acc migrations: add idx_modules_series_path
Change-Id: I186d7317fc8b0975d721f8c5d9f7288f61df289e
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/720401
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-16 17:46:57 +00:00
Julie Qiu 4248b53d53 migrations: remove USING btree in 000001
Change-Id: I5ebaec10e38d4eff5fd815670bc78c93910815ae
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/720399
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-16 17:40:44 +00:00
Julie Qiu 486812ac3a migrations: fix typo in 000010 down.sql
The migration should be renaming readmes.file_path back to
readmes.filename.

Change-Id: Ibfd323c9047a2e0301b89a97fa04c60e9171877d
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/720343
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-16 17:35:34 +00:00
Julie Qiu 41e4c5cc8f migrations: add index for packages(module_path, version)
Change-Id: I4cc78c044c3c493936034920efe89e62b79814ae
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/719984
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-16 17:34:01 +00:00
Julie Qiu f82f4b17d7 internal/postgres: change version_map.module_id insert
We're still seeing issues with UpsertVersionMap, even though the queue
has been dialed down to insert only one module at a time.

Change UpsertVersionMap to be two queries:
(1) select moduleID: should be a relatively trivial query that just
fetches the module_id for a given path and version from the modules
table
(2) upsert version_map: same as query before the data model changes,
which upserts a row in the version_map table, but now it also upserts
a module_id

This will allow us to get more information on where in UpsertVersionMap
the query is failing.

Not that both the current query on master and the new one succeed when
running the worker locally and connecting to the dev database.

Change-Id: I3c1d0a621294fa0e38bdd2165a35460dbacda4e6
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/719980
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-16 14:12:41 +00:00
Jonathan Amsterdam 7d2a6cfadd internal/database: log transaction start and end
This requires adding a context parameter to the Transact method.

Change-Id: I98e8b9cbd8ce724cbed693d7549e82cf8ee75990
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/719480
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-16 14:10:02 +00:00
Jonathan Amsterdam f3d7078125 internal/database: support bulk updates
Implement BulkUpdate.

See the function's doc comment for details.

Change-Id: I050227a16ebe2f93cfc535fe95d1cd310fd6d00b
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/716478
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-16 12:36:42 +00:00
Julie Qiu e90fb1c4ad internal/postgres: insert into paths, readmes, documentation, package_imports
InsertVersion now populates the following tables:
- paths
- readmes
- documentation
- package_imports

Change-Id: Ib02220101d148a261cf55bd564cb9f9a46e60544
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/704882
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-15 20:33:35 +00:00
Julie Qiu 8c9ef27613 cmd/worker: add experiment middleware
The experiment middleware is added to the worker, so that we can run
experiments from the worker.

Change-Id: Iaeb01fbf5480efb2c1f89a5eeabea81a3198c655
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/718553
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-15 20:31:44 +00:00
Jonathan Amsterdam 89102d6687 go.mod: update go-cmp
Upgrade github.com/google/go-cmp to v0.4.0 to avoid a panic
in the race detector.

Change-Id: I9b96d536f92c0a765e5f8612b59bed61cde2b74e
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/718642
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-15 20:21:16 +00:00
Jonathan Amsterdam df4215d431 cloudbuild.yaml: let Google Cloud Build run our CI script
This can be done with

  gcloud builds submit

or by hooking up a CI system.

Change-Id: I07b1967ffd239aab1ed8a7c7993739f3017be490
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/718641
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-15 14:55:01 +00:00
Jonathan Amsterdam f6621325a3 internal/worker: replace populate-search-docs with repopulate-search-docs
The /populate-search-documents endpoint was no longer used, and it was
broken: it would have added to search_documents everything from the
packages table that wasn't already there, but we now omit alternative
modules and their packages from search_documents. This would have
put them back.

However, now that we are exploring changes to our search algorithm, we
do need a way to reprocess all search documents. So add a new
endpoint, /repopulate-search-documents, that upserts packages in
search_documents that haven't been updated since a given time.

Change-Id: Icbae9de078774111f3adb61a35dee95c4711dffa
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/717851
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-15 12:45:49 +00:00
Jonathan Amsterdam a30bfc65a3 internal/worker: refactor most handlers to return error
Simplify the error logic of most handlers by allowing
them to return an error.

Basically the same thing we did to the frontend in
75ed0713f34c997516b5c1c3e3f0e1ddb6cd8bfa.

Leave a couple of handlers as they are because they do something unusual.

Change-Id: Ib7c5f4f4752945a32c84fc3b49987e3712997521
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/717849
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-15 12:44:39 +00:00
Julie Qiu 503dde6aec internal/postgres: insert module_id and refactor saveModule
licenses.module_id and version_map.module_id are now populated.

saveModule is refactored so that inserting the module is done in
multiple functions, instead of one large function, for readability. The
functionality has not change and the pieces of a module are still being
inserted in a single transaction.

Change-Id: I3603a388be5dbb90ce8f05ae9c237989f965e6e4
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/717237
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-14 21:49:19 +00:00
Julie Qiu 682e446bfd internal/postgres: fix misspelling of preceded
Change-Id: I16fbe356ee414302babb1e45d8bc683f0fc861c2
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/717236
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-14 21:29:57 +00:00
Julie Qiu 92b94c6cae internal/worker: rename fetchAndInsertVersion to fetchAndInsertModule
For consistency with us using "module" instead of "version" in the data
model, fetchAndInsertVersion is renamed.

Change-Id: I515af4a62701601708798acec1e0283cfcb823bf
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/717846
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-14 20:37:34 +00:00
Julie Qiu f196ca8501 internal/fetch: update FetchVersion to return directories
FetchVersion will now return all of the directories in a module.

Module.Directories reprsents all of the directories in a module. A
directory is redefined as the path and all of the entities that exist at
that path, including README, package documentation, package imports, and
licenses.

Change-Id: I3ebb58800102a2d705fe7bcadaa3ddb476e4d9f6
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/705335
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-14 19:01:20 +00:00
Jonathan Amsterdam ba9b5823bf internal/postgres: change search tokens
Change the way that the Postgres ts_vector (list of search tokens) is computed.

- Use the path_tokens text configuration when creating the tsvector for the path.

- Construct sections B and C of the search document by combining the synopsis
  part of the README. Parts of this processing are:

  - Extract only the text of a markdown README, to remove images and
    other extraneous information.

  - Add alternatives to certain words in the synopsis and README. For
    example, add "postgresql" whenever we see "postgres".

- Modify the ts_rank call in the code to use a B weight of 1.

- Change the call to the database search function so that it invokes
  the function that has a B weight of 1.

These changes will require re-computing the
search_documents.tsv_search_tokens column. That should be done after
these are deployed.

Change-Id: Ib81601326f11efd81c8bc733694a000eccecf12b
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/705958
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-14 17:28:08 +00:00
Jonathan Amsterdam 86348f6125 internal/database: use the DB for inside a transaction as well as out
The database.DB type now can represent a DB connection in the
middle of a transaction. Such a DB is created only by calling
DB.Transact.

The resulting API is much simpler, since all the ...Tx methods
disappear.

Change-Id: I41afada87738e1eacdec2fcf115902edddeff867
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/716719
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-14 15:38:30 +00:00
Sameer Ajmani 90861f00a2 internal/fetch: add playground links for examples
During doc fetch, share each example to the Go playground,
then add a link to that shared example alongside the code.

Fixes golang/go#36865

Change-Id: I541774af5f29e0bdbb9bd812496cc6e4fd39fcb6
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/715584
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-13 21:35:11 +00:00
Jonathan Amsterdam b3c0315507 internal/posgres: export generatePathTokens
We can then use it in tools that experiment with alternative
search algorithms.

Change-Id: I40e6002f8c7b65ecde8a215a50bb7068736905e6
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/715705
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-13 18:12:38 +00:00
Sameer Ajmani 99709dcc27 Revert "internal/fetch: add playground links for examples"
This reverts commit 4a41701448.

Reason for revert: accidental merge

Change-Id: Id8ef4321a260a0f75587ddad320865aaf1539772
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/715580
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-10 18:55:07 +00:00
Sameer Ajmani 4a41701448 internal/fetch: add playground links for examples
During doc fetch, share each example to the Go playground,
then add a link to that shared example alongside the code.

Fixes golang/go#36865

Change-Id: Iaff51f99dd0d6d4fb71463304ee7cb747f037cd7
2020-04-10 11:12:14 -04:00
Julie Qiu 2de2e4c7b1 migrations: rename readme.filename to readme.file_path
Change-Id: I1d849921e9b993d4469a08fd56ac4a79a5ccc0bb
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/714316
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-10 13:16:05 +00:00
Jonathan Amsterdam ebef037f10 migrations: add a text config for path tokens
Add a text configuration that ignores parts of hyphenated words, to
reduce the inflated search ranking of paths with hyphenated elements.

We'll use this to create part of a search document that is taken from
the package path.

Currently we split a path into tokens, generating all sub-paths as
well as splitting at hyphens. For example,

    github.com/CrunchyData/postgres-operator/apiserver

results in the tokens

    postgres
    postgres-operator
    postgres-operator/apiserver

among others. The default text configuration splits at hyphens too, so
the three tokens above result in three copies of "postgres", when we'd
expect only one. That skews the search results to favor this package
more than it should.

If we use a text configuration that ignores hyphenated word parts, the
above tokens will result in only once instance of "postgres".

Change-Id: Ide76d80d32c079b6e3a07c7434ddddd61b39aadf
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/712881
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-08 19:19:42 +00:00
Jonathan Amsterdam d31f748a30 migrations: remove golang text configuration
The golang text configuration was intended to prevent stemming for
terms like "postgres" and "NATS". However, it's too great a loss to
drop stemming for other, ordinary English words (e.g. "logging" to
"log"). And though "postgres" is stemmed to the nonsensical "postgr",
that happens for both the document and the search query, so search
quality isn't affected.

Change-Id: I730590e27499fca9f70a3ce65a6e6ea364f4adda
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/712880
Reviewed-by: Julie Qiu <julieqiu@google.com>
2020-04-08 19:19:14 +00:00
Julie Qiu 56ebedf10a internal/fetch: rewrite tests
Tests for the fetch package are rewritten to make test cases clearer and
easier to add/edit.

Previously, there were multiple tests testing similar things in
fetch_test.go: TestExtractPackagesFromZip, TestFetchVersion, and
TestFetchVersion_Alternative.

The different cases from these tests are now moved to fetchdata_test.go,
and tested at the FetchVersion level.

Change-Id: Iceee81b4b889b350f0c10c53c2c5ca750a8db891
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/711173
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-08 15:55:30 +00:00
Julie Qiu 31573287af internal/middleware: fix CSP
An issue is fixed with the CSP that prevented images from
rendering properly.

The CSP frame-src is also removed since it is no longer being used.

Change-Id: I22aad093d218a3def7880289047b03471696a59d
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/711758
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-07 18:18:39 +00:00
Julie Qiu 0ab0da4544 migrations: fix missing comma in 000007
Change-Id: I489a8d3a2c999e7b3467a7442bff71d323424575
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/711162
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2020-04-07 15:37:39 +00:00