diff options
| author | Jonathan Amsterdam <jba@google.com> | 2021-02-16 15:50:14 -0500 |
|---|---|---|
| committer | Jonathan Amsterdam <jba@google.com> | 2021-02-17 16:48:50 +0000 |
| commit | 04cc7e6c0d128d1d1e2f1d07b49e5aff31a13698 (patch) | |
| tree | 6a34e22357e660e4031adf46aea4b0326d3efdc1 /internal/worker/refetch_test.go | |
| parent | ab25703ea40f4268f55a510dad8697f4b0a63ae4 (diff) | |
| download | go-x-pkgsite-04cc7e6c0d128d1d1e2f1d07b49e5aff31a13698.tar.xz | |
internal/sample: improve treatment of sample licenses
To avoid sharing between tests, which can lead to race conditions,
create new sample license slices and structs each time we need them.
This uncovered some problems in the postgres tests.
- The UpsertModule test was changing the top-level module license, but
didn't propagate that change through all the units. We
sample.ReplaceLicense to address that.
- The checkModule was filling in missing license with defaults,
instead of the correct data.
Change-Id: I6074914155eb33d6ed6882f81a9d57b20135e422
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/292929
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Diffstat (limited to 'internal/worker/refetch_test.go')
| -rw-r--r-- | internal/worker/refetch_test.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/worker/refetch_test.go b/internal/worker/refetch_test.go index 3e615612..11dfca4b 100644 --- a/internal/worker/refetch_test.go +++ b/internal/worker/refetch_test.go @@ -111,7 +111,7 @@ func TestReFetch(t *testing.T) { Name: "bar", Synopsis: "Package bar", IsRedistributable: true, - Licenses: sample.LicenseMetadata, + Licenses: sample.LicenseMetadata(), }, }, } |
