Files
tidb/dumpling/export/config_test.go

35 lines
951 B
Go

// Copyright 2020 PingCAP, Inc. Licensed under Apache-2.0.
package export
import (
"testing"
"github.com/pingcap/tidb/br/pkg/version"
tcontext "github.com/pingcap/tidb/dumpling/context"
"github.com/stretchr/testify/require"
)
func TestCreateExternalStorage(t *testing.T) {
mockConfig := defaultConfigForTest(t)
loc, err := mockConfig.createExternalStorage(tcontext.Background())
require.NoError(t, err)
require.Regexp(t, "^file:", loc.URI())
}
func TestMatchMysqlBugVersion(t *testing.T) {
cases := []struct {
serverInfo version.ServerInfo
expected bool
}{
{version.ParseServerInfo("5.7.25-TiDB-3.0.6"), false},
{version.ParseServerInfo("8.0.2"), false},
{version.ParseServerInfo("8.0.3"), true},
{version.ParseServerInfo("8.0.22"), true},
{version.ParseServerInfo("8.0.23"), false},
}
for _, x := range cases {
require.Equalf(t, x.expected, matchMysqlBugversion(x.serverInfo), "server info: %s", x.serverInfo)
}
}