35 lines
602 B
Go
35 lines
602 B
Go
package storage
|
|
|
|
import (
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
func TestSQLiteStoreBootstrapsSchema(t *testing.T) {
|
|
dbPath := filepath.Join(t.TempDir(), "app.db")
|
|
store, err := OpenSQLite(dbPath)
|
|
if err != nil {
|
|
t.Fatalf("OpenSQLite: %v", err)
|
|
}
|
|
defer store.Close()
|
|
|
|
for _, table := range []string{
|
|
"templates",
|
|
"profiles",
|
|
"overlays",
|
|
"devices",
|
|
"device_config_state",
|
|
"tasks",
|
|
"task_devices",
|
|
"audit_logs",
|
|
} {
|
|
ok, err := store.HasTable(table)
|
|
if err != nil {
|
|
t.Fatalf("HasTable(%s): %v", table, err)
|
|
}
|
|
if !ok {
|
|
t.Fatalf("expected table %s to exist", table)
|
|
}
|
|
}
|
|
}
|