Skip to content

Commit

Permalink
tests: add test case for simple partitioned tables (pingcap#206)
Browse files Browse the repository at this point in the history
  • Loading branch information
kennytm authored Jul 19, 2019
1 parent 5218dd6 commit cf08f2f
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/partitioned-table/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[lightning]
check-requirements = false
file = "/tmp/lightning_test_result/lightning.log"
level = "warning"

[tikv-importer]
addr = "127.0.0.1:8808"

[mydumper]
data-source-dir = "tests/partitioned-table/data"

[tidb]
host = "127.0.0.1"
user = "root"
status-port = 10080
log-level = "error"

[post-restore]
checksum = true
analyze = true
1 change: 1 addition & 0 deletions tests/partitioned-table/data/partitioned-schema-create.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
create database partitioned;
1 change: 1 addition & 0 deletions tests/partitioned-table/data/partitioned.a-schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
create table a (a int) partition by hash(a) partitions 5;
2 changes: 2 additions & 0 deletions tests/partitioned-table/data/partitioned.a.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
insert into a values (268435456), (1), (262144), (32), (4), (65536), (8388608);

29 changes: 29 additions & 0 deletions tests/partitioned-table/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh
#
# Copyright 2019 PingCAP, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# See the License for the specific language governing permissions and
# limitations under the License.

# Basic check for whether partitioned tables work.

set -eu

run_sql 'DROP DATABASE IF EXISTS partitioned;'

run_lightning

run_sql 'SELECT count(1), sum(a) FROM partitioned.a;'
check_contains 'count(1): 7'
check_contains 'sum(a): 277151781'

run_sql "SHOW TABLE STATUS FROM partitioned WHERE name = 'a';"
check_contains 'Create_options: partitioned'

0 comments on commit cf08f2f

Please sign in to comment.