about summary refs log tree commit diff stats
path: root/internal/importer/main_test.go
blob: 0bc438d355eb16dbc22984b66fa15972bc913541 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package importer

import (
	"testing"

	"go.alanpearce.eu/searchix/internal/config"
	"go.alanpearce.eu/searchix/internal/index"
	"go.alanpearce.eu/x/log"
)

var cfg = config.DefaultConfig

func BenchmarkImporterLowMemory(b *testing.B) {
	tmp := b.TempDir()
	logger := log.Configure(false)
	_, write, _, err := index.OpenOrCreate(tmp, false, &index.Options{
		LowMemory: true,
		Logger:    logger.Named("index"),
	})
	if err != nil {
		b.Fatal(err)
	}

	err = Start(&cfg, logger.Named("importer"), write, false, &[]string{"nixpkgs"})
	if err != nil {
		b.Fatal(err)
	}
}