Skip to content
This repository has been archived by the owner on Dec 8, 2021. It is now read-only.

Commit

Permalink
add a integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
glorv committed Oct 31, 2020
1 parent 73a6bd1 commit e9143ac
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/column_permutation/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[mydumper]
strict-format = true
max-region-size = 200
1 change: 1 addition & 0 deletions tests/column_permutation/data/test-schema-create.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE DATABASE `test` IF NOT EXISTS;
22 changes: 22 additions & 0 deletions tests/column_permutation/data/test.test_perm-schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
CREATE TABLE `test` (
`id` int(11) NOT NULL,
`contract_no` varchar(64) DEFAULT NULL,
`fund_seq_no` varchar(64) DEFAULT NULL,
`term_no` int(11) DEFAULT NULL,
`contract_type` varchar(8) DEFAULT NULL,
`internal_transfer_tag` varchar(8) DEFAULT NULL,
`prin_amt` int(11) DEFAULT NULL,
`start_date` varchar(8) DEFAULT NULL,
`end_date` varchar(8) DEFAULT NULL,
`batch_date` varchar(8) DEFAULT NULL,
`crt_time` timestamp DEFAULT CURRENT_TIMESTAMP,
`region_code` varchar(8) DEFAULT NULL,
`credit_code` varchar(64) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
PARTITION BY RANGE COLUMNS(batch_date) (
PARTITION `P20200224` VALUES LESS THAN ("2020-02-05 00:00:00"),
PARTITION `P20200324` VALUES LESS THAN ("2020-03-05 00:00:00"),
PARTITION `P20200424` VALUES LESS THAN ("2020-04-05 00:00:00"),
PARTITION `P20200524` VALUES LESS THAN ("2020-05-05 00:00:00"),
PARTITION `P_MAXVALUE` VALUES LESS THAN ("MAXVALUE")
);
6 changes: 6 additions & 0 deletions tests/column_permutation/data/test.test_perm.0.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
contract_no,fund_seq_no,term_no,contract_type,internal_transfer_tag,prin_amt,start_date,end_date,region_code,credit_code
2020061000019011020164030595,202006100001901102016403059520200629,1,01,N,356,20200210,20200720,000000,
2020061000019011020164030596,202006100001901102016403059520200628,1,01,N,3561,20200310,20200720,000001,
2020061000019011020164030597,202006100001901102016403059520200627,1,01,N,3562,20200410,20200720,000002,33
2020061000019011020164030598,108319xx0185-202006100001901102016403059520200626,12,02,Y,26368,20200510,20200620,000003,
2020061000019011020164030599,202006100001901102016403059520200625,1,01,N,3960,20200610,20200720,000005,999
18 changes: 18 additions & 0 deletions tests/column_permutation/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
set -eu

for BACKEND in local importer tidb; do
if [ "$BACKEND" = 'local' ]; then
check_cluster_version 4 0 0 'local backend' || continue
fi
run_sql 'DROP DATABASE IF EXISTS test'

run_lightning --backend $BACKEND

run_sql 'select count(*) from test.test_perm;'
check_contains "count(*): 5"

run_sql "SELECT fund_seq_no, region_code, credit_code FROM test.test_perm WHERE contract_no = '2020061000019011020164030597';"
check_contains "fund_seq_no: 202006100001901102016403059520200627"
check_contains "region_code: 000002"
check_contains "credit_code: 33"
done

0 comments on commit e9143ac

Please sign in to comment.