aboutsummaryrefslogtreecommitdiff
path: root/internal/postgres/insert_module_test.go
diff options
context:
space:
mode:
authorJonathan Amsterdam <jba@google.com>2020-04-23 14:01:16 -0400
committerJonathan Amsterdam <jba@google.com>2020-04-23 18:37:02 +0000
commit930eff289e17433cfdf620f884d18230b1d50a8a (patch)
tree2644221dd74db63ddf129209a71877883727470f /internal/postgres/insert_module_test.go
parent97e6cdd397320dc3cd649361a6f84a6beced2cec (diff)
downloadgo-x-pkgsite-930eff289e17433cfdf620f884d18230b1d50a8a.tar.xz
internal/postgres: upsert search documents in same transaction
When inserting a new module, upsert the search documents in the same transaction as the other inserts into modules, packages and so on. Hopefully this will remove the foreign-key violation we've been seeing. Updates b/154318694. Change-Id: Iaaa0c6ff9b51286d29b10e8a72970baa814a2cff Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/727144 CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com> Reviewed-by: Julie Qiu <julieqiu@google.com>
Diffstat (limited to 'internal/postgres/insert_module_test.go')
-rw-r--r--internal/postgres/insert_module_test.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/postgres/insert_module_test.go b/internal/postgres/insert_module_test.go
index 780099e7..4b81d14e 100644
--- a/internal/postgres/insert_module_test.go
+++ b/internal/postgres/insert_module_test.go
@@ -271,7 +271,7 @@ func TestPostgres_DeleteVersion(t *testing.T) {
if _, err := testDB.GetModuleInfo(ctx, v.ModulePath, v.Version); err != nil {
t.Fatal(err)
}
- if err := testDB.DeleteModule(ctx, nil, v.ModulePath, v.Version); err != nil {
+ if err := DeleteModule(ctx, testDB.db, v.ModulePath, v.Version); err != nil {
t.Fatal(err)
}
if _, err := testDB.GetModuleInfo(ctx, v.ModulePath, v.Version); !errors.Is(err, derrors.NotFound) {