diff options
| author | Julie Qiu <julie@golang.org> | 2020-07-15 22:27:50 -0400 |
|---|---|---|
| committer | Julie Qiu <julie@golang.org> | 2020-07-16 14:19:09 +0000 |
| commit | bf169b2ac368e7697d60c500e4d91cd51aff9785 (patch) | |
| tree | 767f9dd1cd27cf12456717aba659b8ba7561f4aa /internal/postgres | |
| parent | 606e69c6edd93487c16c4228812263e9d7d3cedc (diff) | |
| download | go-x-pkgsite-bf169b2ac368e7697d60c500e4d91cd51aff9785.tar.xz | |
internal/derrors: rename ToHTTPStatus to ToStatus
ToHTTPStatus is renamed to ToStatus, since several derrors codes are
not HTTP status codes.
Change-Id: I41bf1452fdbbafe1a4f752bc3092e39515a2db4b
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/242882
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Diffstat (limited to 'internal/postgres')
| -rw-r--r-- | internal/postgres/insert_module_test.go | 2 | ||||
| -rw-r--r-- | internal/postgres/requeue.go | 6 | ||||
| -rw-r--r-- | internal/postgres/requeue_test.go | 12 | ||||
| -rw-r--r-- | internal/postgres/search_test.go | 2 |
4 files changed, 11 insertions, 11 deletions
diff --git a/internal/postgres/insert_module_test.go b/internal/postgres/insert_module_test.go index 797282e4..84208059 100644 --- a/internal/postgres/insert_module_test.go +++ b/internal/postgres/insert_module_test.go @@ -337,7 +337,7 @@ func TestPostgres_NewerAlternative(t *testing.T) { ) err := testDB.UpsertModuleVersionState(ctx, modulePath, altVersion, "appVersion", time.Now(), - derrors.ToHTTPStatus(derrors.AlternativeModule), "example.com/mod", derrors.AlternativeModule, nil) + derrors.ToStatus(derrors.AlternativeModule), "example.com/mod", derrors.AlternativeModule, nil) if err != nil { t.Fatal(err) } diff --git a/internal/postgres/requeue.go b/internal/postgres/requeue.go index 14cabb70..d2a0761b 100644 --- a/internal/postgres/requeue.go +++ b/internal/postgres/requeue.go @@ -23,9 +23,9 @@ func (db *DB) UpdateModuleVersionStatesForReprocessing(ctx context.Context, appV for _, status := range []int{ http.StatusOK, - derrors.ToHTTPStatus(derrors.HasIncompletePackages), - derrors.ToHTTPStatus(derrors.BadModule), - derrors.ToHTTPStatus(derrors.AlternativeModule), + derrors.ToStatus(derrors.HasIncompletePackages), + derrors.ToStatus(derrors.BadModule), + derrors.ToStatus(derrors.AlternativeModule), } { query := `UPDATE module_version_states SET diff --git a/internal/postgres/requeue_test.go b/internal/postgres/requeue_test.go index 1e6edc25..b6091154 100644 --- a/internal/postgres/requeue_test.go +++ b/internal/postgres/requeue_test.go @@ -38,9 +38,9 @@ func TestGetNextModulesToFetchAndUpdateModuleVersionStatesForReprocessing(t *tes sizes = []int{small, big} statuses = []int{ http.StatusOK, - derrors.ToHTTPStatus(derrors.HasIncompletePackages), - derrors.ToHTTPStatus(derrors.AlternativeModule), - derrors.ToHTTPStatus(derrors.BadModule), + derrors.ToStatus(derrors.HasIncompletePackages), + derrors.ToStatus(derrors.AlternativeModule), + derrors.ToStatus(derrors.BadModule), http.StatusInternalServerError, http.StatusBadRequest, } @@ -188,9 +188,9 @@ func TestGetNextModulesToFetchOnlyPicksUpStatus0AndStatusGreaterThan500(t *testi statuses := []int{ http.StatusOK, - derrors.ToHTTPStatus(derrors.HasIncompletePackages), - derrors.ToHTTPStatus(derrors.AlternativeModule), - derrors.ToHTTPStatus(derrors.BadModule), + derrors.ToStatus(derrors.HasIncompletePackages), + derrors.ToStatus(derrors.AlternativeModule), + derrors.ToStatus(derrors.BadModule), http.StatusBadRequest, http.StatusInternalServerError, 0, diff --git a/internal/postgres/search_test.go b/internal/postgres/search_test.go index a13bf80d..0ad8240c 100644 --- a/internal/postgres/search_test.go +++ b/internal/postgres/search_test.go @@ -885,7 +885,7 @@ func TestUpdateSearchDocumentsImportedByCount(t *testing.T) { // Imagine we see a package with an alternative path at v1.2.0. // We add that information to module_version_states. alternativeModulePath := strings.ToLower(canonicalModule.ModulePath) - alternativeStatus := derrors.ToHTTPStatus(derrors.AlternativeModule) + alternativeStatus := derrors.ToStatus(derrors.AlternativeModule) err := testDB.UpsertModuleVersionState(ctx, alternativeModulePath, "v1.2.0", "", time.Now(), alternativeStatus, canonicalModule.ModulePath, nil, nil) if err != nil { |
