mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-06 19:07:50 +00:00
For on-prem serverless, if we restart the process containing the controller and computer(s), when they come back up, the controller doesn't know that the computers have been restarted, so it doesn't send them a directive. This change forces the controller to send a directive upon startup by a computer.
32 lines
854 B
Go
32 lines
854 B
Go
package dax_test
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/featurebasedb/featurebase/v3/dax/controller/sqldb"
|
|
"github.com/featurebasedb/featurebase/v3/logger"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestDirectiveVersion(t *testing.T) {
|
|
trans, err := sqldb.NewTransactor(sqldb.GetTestConfigRandomDB("directive_version"), logger.StderrLogger) // TODO running migrations takes kind of a long time, consolidate w/ other SQL tests
|
|
require.NoError(t, err, "connecting")
|
|
require.NoError(t, trans.Start())
|
|
|
|
tx, err := trans.BeginTx(context.Background(), true)
|
|
require.NoError(t, err, "getting transaction")
|
|
|
|
defer func() {
|
|
err := tx.Rollback()
|
|
if err != nil {
|
|
t.Logf("rolling back: %v", err)
|
|
}
|
|
}()
|
|
|
|
dvSvc := sqldb.NewDirectiveVersion(nil)
|
|
|
|
n, err := dvSvc.Increment(tx, 1)
|
|
require.NoError(t, err)
|
|
require.Equal(t, uint64(2), n)
|
|
}
|