aboutsummaryrefslogtreecommitdiff
path: root/db/atlasdb/db_test.go
blob: 0c592284e54125bea13074d0dedb104b02130f61 (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 atlasdb

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

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

func TestAccountStorage(t *testing.T) {
	db, err := Open(filepath.Join(t.TempDir(), "atlas.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.TestAccountStorage(t, db)
}