Skip to content

Commit 4108a75

Browse files
committed
add realtikv test
1 parent 4ed280e commit 4108a75

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
load("@io_bazel_rules_go//go:def.bzl", "go_test")
2+
3+
go_test(
4+
name = "pushdowntest_test",
5+
timeout = "short",
6+
srcs = [
7+
"expr_test.go",
8+
"main_test.go",
9+
],
10+
flaky = True,
11+
deps = [
12+
"//pkg/testkit",
13+
"//tests/realtikvtest",
14+
"@com_github_stretchr_testify//require",
15+
],
16+
)
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright 2024 PingCAP, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package pushdowntest
16+
17+
import (
18+
"testing"
19+
20+
"github.com/pingcap/tidb/pkg/testkit"
21+
"github.com/pingcap/tidb/tests/realtikvtest"
22+
"github.com/stretchr/testify/require"
23+
)
24+
25+
// TestBitCastInTiKV see issue: https://github.com/pingcap/tidb/issues/56494
26+
func TestBitCastInTiKV(t *testing.T) {
27+
store := realtikvtest.CreateMockStoreAndSetup(t)
28+
tk := testkit.NewTestKit(t, store)
29+
tk.MustExec("use test")
30+
tk.MustExec("drop table if exists t1")
31+
defer tk.MustExec("drop table if exists t1")
32+
tk.MustExec("create table t1(a bit(24))")
33+
tk.MustExec("insert into t1 values(0xffffff)")
34+
err := tk.QueryToErr("select a from t1 where false not like convert(a, char)")
35+
require.EqualError(t, err, "[tikv:3854]Cannot convert string '\\xFF\\xFF\\xFF' from binary to utf8mb4")
36+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2024 PingCAP, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package pushdowntest
16+
17+
import (
18+
"github.com/pingcap/tidb/tests/realtikvtest"
19+
"testing"
20+
)
21+
22+
func TestMain(m *testing.M) {
23+
realtikvtest.RunTestMain(m)
24+
}

0 commit comments

Comments
 (0)