create_tb.sim 5.4 KB
Newer Older
S
slguan 已提交
1 2
system sh/stop_dnodes.sh

S
slguan 已提交
3 4

system sh/deploy.sh -n dnode1 -i 1
5
system sh/cfg.sh -n dnode1 -c walLevel -v 1
S
slguan 已提交
6 7
system sh/exec.sh -n dnode1 -s start

H
Haojun Liao 已提交
8
sleep 100
S
slguan 已提交
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
sql connect
print ======================== dnode1 start

$dbPrefix = fi_in_db
$tbPrefix = fi_in_tb
$mtPrefix = fi_in_mt
$tbNum = 10
$rowNum = 20
$totalNum = 200

print create_tb test
print =============== set up
$i = 0
$db = $dbPrefix . $i
$mt = $mtPrefix . $i
$tb = $tbPrefix . $i

sql create database $db
sql use $db

# case1: case_insensitivity test
print =========== create_tb.sim case1: case_insensitivity test
sql CREATE TABLE $tb (TS TIMESTAMP, COL1 INT, COL2 BIGINT, COL3 FLOAT, COL4 DOUBLE, COL5 BINARY(10), COL6 BOOL, COL7 SMALLINT, COL8 TINYINT, COL9 NCHAR(10));
sql show tables

if $rows != 1 then
  return -1
endi
print data00 = $data00
if $data00 != $tb then 
  return -1
endi
sql DROP TABLE $tb
sql show tables

if $rows != 0 then
  return -1
endi
print case_insensitivity test passed

# case2: illegal_table_name test
print =========== create_tb.sim case2: illegal_table_name test
$illegal_tb1 = 1db
$illegal_tb2 = d@b

sql_error create table $illegal_db1 (ts timestamp, tcol int) 
sql_error create table $illegal_db2 (ts timestamp, tcol int)
print illegal_table_name test passed

# case3: illegal_data_types
print ========== create_tb.sim case3: illegal_data_types test
$i_ts = time # illegal ts
$i_binary = binary # illegal binary
$i_bigint = long # illegal bigint
$i_smallint = short # illegal smallint
$i_tinyint = byte # illegal tinyint
$i_binary2 = varchar(20) # illegal string
$nchar = nchar # unspecified nchar length

sql_error create table $tb (ts $i_ts , col int)
sql_error create table $tb (ts timestamp, col $i_binary )
sql_error create table $tb (ts timestamp, col $i_bigint )
sql_error create table $tb (ts timestamp, col $i_smallint )
sql_error create table $tb (ts timestamp, col $i_tinyint )
sql_error create table $tb (ts timestamp, col $i_binary2 )
sql_error create table $tb (ts timestamp, col $nchar )
sql create table $tb (ts timestamp, col nchar(20))
sql show tables
if $rows != 1 then
  return -1
endi
if $data00 != $tb then
  return -1
endi
sql drop table $tb
print illegal data type test passed

# case4: illegal_column_names
# Only frequently used key words are tested here
print ========== create_tb.sim case4: illegal_column_names
$tb_ = table
$tbs = tables
$db_ = database
$dbs = databases
$mt_ = metric
$mts = metrics
$int = int
$bint = bigint
$binary = binary
$str = string
$tag = tag
$tags = tags
$sint = smallint
$tint = tinyint
$nchar = nchar

sql_error create table $tb (ts timestamp, $tb_ int)
sql_error create table $tb (ts timestamp, $tbs int) 
sql_error create table $tb (ts timestamp, $db_ int) 
sql_error create table $tb (ts timestamp, $dbs int) 
sql_error create table $tb (ts timestamp, $mt_ int) 
sql_error create table $tb (ts timestamp, $mts int) 
sql_error create table $tb (ts timestamp, $int int)
sql_error create table $tb (ts timestamp, $bint int) 
sql_error create table $tb (ts timestamp, $binary int) 
sql_error create table $tb (ts timestamp, $str int) 
sql_error create table $tb (ts timestamp, $tag int) 
sql_error create table $tb (ts timestamp, $tags int)
sql_error create table $tb (ts timestamp, $sint int) 
sql_error create table $tb (ts timestamp, $tint int) 
sql_error create table $tb (ts timestamp, $nchar int) 
print illegal_column_names test passed

# case5: chinese_char_in_table_support
print ========== create_tb.sim case5: chinese_char_in_table_support test

$CN_char = 涛思
$tb1 = tb1
sql_error create table $CN_char (ts timestamp, col1 int) 
#sql show tables 
#if $rows != 1 then 
#  return -1
#endi
#print expected: $CN_char
#print returned: $data00
#if $data00 != $CN_char then 
#  return -1
#endi
#sql drop table $CN_char

sql_error create table $tb1 (ts timestamp, $CN_char int) 
#print expected: $tb1
#print returned: $data10
#sql show tables
#if $rows != 1 then 
#  return -1
#endi
#if $data00 != $tb1 then
#  return -1
#endi
#sql describe $tb1
##print expected $CN_char
##print returned $data10
#if $data10 != $CN_char then
#  return -1
#endi
#sql drop table $tb1
print chinese_char_in_table_support test passed

# case6: table_already_exists
print ========== create_tb.sim case6: table_already_exists
sql create table tbs (ts timestamp, col int)
sql insert into tbs values (now, 1)
sql create table tbs (ts timestamp, col bool)
#sql_error create table tb (ts timestamp, col bool)
print table_already_exists test passed

# case7: table_name_length_exceeds_limit
print ========== create_tb.sim case7: table_name_length_exceeds_limit
$tbname32 = _32_aaaabbbbccccddddaaaabbbbcccc
$tbname64 = _64_aaaabbbbccccddddaaaabbbbccccddddaaaabbbbccccddddaaaabbbbcccc
$tbname63 = _63_aaaabbbbccccddddaaaabbbbccccddddaaaabbbbccccddddaaaabbbbccc
171
$tbname65 = _65_aaaabbbbccccddddaaaabbbbccccddddaaaabbbbccccddddaaaabbbbcccca1111111111111111111111111111111111aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
S
slguan 已提交
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
sql create table $tbname32 (ts timestamp, col int)
sql insert into $tbname32 values (now, 1)
sql create table $tbname64 (ts timestamp, col int)
sql insert into $tbname64 values (now, 1)
sql create table $tbname63 (ts timestamp, col int)
sql insert into $tbname63 values (now, 1)
sql_error create table $tbname65 (ts timestamp, col int)
#sql_error create table tb (ts timestamp, col bool)
print table_already_exists test passed

sql drop database $db
sql show databases
if $rows != 0 then 
  return -1
endi
S
scripts  
Shengliang Guan 已提交
187 188

system sh/exec.sh -n dnode1 -s stop -x SIGINT