basic1.sim 3.0 KB
Newer Older
S
slguan 已提交
1
system sh/stop_dnodes.sh
S
slguan 已提交
2 3
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
S
Shengliang Guan 已提交
4 5
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode2 -s start
S
slguan 已提交
6 7 8 9 10 11 12 13 14 15 16 17
sql connect

print =============== show dnodes
sql show dnodes;
if $rows != 1 then 
  return -1
endi

if $data00 != 1 then 
  return -1
endi

S
Shengliang Guan 已提交
18
if $data02 != 0 then 
S
slguan 已提交
19 20 21 22 23 24 25 26 27 28 29 30
  return -1
endi

sql show mnodes;
if $rows != 1 then 
  return -1
endi

if $data00 != 1 then 
  return -1
endi

S
Shengliang Guan 已提交
31
if $data02 != master then 
S
slguan 已提交
32 33
  return -1
endi
S
slguan 已提交
34 35

print =============== create dnodes
S
Shengliang Guan 已提交
36 37 38
sql create dnode $hostname port 7200
sleep 2000

S
slguan 已提交
39 40 41 42 43 44 45 46 47 48 49 50 51
sql show dnodes;
if $rows != 2 then 
  return -1
endi

if $data00 != 1 then 
  return -1
endi

if $data10 != 2 then 
  return -1
endi

S
Shengliang Guan 已提交
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
if $data02 != 0 then 
  return -1
endi

if $data12 != 0 then 
  return -1
endi

if $data04 != ready then 
  return -1
endi

if $data14 != ready then 
  return -1
endi

S
slguan 已提交
68 69 70 71 72 73 74 75 76
sql show mnodes;
if $rows != 1 then 
  return -1
endi

if $data00 != 1 then 
  return -1
endi

S
Shengliang Guan 已提交
77
if $data02 != master then 
S
slguan 已提交
78 79 80
  return -1
endi

S
Shengliang Guan 已提交
81 82
print =============== create database
sql create database d1 vgroups 4;
S
slguan 已提交
83 84
sql create database d2;

S
Shengliang Guan 已提交
85 86
sql show databases
if $rows != 2 then 
S
slguan 已提交
87 88 89
  return -1
endi

S
Shengliang Guan 已提交
90 91 92
sql use d1
sql show vgroups;

S
Shengliang Guan 已提交
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
if $rows != 4 then 
  return -1
endi

print =============== create table
sql use d1

sql create table st (ts timestamp, i int) tags (j int)
sql show stables
if $rows != 1 then 
  return -1
endi

print $data00 $data01 $data02

sql create table c1 using st tags(1)
sql create table c2 using st tags(2) 
sql create table c3 using st tags(2) 
sql create table c4 using st tags(2) 
sql create table c5 using st tags(2) 

sql show tables
print $data00 $data01 $data02

S
Shengliang Guan 已提交
117 118 119
if $rows != 5 then 
  return -1
endi
S
Shengliang Guan 已提交
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 171 172 173 174 175 176 177 178 179

print =============== insert data
sql insert into c1 values(now+1s, 1)
sql insert into c1 values(now+2s, 2)
sql insert into c1 values(now+3s, 3)
sql insert into c2 values(now+1s, 1)
sql insert into c2 values(now+2s, 2)
sql insert into c2 values(now+3s, 3)
sql insert into c3 values(now+1s, 1)
sql insert into c3 values(now+2s, 2)
sql insert into c3 values(now+3s, 3)
sql insert into c4 values(now+1s, 1)
sql insert into c4 values(now+2s, 2)
sql insert into c4 values(now+3s, 3)
sql insert into c5 values(now+1s, 1)
sql insert into c5 values(now+2s, 2)
sql insert into c5 values(now+3s, 3)

print =============== query data
sql select * from c1
if $rows != 3 then 
  return -1
endi

print $data00 $data01
print $data10 $data11
print $data20 $data11

if $data01 != 1 then 
  return -1
endi

if $data11 != 2 then 
  return -1
endi

if $data21 != 3 then 
  return -1
endi

sql select * from c2
if $rows != 3 then 
  return -1
endi

sql select * from c3
if $rows != 3 then 
  return -1
endi

sql select * from c4
if $rows != 3 then 
  return -1
endi

sql select * from c5
if $rows != 3 then 
  return -1
endi

S
Shengliang Guan 已提交
180
sql select * from st
S
Shengliang Guan 已提交
181 182 183
if $rows != 15 then 
  return -1
endi
S
Shengliang Guan 已提交
184

S
Shengliang Guan 已提交
185 186 187 188 189 190 191 192 193 194 195
print =============== drop dnode
sql drop dnode 2;
sql show dnodes;
if $rows != 1 then 
  return -1
endi

if $data00 != 1 then 
  return -1
endi

S
Shengliang Guan 已提交
196 197
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode2 -s stop -x SIGINT