aboutsummaryrefslogtreecommitdiff
path: root/db/pdatadb/db_test.go
blob: aa89983d7b461ed66a78dbfdb6c43b7d1f9767e8 (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
package pdatadb

import (
	"context"
	"path/filepath"
	"testing"

	_ "github.com/mattn/go-sqlite3"
	"github.com/r2northstar/atlas/pkg/api/api0/api0testutil"
)

func TestPdataStorage(t *testing.T) {
	db, err := Open(filepath.Join(t.TempDir(), "pdata.db"))
	if err != nil {
		panic(err)
	}
	defer db.Close()

	cur, tgt, err := db.Version()
	if err != nil {
		panic(err)
	}
	if cur != 0 {
		panic("current version not 0")
	}
	if err := db.MigrateUp(context.Background(), tgt); err != nil {
		panic(err)
	}

	api0testutil.TestPdataStorage(t, db)
}