Files
mayfly-go/server/internal/db/infrastructure/service/db_instance_test.go
2023-12-29 08:30:10 +08:00

26 lines
535 B
Go

package service
import (
"github.com/stretchr/testify/require"
"mayfly-go/internal/db/domain/entity"
"strings"
"testing"
)
func Test_readBinlogInfoFromBackup(t *testing.T) {
text := `
--
-- Position to start replication or point-in-time recovery from
--
-- CHANGE MASTER TO MASTER_LOG_FILE='binlog.000003', MASTER_LOG_POS=379;
`
got, err := readBinlogInfoFromBackup(strings.NewReader(text))
require.NoError(t, err)
require.Equal(t, &entity.BinlogInfo{
FileName: "binlog.000003",
Sequence: 3,
Position: 379,
}, got)
}