2017-03-08 17:17:07 +00:00
|
|
|
package datastore
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2017-06-22 19:50:45 +00:00
|
|
|
"github.com/kolide/fleet/server/kolide"
|
2017-03-09 18:40:52 +00:00
|
|
|
"github.com/stretchr/testify/assert"
|
2017-03-08 17:17:07 +00:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func testMigrationStatus(t *testing.T, ds kolide.Datastore) {
|
|
|
|
if ds.Name() == "inmem" {
|
|
|
|
t.Skip("inmem is being deprecated, test skipped")
|
|
|
|
}
|
|
|
|
|
|
|
|
require.Nil(t, ds.Drop())
|
2017-03-09 18:40:52 +00:00
|
|
|
|
|
|
|
status, err := ds.MigrationStatus()
|
|
|
|
require.Nil(t, err)
|
|
|
|
assert.EqualValues(t, kolide.NoMigrationsCompleted, status)
|
2017-03-08 17:17:07 +00:00
|
|
|
|
|
|
|
require.Nil(t, ds.MigrateTables())
|
|
|
|
|
2017-03-09 18:40:52 +00:00
|
|
|
status, err = ds.MigrationStatus()
|
|
|
|
require.Nil(t, err)
|
|
|
|
assert.EqualValues(t, kolide.SomeMigrationsCompleted, status)
|
|
|
|
|
2017-03-08 17:17:07 +00:00
|
|
|
require.Nil(t, ds.MigrateData())
|
2017-03-09 18:40:52 +00:00
|
|
|
|
|
|
|
status, err = ds.MigrationStatus()
|
|
|
|
require.Nil(t, err)
|
|
|
|
assert.EqualValues(t, kolide.AllMigrationsCompleted, status)
|
2017-03-08 17:17:07 +00:00
|
|
|
}
|