-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_index_test.go
75 lines (72 loc) · 2.6 KB
/
create_index_test.go
1
2
3
4
5
6
7
8
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
package pgsp
import (
"testing"
_ "github.com/lib/pq"
)
func TestCreateIndex_Table(t *testing.T) {
type fields struct {
PID int
DATID int
DATNAME string
RELID int
IndexRelid int
Command string
PHASE string
LockersTotal int64
LockersDone int64
LockersPid int64
BlocksTotal int64
BlocksDone int64
TuplesTotal int64
TuplesDone int64
PartitionsTotal int64
PartitionsDone int64
}
tests := []struct {
name string
fields fields
want string
}{
{
name: "test0",
fields: fields{},
want: `+-----+-------+---------+-------+-------------+---------+-------+---------------+--------------+
| PID | DATID | DATNAME | RELID | INDEX RELID | COMMAND | PHASE | LOCKERS TOTAL | LOCKERS DONE |
+-----+-------+---------+-------+-------------+---------+-------+---------------+--------------+
| 0 | 0 | | 0 | 0 | | | 0 | 0 |
+-----+-------+---------+-------+-------------+---------+-------+---------------+--------------+
+--------------------+--------------+-------------+--------------+-------------+------------------+-----------------+
| CURRENT LOCKER PID | BLOCKS TOTAL | BLOCKS DONE | TUPLES TOTAL | TUPLES DONE | PARTITIONS TOTAL | PARTITIONS DONE |
+--------------------+--------------+-------------+--------------+-------------+------------------+-----------------+
| 0 | 0 | 0 | 0 | 0 | 0 | 0 |
+--------------------+--------------+-------------+--------------+-------------+------------------+-----------------+
`,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
v := CreateIndex{
PID: tt.fields.PID,
DATID: tt.fields.DATID,
DATNAME: tt.fields.DATNAME,
RELID: tt.fields.RELID,
IndexRelid: tt.fields.IndexRelid,
Command: tt.fields.Command,
PHASE: tt.fields.PHASE,
LockersTotal: tt.fields.LockersTotal,
LockersDone: tt.fields.LockersDone,
LockersPid: tt.fields.LockersPid,
BlocksTotal: tt.fields.BlocksTotal,
BlocksDone: tt.fields.BlocksDone,
TuplesTotal: tt.fields.TuplesTotal,
TuplesDone: tt.fields.TuplesDone,
PartitionsTotal: tt.fields.PartitionsTotal,
PartitionsDone: tt.fields.PartitionsDone,
}
CreateIndexColumns = getColumns(CreateIndex{})
if got := v.Table(); got != tt.want {
t.Errorf("CreateIndex.Table() = \n%v\n, want \n%v\n", got, tt.want)
}
})
}
}