(t *testing.T)
| 157 | } |
| 158 | |
| 159 | func TestSelect(t *testing.T) { |
| 160 | if skipIntegrateTest { |
| 161 | t.Skip("Integration tests skipped") |
| 162 | } |
| 163 | |
| 164 | ctx, cancel := context.WithTimeout(context.Background(), 180*time.Second) |
| 165 | defer cancel() |
| 166 | |
| 167 | session, tableId, tearDown := setup(t, ctx, []string{ |
| 168 | "INSERT INTO [[TABLE]] (id, active) VALUES (1, true), (2, false)", |
| 169 | }) |
| 170 | defer tearDown() |
| 171 | |
| 172 | stmt, err := BuildStatement(fmt.Sprintf("SELECT id, active FROM %s ORDER BY id ASC", tableId)) |
| 173 | if err != nil { |
| 174 | t.Fatalf("invalid statement: error=%s", err) |
| 175 | } |
| 176 | |
| 177 | result, err := stmt.Execute(ctx, session) |
| 178 | if err != nil { |
| 179 | t.Fatalf("unexpected error happened: %s", err) |
| 180 | } |
| 181 | |
| 182 | compareResult(t, result, &Result{ |
| 183 | ColumnNames: []string{"id", "active"}, |
| 184 | Rows: []Row{ |
| 185 | Row{[]string{"1", "true"}}, |
| 186 | Row{[]string{"2", "false"}}, |
| 187 | }, |
| 188 | AffectedRows: 2, |
| 189 | ColumnTypes: []*pb.StructType_Field{ |
| 190 | {Name: "id", Type: &pb.Type{Code: pb.TypeCode_INT64}}, |
| 191 | {Name: "active", Type: &pb.Type{Code: pb.TypeCode_BOOL}}, |
| 192 | }, |
| 193 | IsMutation: false, |
| 194 | }) |
| 195 | } |
| 196 | |
| 197 | func TestDml(t *testing.T) { |
| 198 | if skipIntegrateTest { |
nothing calls this directly
no test coverage detected