diff options
| author | Jonathan Amsterdam <jba@google.com> | 2026-04-09 16:55:25 -0400 |
|---|---|---|
| committer | Jonathan Amsterdam <jba@google.com> | 2026-04-14 09:19:25 -0700 |
| commit | 81095845401a2ac64bc5ee43a4f9b013207d3b7e (patch) | |
| tree | 87fd6462fcbd32ddae5e9eaa0081569cc5415c7f /internal/log/log_test.go | |
| parent | aca48c6d9dcc4892027cdad3243527882201358b (diff) | |
| download | go-x-pkgsite-81095845401a2ac64bc5ee43a4f9b013207d3b7e.tar.xz | |
internal/api: test ServePackage with db
Test the ServePackage function against a real database, as well as the
fake data source.
- Modules and packages must be redistributable, or the DB strips
the documentation.
- Documentation must contain source code.
We must temporarily skip the dependency tests, to reduce the diffs on
this change. The test is still important, because it asserts that the
pkgsite command has only a few dependencies. To re-establish it, we
will move the API tests to internal/testing/api.
Change-Id: I67243ea2345c5e735edbdd6ee5bf2349a6b1eb60
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/765502
kokoro-CI: kokoro <noreply+kokoro@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ethan Lee <ethanalee@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Diffstat (limited to 'internal/log/log_test.go')
| -rw-r--r-- | internal/log/log_test.go | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/internal/log/log_test.go b/internal/log/log_test.go index 791bd775..d2ef9d53 100644 --- a/internal/log/log_test.go +++ b/internal/log/log_test.go @@ -19,7 +19,7 @@ const ( // Do not run in parallel. It overrides currentLevel. func TestSetLogLevel(t *testing.T) { - oldLevel := getLevel() + oldLevel := GetLevel() defer func() { currentLevel = oldLevel }() tests := []struct { @@ -38,7 +38,7 @@ func TestSetLogLevel(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { SetLevel(test.newLevel) - gotLevel := getLevel() + gotLevel := GetLevel() if test.wantLevel != gotLevel { t.Errorf("Error: want=%s, got=%s", test.wantLevel, gotLevel) } @@ -69,7 +69,6 @@ func TestLogLevel(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { - test.logFunc(context.Background(), test.logMsg) logs := logger.(*mockLogger).logs got := strings.Contains(logs, test.logMsg) @@ -101,7 +100,6 @@ func TestDefaultLogLevel(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { - test.logFunc(context.Background(), test.logMsg) logs := logger.(*mockLogger).logs |
