internal/postgres: remove do-not-insert-new-documentation

Change-Id: I4b5e4b4e6556f6f724dd01c08b7014c30b10a2b3
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/310313
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
This commit is contained in:
Julie Qiu 2021-04-16 12:30:00 -04:00
Родитель 3b55c14936
Коммит 8185298a14
19 изменённых файлов: 26 добавлений и 99 удалений

Просмотреть файл

@ -6,17 +6,15 @@
package internal
const (
ExperimentDoNotInsertNewDocumentation = "do-not-insert-new-documentation"
ExperimentSymbolHistoryVersionsPage = "symbol-history-versions-page"
ExperimentSymbolHistoryMainPage = "symbol-history-main-page"
ExperimentSymbolHistoryVersionsPage = "symbol-history-versions-page"
ExperimentSymbolHistoryMainPage = "symbol-history-main-page"
)
// Experiments represents all of the active experiments in the codebase and
// a description of each experiment.
var Experiments = map[string]string{
ExperimentDoNotInsertNewDocumentation: "Do not insert into the new_documentation table.",
ExperimentSymbolHistoryVersionsPage: "Show package API history on the versions page.",
ExperimentSymbolHistoryMainPage: "Show package API history on the main unit page.",
ExperimentSymbolHistoryVersionsPage: "Show package API history on the versions page.",
ExperimentSymbolHistoryMainPage: "Show package API history on the main unit page.",
}
// Experiment holds data associated with an experimental feature for frontend

Просмотреть файл

@ -14,7 +14,6 @@ import (
"github.com/google/go-cmp/cmp"
"golang.org/x/pkgsite/internal"
"golang.org/x/pkgsite/internal/derrors"
"golang.org/x/pkgsite/internal/experiment"
"golang.org/x/pkgsite/internal/postgres"
"golang.org/x/pkgsite/internal/proxy"
"golang.org/x/pkgsite/internal/testing/sample"
@ -80,11 +79,10 @@ func TestFetch(t *testing.T) {
},
} {
t.Run(test.name, func(t *testing.T) {
s, _, teardown := newTestServer(t, testModulesForProxy, nil, internal.ExperimentDoNotInsertNewDocumentation)
s, _, teardown := newTestServer(t, testModulesForProxy, nil)
defer teardown()
ctx, cancel := context.WithTimeout(context.Background(), testFetchTimeout)
ctx = experiment.NewContext(ctx, internal.ExperimentDoNotInsertNewDocumentation)
defer cancel()
status, responseText := s.fetchAndPoll(ctx, s.getDataSource(ctx), testModulePath, test.fullPath, test.version)
@ -143,10 +141,9 @@ func TestFetchErrors(t *testing.T) {
test.fetchTimeout = testFetchTimeout
}
ctx, cancel := context.WithTimeout(context.Background(), test.fetchTimeout)
ctx = experiment.NewContext(ctx, internal.ExperimentDoNotInsertNewDocumentation)
defer cancel()
s, _, teardown := newTestServer(t, testModulesForProxy, nil, internal.ExperimentDoNotInsertNewDocumentation)
s, _, teardown := newTestServer(t, testModulesForProxy, nil)
defer teardown()
got, err := s.fetchAndPoll(ctx, s.getDataSource(ctx), test.modulePath, test.fullPath, test.version)

Просмотреть файл

@ -161,10 +161,7 @@ func TestFetchPackageVersionsDetails(t *testing.T) {
} {
t.Run(tc.name, func(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), testTimeout*2)
ctx = experiment.NewContext(ctx,
internal.ExperimentDoNotInsertNewDocumentation,
internal.ExperimentSymbolHistoryVersionsPage,
)
ctx = experiment.NewContext(ctx, internal.ExperimentSymbolHistoryVersionsPage)
defer cancel()
defer postgres.ResetTestDB(testDB, t)

Просмотреть файл

@ -23,7 +23,6 @@ import (
"golang.org/x/pkgsite/internal"
"golang.org/x/pkgsite/internal/database"
"golang.org/x/pkgsite/internal/derrors"
"golang.org/x/pkgsite/internal/experiment"
"golang.org/x/pkgsite/internal/licenses"
"golang.org/x/pkgsite/internal/log"
"golang.org/x/pkgsite/internal/stdlib"
@ -533,17 +532,7 @@ func insertDocs(ctx context.Context, db *database.DB,
uniqueCols := []string{"unit_id", "goos", "goarch"}
docCols := append(uniqueCols, "synopsis", "source")
if experiment.IsActive(ctx, internal.ExperimentDoNotInsertNewDocumentation) {
return db.CopyUpsert(ctx, "documentation",
docCols, database.CopyFromChan(generateRows()), uniqueCols, "id")
}
// These lines can be deleted once new_documentation is renamed to documentation.
if err := db.CopyUpsert(ctx, "documentation",
docCols, database.CopyFromChan(generateRows()), uniqueCols, ""); err != nil {
return err
}
return db.CopyUpsert(ctx, "new_documentation",
return db.CopyUpsert(ctx, "documentation",
docCols, database.CopyFromChan(generateRows()), uniqueCols, "id")
}
@ -583,11 +572,7 @@ func getDocIDsForPath(ctx context.Context, db *database.DB,
unitIDs = append(unitIDs, pathToUnitID[path])
}
doctable := "new_documentation"
if experiment.IsActive(ctx, internal.ExperimentDoNotInsertNewDocumentation) {
doctable = "documentation"
}
q := fmt.Sprintf(`SELECT id, unit_id, goos, goarch FROM %s WHERE unit_id = ANY($1)`, doctable)
q := `SELECT id, unit_id, goos, goarch FROM documentation WHERE unit_id = ANY($1)`
if err := db.RunQuery(ctx, q, collect, pq.Array(unitIDs)); err != nil {
return nil, err
}

Просмотреть файл

@ -24,7 +24,6 @@ import (
"golang.org/x/pkgsite/internal"
"golang.org/x/pkgsite/internal/database"
"golang.org/x/pkgsite/internal/derrors"
"golang.org/x/pkgsite/internal/experiment"
"golang.org/x/pkgsite/internal/licenses"
"golang.org/x/pkgsite/internal/source"
"golang.org/x/pkgsite/internal/stdlib"
@ -209,7 +208,6 @@ func TestUpsertModule(t *testing.T) {
func TestInsertModuleErrors(t *testing.T) {
t.Parallel()
ctx := context.Background()
ctx = experiment.NewContext(ctx, internal.ExperimentDoNotInsertNewDocumentation)
testCases := []struct {
name string
@ -368,7 +366,6 @@ func TestInsertModuleLatest(t *testing.T) {
testDB, release := acquire(t)
defer release()
ctx := context.Background()
ctx = experiment.NewContext(ctx, internal.ExperimentDoNotInsertNewDocumentation)
// These tests are cumulative: actions of earlier tests may affect later ones.
for _, test := range []struct {

Просмотреть файл

@ -14,7 +14,6 @@ import (
"golang.org/x/pkgsite/internal"
"golang.org/x/pkgsite/internal/database"
"golang.org/x/pkgsite/internal/derrors"
"golang.org/x/pkgsite/internal/experiment"
"golang.org/x/pkgsite/internal/stdlib"
"golang.org/x/pkgsite/internal/symbol"
)
@ -302,11 +301,7 @@ func getUnitSymbols(ctx context.Context, db *database.DB, unitID int) (_ map[int
// Fetch all symbols for the unit. Order by symbol_type "Type" first, so
// that when we collect the children the structs for these symbols will
// already be created.
doctable := "new_documentation"
if experiment.IsActive(ctx, internal.ExperimentDoNotInsertNewDocumentation) {
doctable = "documentation"
}
query := fmt.Sprintf(`
query := `
SELECT
s1.name AS symbol_name,
s2.name AS parent_symbol_name,
@ -316,12 +311,12 @@ func getUnitSymbols(ctx context.Context, db *database.DB, unitID int) (_ map[int
d.goos,
d.goarch
FROM documentation_symbols ds
INNER JOIN %s d ON d.id = ds.documentation_id
INNER JOIN documentation d ON d.id = ds.documentation_id
INNER JOIN package_symbols ps ON ds.package_symbol_id = ps.id
INNER JOIN symbol_names s1 ON ps.symbol_name_id = s1.id
INNER JOIN symbol_names s2 ON ps.parent_symbol_name_id = s2.id
WHERE d.unit_id = $1
ORDER BY CASE WHEN ps.type='Type' THEN 0 ELSE 1 END;`, doctable)
ORDER BY CASE WHEN ps.type='Type' THEN 0 ELSE 1 END;`
// buildToSymbols contains all of the symbols for this unit, grouped by
// build context.
buildToSymbols := map[internal.BuildContext][]*internal.Symbol{}

Просмотреть файл

@ -11,7 +11,6 @@ import (
"golang.org/x/pkgsite/internal"
"golang.org/x/pkgsite/internal/derrors"
"golang.org/x/pkgsite/internal/experiment"
"golang.org/x/pkgsite/internal/middleware"
)
@ -21,11 +20,7 @@ func (db *DB) GetPackageSymbols(ctx context.Context, packagePath, modulePath str
defer derrors.Wrap(&err, "GetPackageSymbols(ctx, db, %q, %q)", packagePath, modulePath)
defer middleware.ElapsedStat(ctx, "GetPackageSymbols")()
doctable := "new_documentation"
if experiment.IsActive(ctx, internal.ExperimentDoNotInsertNewDocumentation) {
doctable = "documentation"
}
query := fmt.Sprintf(`
query := `
SELECT
s1.name AS symbol_name,
s2.name AS parent_symbol_name,
@ -37,7 +32,7 @@ func (db *DB) GetPackageSymbols(ctx context.Context, packagePath, modulePath str
d.goarch
FROM modules m
INNER JOIN units u ON u.module_id = m.id
INNER JOIN %s d ON d.unit_id = u.id
INNER JOIN documentation d ON d.unit_id = u.id
INNER JOIN documentation_symbols ds ON ds.documentation_id = d.id
INNER JOIN package_symbols ps ON ps.id = ds.package_symbol_id
INNER JOIN paths p1 ON u.path_id = p1.id
@ -50,7 +45,7 @@ func (db *DB) GetPackageSymbols(ctx context.Context, packagePath, modulePath str
AND m.version_type = 'release'
ORDER BY
CASE WHEN ps.type='Type' THEN 0 ELSE 1 END,
symbol_name;`, doctable)
symbol_name;`
// versionToNameToUnitSymbol contains all of the types for this unit,
// grouped by name and build context. This is used to keep track of the

Просмотреть файл

@ -12,7 +12,6 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"golang.org/x/pkgsite/internal"
"golang.org/x/pkgsite/internal/experiment"
"golang.org/x/pkgsite/internal/testing/sample"
)
@ -305,7 +304,6 @@ func compareUnitSymbols(ctx context.Context, t *testing.T, testDB *DB,
if err != nil {
t.Fatal(err)
}
ctx = experiment.NewContext(ctx, internal.ExperimentDoNotInsertNewDocumentation)
buildToSymbols, err := getUnitSymbols(ctx, testDB.db, unitID)
if err != nil {
t.Fatal(err)
@ -338,7 +336,6 @@ func compareUnitSymbols(ctx context.Context, t *testing.T, testDB *DB,
func comparePackageSymbols(ctx context.Context, t *testing.T, testDB *DB,
path, modulePath, version string, want map[string]map[string]*internal.UnitSymbol) {
t.Helper()
ctx = experiment.NewContext(ctx, internal.ExperimentDoNotInsertNewDocumentation)
got, err := testDB.GetPackageSymbols(ctx, path, modulePath)
if err != nil {
t.Fatal(err)

Просмотреть файл

@ -20,7 +20,6 @@ import (
"golang.org/x/pkgsite/internal"
"golang.org/x/pkgsite/internal/database"
"golang.org/x/pkgsite/internal/derrors"
"golang.org/x/pkgsite/internal/experiment"
"golang.org/x/pkgsite/internal/testing/dbtest"
"golang.org/x/pkgsite/internal/testing/sample"
"golang.org/x/pkgsite/internal/testing/testhelper"
@ -208,7 +207,6 @@ func MustInsertModule(ctx context.Context, t *testing.T, db *DB, m *internal.Mod
func MustInsertModuleGoMod(ctx context.Context, t *testing.T, db *DB, m *internal.Module, goMod string) {
t.Helper()
ctx = experiment.NewContext(ctx, internal.ExperimentDoNotInsertNewDocumentation)
var lmv *internal.LatestModuleVersions
if goMod == "-" {
if err := db.UpdateLatestModuleVersionsStatus(ctx, m.ModulePath, 404); err != nil {

Просмотреть файл

@ -10,8 +10,6 @@ import (
"net/http"
"testing"
"golang.org/x/pkgsite/internal"
"golang.org/x/pkgsite/internal/experiment"
"golang.org/x/pkgsite/internal/postgres"
)
@ -21,8 +19,7 @@ func TestFrontendFetchForMasterVersion(t *testing.T) {
// Add a module to the database.
// Check that GET of the module's path returns a 200.
ctx := context.Background()
ctx = experiment.NewContext(ctx, internal.ExperimentDoNotInsertNewDocumentation)
q, teardown := setupQueue(ctx, t, testModules[:1], internal.ExperimentDoNotInsertNewDocumentation)
q, teardown := setupQueue(ctx, t, testModules[:1])
const modulePath = "example.com/basic"
defer teardown()
ts := setupFrontend(ctx, t, q, nil)

Просмотреть файл

@ -26,10 +26,7 @@ var (
func TestFrontendMainPage(t *testing.T) {
defer postgres.ResetTestDB(testDB, t)
exps := []string{
internal.ExperimentSymbolHistoryMainPage,
internal.ExperimentDoNotInsertNewDocumentation,
}
exps := []string{internal.ExperimentSymbolHistoryMainPage}
processVersions(
experiment.NewContext(context.Background(), exps...),
t, testModules)

Просмотреть файл

@ -20,10 +20,7 @@ import (
func TestFrontendVersionsPage(t *testing.T) {
defer postgres.ResetTestDB(testDB, t)
exps := []string{
internal.ExperimentSymbolHistoryVersionsPage,
internal.ExperimentDoNotInsertNewDocumentation,
}
exps := []string{internal.ExperimentSymbolHistoryVersionsPage}
processVersions(
experiment.NewContext(context.Background(), exps...),
t, testModules)

Просмотреть файл

@ -18,7 +18,6 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/google/safehtml/template"
"golang.org/x/pkgsite/internal"
"golang.org/x/pkgsite/internal/experiment"
"golang.org/x/pkgsite/internal/godoc/dochtml"
"golang.org/x/pkgsite/internal/index"
"golang.org/x/pkgsite/internal/middleware"
@ -39,7 +38,6 @@ func TestMain(m *testing.M) {
func TestEndToEndProcessing(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
ctx = experiment.NewContext(ctx, internal.ExperimentDoNotInsertNewDocumentation)
defer cancel()
defer postgres.ResetTestDB(testDB, t)

Просмотреть файл

@ -14,7 +14,6 @@ import (
"github.com/alicebob/miniredis/v2"
"github.com/go-redis/redis/v8"
"github.com/google/safehtml/template"
"golang.org/x/pkgsite/internal"
"golang.org/x/pkgsite/internal/cache"
"golang.org/x/pkgsite/internal/config"
"golang.org/x/pkgsite/internal/index"
@ -36,11 +35,10 @@ func setupWorker(ctx context.Context, t *testing.T, proxyClient *proxy.Client, i
}
// TODO: it would be better if InMemory made http requests
// back to worker, rather than calling fetch itself.
queue := queue.NewInMemory(ctx, 10, []string{internal.ExperimentDoNotInsertNewDocumentation},
func(ctx context.Context, mpath, version string) (int, error) {
code, _, err := fetcher.FetchAndUpdateState(ctx, mpath, version, "test")
return code, err
})
queue := queue.NewInMemory(ctx, 10, nil, func(ctx context.Context, mpath, version string) (int, error) {
code, _, err := fetcher.FetchAndUpdateState(ctx, mpath, version, "test")
return code, err
})
workerServer, err := worker.NewServer(&config.Config{}, worker.ServerConfig{
DB: testDB,

Просмотреть файл

@ -54,7 +54,6 @@ type Fetcher struct {
func (f *Fetcher) FetchAndUpdateState(ctx context.Context, modulePath, requestedVersion, appVersionLabel string) (_ int, resolvedVersion string, err error) {
defer derrors.Wrap(&err, "FetchAndUpdateState(%q, %q, %q)", modulePath, requestedVersion, appVersionLabel)
tctx, span := trace.StartSpan(ctx, "FetchAndUpdateState")
fmt.Println(experiment.FromContext(ctx).Active())
ctx = experiment.NewContext(tctx, experiment.FromContext(ctx).Active()...)
ctx = log.NewContextWithLabel(ctx, "fetch", modulePath+"@"+requestedVersion)
if !utf8.ValidString(modulePath) {

Просмотреть файл

@ -14,7 +14,6 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"golang.org/x/pkgsite/internal"
"golang.org/x/pkgsite/internal/experiment"
"golang.org/x/pkgsite/internal/godoc"
"golang.org/x/pkgsite/internal/licenses"
"golang.org/x/pkgsite/internal/postgres"
@ -41,7 +40,6 @@ var (
func TestFetchAndUpdateState(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
ctx = experiment.NewContext(ctx, internal.ExperimentDoNotInsertNewDocumentation)
defer cancel()
stdlib.UseTestData = true
@ -375,7 +373,6 @@ func TestFetchAndUpdateStateCacheZip(t *testing.T) {
// proxy can be set up with a small cache for the last downloaded zip. This
// test confirms that that feature works.
ctx := context.Background()
ctx = experiment.NewContext(ctx, internal.ExperimentDoNotInsertNewDocumentation)
defer postgres.ResetTestDB(testDB, t)
proxyServer := proxy.NewServer([]*proxy.Module{
{
@ -419,7 +416,6 @@ func TestFetchAndUpdateStateCacheZip(t *testing.T) {
func TestFetchAndUpdateLatest(t *testing.T) {
ctx := context.Background()
ctx = experiment.NewContext(ctx, internal.ExperimentDoNotInsertNewDocumentation)
prox, teardown := proxy.SetupTestClient(t, testModules)
defer teardown()

Просмотреть файл

@ -18,7 +18,6 @@ import (
"golang.org/x/mod/semver"
"golang.org/x/pkgsite/internal"
"golang.org/x/pkgsite/internal/derrors"
"golang.org/x/pkgsite/internal/experiment"
"golang.org/x/pkgsite/internal/fetch"
"golang.org/x/pkgsite/internal/godoc"
"golang.org/x/pkgsite/internal/postgres"
@ -32,7 +31,6 @@ import (
// we delete it from the database.
func TestFetchAndUpdateState_NotFound(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
ctx = experiment.NewContext(ctx, internal.ExperimentDoNotInsertNewDocumentation)
defer cancel()
defer postgres.ResetTestDB(testDB, t)
@ -94,7 +92,6 @@ func TestFetchAndUpdateState_NotFound(t *testing.T) {
func TestFetchAndUpdateState_Excluded(t *testing.T) {
// Check that an excluded module is not processed, and is marked excluded in module_version_states.
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
ctx = experiment.NewContext(ctx, internal.ExperimentDoNotInsertNewDocumentation)
defer cancel()
defer postgres.ResetTestDB(testDB, t)
@ -111,7 +108,6 @@ func TestFetchAndUpdateState_Excluded(t *testing.T) {
func TestFetchAndUpdateState_BadRequestedVersion(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
ctx = experiment.NewContext(ctx, internal.ExperimentDoNotInsertNewDocumentation)
defer cancel()
defer postgres.ResetTestDB(testDB, t)
@ -127,7 +123,6 @@ func TestFetchAndUpdateState_BadRequestedVersion(t *testing.T) {
func TestFetchAndUpdateState_Incomplete(t *testing.T) {
// Check that we store the special "incomplete" status in module_version_states.
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
ctx = experiment.NewContext(ctx, internal.ExperimentDoNotInsertNewDocumentation)
defer cancel()
defer postgres.ResetTestDB(testDB, t)
@ -155,7 +150,6 @@ func TestFetchAndUpdateState_Incomplete(t *testing.T) {
func TestFetchAndUpdateState_Mismatch(t *testing.T) {
// Check that an excluded module is not processed, and is marked excluded in module_version_states.
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
ctx = experiment.NewContext(ctx, internal.ExperimentDoNotInsertNewDocumentation)
defer cancel()
defer postgres.ResetTestDB(testDB, t)
@ -181,7 +175,6 @@ func TestFetchAndUpdateState_DeleteOlder(t *testing.T) {
// Check that fetching an alternative module deletes all older versions of that
// module from search_documents (but not versions).
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
ctx = experiment.NewContext(ctx, internal.ExperimentDoNotInsertNewDocumentation)
defer cancel()
defer postgres.ResetTestDB(testDB, t)
@ -226,7 +219,6 @@ func TestFetchAndUpdateState_DeleteOlder(t *testing.T) {
func TestFetchAndUpdateState_SkipIncompletePackage(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
ctx = experiment.NewContext(ctx, internal.ExperimentDoNotInsertNewDocumentation)
defer cancel()
defer postgres.ResetTestDB(testDB, t)
badModule := map[string]string{
@ -263,7 +255,6 @@ func TestFetchAndUpdateState_Timeout(t *testing.T) {
defer teardownProxy()
ctx, cancel := context.WithTimeout(context.Background(), 0)
ctx = experiment.NewContext(ctx, internal.ExperimentDoNotInsertNewDocumentation)
defer cancel()
fetchAndCheckStatus(ctx, t, proxyClient, sample.ModulePath, sample.VersionString, http.StatusInternalServerError)
}
@ -272,7 +263,6 @@ func TestFetchAndUpdateState_Timeout(t *testing.T) {
// that we automatically try to fetch it again later.
func TestFetchAndUpdateState_ProxyTimedOut(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
ctx = experiment.NewContext(ctx, internal.ExperimentDoNotInsertNewDocumentation)
defer cancel()
defer postgres.ResetTestDB(testDB, t)
@ -298,7 +288,6 @@ func TestFetchAndUpdateState_ProxyTimedOut(t *testing.T) {
// would otherwise exceed HTML size limit and not get shown at all.
func TestTrimLargeCode(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), testTimeout*3)
ctx = experiment.NewContext(ctx, internal.ExperimentDoNotInsertNewDocumentation)
defer cancel()
defer postgres.ResetTestDB(testDB, t)
trimmedModule := map[string]string{

Просмотреть файл

@ -14,7 +14,6 @@ import (
"github.com/google/go-cmp/cmp/cmpopts"
"golang.org/x/pkgsite/internal"
"golang.org/x/pkgsite/internal/derrors"
"golang.org/x/pkgsite/internal/experiment"
"golang.org/x/pkgsite/internal/licenses"
"golang.org/x/pkgsite/internal/postgres"
"golang.org/x/pkgsite/internal/proxy"
@ -29,7 +28,6 @@ func TestReFetch(t *testing.T) {
// of the (fake) proxy, though in reality the most likely cause of changes to
// a version is updates to our data model or fetch logic.
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
ctx = experiment.NewContext(ctx, internal.ExperimentDoNotInsertNewDocumentation)
defer cancel()
defer postgres.ResetTestDB(testDB, t)

Просмотреть файл

@ -182,11 +182,10 @@ func TestWorker(t *testing.T) {
f := &Fetcher{proxyClient, source.NewClient(sourceTimeout), testDB, nil}
// Use 10 workers to have parallelism consistent with the worker binary.
q := queue.NewInMemory(ctx, 10, []string{internal.ExperimentDoNotInsertNewDocumentation},
func(ctx context.Context, mpath, version string) (int, error) {
code, _, err := f.FetchAndUpdateState(ctx, mpath, version, "")
return code, err
})
q := queue.NewInMemory(ctx, 10, nil, func(ctx context.Context, mpath, version string) (int, error) {
code, _, err := f.FetchAndUpdateState(ctx, mpath, version, "")
return code, err
})
s, err := NewServer(&config.Config{}, ServerConfig{
DB: testDB,