about summary refs log tree commit diff stats
path: root/internal/importer/main_test.go
blob: 9e19b8c433c9dd85d87f39b66c145ba3571c0b95 (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
29
30
31
32
33
34
35
36
package importer

import (
	"context"
	"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(
		context.Background(),
		&cfg,
		logger.Named("importer"),
		write,
		false,
		&[]string{"nixpkgs"},
	)
	if err != nil {
		b.Fatal(err)
	}
}