mirror of
https://github.com/empayre/fleet.git
synced 2024-11-08 01:38:57 +00:00
a6cff7ea89
* Migrate all mysql tests to the new form * Only dump sql if MYSQL_TEST is on * Removing parallel until we get rid of this code * Move TestMain to an actual _test file * A little experiment with tmpfs to speed up the db * Let's make sure the dump.sql file is also in ram
37 lines
786 B
Go
37 lines
786 B
Go
package mysql
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/fleetdm/fleet/v4/server/fleet"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestMigrationStatus(t *testing.T) {
|
|
ds := CreateMySQLDS(t)
|
|
defer ds.Close()
|
|
|
|
if ds.Name() == "inmem" {
|
|
t.Skip("inmem is being deprecated, test skipped")
|
|
}
|
|
|
|
require.Nil(t, ds.Drop())
|
|
|
|
status, err := ds.MigrationStatus()
|
|
require.Nil(t, err)
|
|
assert.EqualValues(t, fleet.NoMigrationsCompleted, status)
|
|
|
|
require.Nil(t, ds.MigrateTables())
|
|
|
|
status, err = ds.MigrationStatus()
|
|
require.Nil(t, err)
|
|
assert.EqualValues(t, fleet.SomeMigrationsCompleted, status)
|
|
|
|
require.Nil(t, ds.MigrateData())
|
|
|
|
status, err = ds.MigrationStatus()
|
|
require.Nil(t, err)
|
|
assert.EqualValues(t, fleet.AllMigrationsCompleted, status)
|
|
}
|