Skip to content

Commit dc9cd8a

Browse files
committed
it: blobs per master commit
Signed-off-by: Miguel Molina <[email protected]>
1 parent cff5db3 commit dc9cd8a

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

integration_test.go

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,28 @@ func TestIntegration(t *testing.T) {
2929

3030
testCases := []struct {
3131
query string
32-
result [][]interface{}
32+
result []sql.Row
3333
}{
34-
// TODO: add tests
35-
// {"SELECT 1 FROM repositories", [][]interface{}{{int64(1)}}},
34+
{
35+
`SELECT COUNT(c.hash), c.hash
36+
FROM refs r
37+
INNER JOIN commits c
38+
ON history_idx(r.hash, c.hash) >= 0
39+
INNER JOIN blobs b
40+
ON commit_contains(c.hash, b.hash)
41+
WHERE r.name = 'refs/heads/master'
42+
GROUP BY c.hash`,
43+
[]sql.Row{
44+
{int32(4), "1669dce138d9b841a518c64b10914d88f5e488ea"},
45+
{int32(3), "35e85108805c84807bc66a02d91535e1e24b38b9"},
46+
{int32(9), "6ecf0ef2c2dffb796033e5a02219af86ec6584e5"},
47+
{int32(8), "918c48b83bd081e863dbe1b80f8998f058cd8294"},
48+
{int32(3), "a5b8b09e2f8fcb0bb99d3ccb0958157b40890d69"},
49+
{int32(6), "af2d6a6954d532f8ffb47615169c8fdf9d383a1a"},
50+
{int32(2), "b029517f6300c2da0f4b651b8642506cd6aaf45d"},
51+
{int32(3), "b8e471f58bcbca63b07bda20e428190409c2db47"},
52+
},
53+
},
3654
}
3755

3856
for _, tt := range testCases {
@@ -43,7 +61,7 @@ func TestIntegration(t *testing.T) {
4361
require.NoError(err)
4462
rows, err := sql.RowIterToRows(iter)
4563
require.NoError(err)
46-
require.Equal(tt.result, rows)
64+
require.ElementsMatch(tt.result, rows)
4765
})
4866
}
4967
}

0 commit comments

Comments
 (0)