77 "testing"
88
99 "github.com/src-d/gitbase"
10- "github.com/stretchr/testify/require"
1110 "github.com/src-d/go-mysql-server/sql"
1211 "github.com/src-d/go-mysql-server/sql/index/pilosa"
12+ "github.com/stretchr/testify/require"
1313 yaml "gopkg.in/yaml.v2"
1414)
1515
@@ -20,13 +20,12 @@ type Query struct {
2020}
2121
2222func TestRegressionQueries (t * testing.T ) {
23- require := require .New (t )
24-
25- engine , pool , cleanup := setup (t )
23+ _ , pool , cleanup := setup (t )
2624 defer cleanup ()
2725
26+ engine := newSquashEngine (pool )
2827 tmpDir , err := ioutil .TempDir (os .TempDir (), "pilosa-idx-gitbase" )
29- require .NoError (err )
28+ require .NoError (t , err )
3029 defer os .RemoveAll (tmpDir )
3130 engine .Catalog .RegisterIndexDriver (pilosa .NewDriver (tmpDir ))
3231
@@ -36,20 +35,23 @@ func TestRegressionQueries(t *testing.T) {
3635 )
3736
3837 queries , err := loadQueriesYaml ("./_testdata/regression.yml" )
39- require .NoError (err )
38+ require .NoError (t , err )
4039
4140 for _ , q := range queries {
42- for _ , stmt := range q .Statements {
43- _ , iter , err := engine .Query (ctx , stmt )
44- if err != nil {
45- require .Failf (err .Error (), "ID: %s, Name: %s, Statement: %s" , q .ID , q .Name , stmt )
46- }
41+ t .Run (q .ID , func (t * testing.T ) {
42+ require := require .New (t )
43+ for _ , stmt := range q .Statements {
44+ _ , iter , err := engine .Query (ctx , stmt )
45+ if err != nil {
46+ require .Failf (err .Error (), "ID: %s, Name: %s, Statement: %s" , q .ID , q .Name , stmt )
47+ }
4748
48- _ , err = sql .RowIterToRows (iter )
49- if err != nil {
50- require .Failf (err .Error (), "ID: %s, Name: %s, Statement: %s" , q .ID , q .Name , stmt )
49+ _ , err = sql .RowIterToRows (iter )
50+ if err != nil {
51+ require .Failf (err .Error (), "ID: %s, Name: %s, Statement: %s" , q .ID , q .Name , stmt )
52+ }
5153 }
52- }
54+ })
5355 }
5456}
5557
0 commit comments