Skip to content

Commit

Permalink
Merge pull request #324 from mergestat/fix-tests
Browse files Browse the repository at this point in the history
fix: failing test cases that uses `github.com/mergestat/mergestat`
  • Loading branch information
patrickdevivo authored Oct 18, 2022
2 parents ff51560 + 5e908d1 commit 98f4e8d
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ lint:
golangci-lint run --build-tags $(TAGS)

lint-ci:
./bin/golangci-lint run --build-tags $(TAGS) --out-format github-actions
./bin/golangci-lint run --build-tags $(TAGS) --out-format github-actions --timeout 5m

test:
go test -v -tags=$(TAGS) ./...
Expand Down
8 changes: 4 additions & 4 deletions extensions/internal/git/log_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func TestSelectAllCommits(t *testing.T) {
db := Connect(t, Memory)
repo, ref := "https://github.com/mergestat/mergestat", "HEAD"
repo, ref := "https://github.com/mergestat/mergestat-lite", "HEAD"

rows, err := db.Query("SELECT * FROM commits(?, ?) LIMIT 5", repo, ref)
if err != nil {
Expand All @@ -36,7 +36,7 @@ func TestSelectAllCommits(t *testing.T) {

func TestSelectCommitByHash(t *testing.T) {
db := Connect(t, Memory)
repo, ref := "https://github.com/mergestat/mergestat", "HEAD"
repo, ref := "https://github.com/mergestat/mergestat-lite", "HEAD"
hash := "5ce802c851d3bedb5bb4a0f749093cae9a34818b"

var message, email string
Expand All @@ -52,7 +52,7 @@ func TestSelectCommitByHash(t *testing.T) {

func TestDateFilterOnCommit(t *testing.T) {
db := Connect(t, Memory)
repo := "https://github.com/mergestat/mergestat"
repo := "https://github.com/mergestat/mergestat-lite"

rows, err := db.Query("SELECT hash, committer_email, committer_when FROM commits(?)"+
" WHERE committer_when > DATE(?) AND committer_when < DATE(?) ORDER BY committer_when DESC",
Expand All @@ -78,7 +78,7 @@ func TestDateFilterOnCommit(t *testing.T) {

func TestDefaultCases(t *testing.T) {
db := Connect(t, Memory)
repo := "https://github.com/mergestat/mergestat"
repo := "https://github.com/mergestat/mergestat-lite"

var q = func(row *sql.Row) (hash, email string, when time.Time, err error) {
err = row.Scan(&hash, &email, &when)
Expand Down
4 changes: 2 additions & 2 deletions extensions/internal/git/native/blame_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

func TestSelectBlameREADMELines(t *testing.T) {
db := Connect(t, Memory)
repo := "https://github.com/mergestat/mergestat"
repo := "https://github.com/mergestat/mergestat-lite"

rows, err := db.Query("SELECT line_no, commit_hash FROM blame(?, '', 'README.md') LIMIT 10", repo)
if err != nil {
Expand All @@ -35,7 +35,7 @@ func TestSelectBlameREADMELines(t *testing.T) {

func TestSelectKnownBlame(t *testing.T) {
db := Connect(t, Memory)
repo, hash := "https://github.com/mergestat/mergestat", "2359c9a9ba0ba8aa694601ff12538c4e74b82cd5"
repo, hash := "https://github.com/mergestat/mergestat-lite", "2359c9a9ba0ba8aa694601ff12538c4e74b82cd5"

rows, err := db.Query("SELECT line_no, commit_hash FROM blame(?, ?, 'README.md')", repo, hash)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions extensions/internal/git/native/files_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

func TestSelect10FilesHEAD(t *testing.T) {
db := Connect(t, Memory)
repo := "https://github.com/mergestat/mergestat"
repo := "https://github.com/mergestat/mergestat-lite"

rows, err := db.Query("SELECT path, executable, contents FROM files(?) LIMIT 10", repo)
if err != nil {
Expand All @@ -33,7 +33,7 @@ func TestSelect10FilesHEAD(t *testing.T) {

func TestSelectKnownContents(t *testing.T) {
db := Connect(t, Memory)
repo, hash := "https://github.com/mergestat/mergestat", "2359c9a9ba0ba8aa694601ff12538c4e74b82cd5"
repo, hash := "https://github.com/mergestat/mergestat-lite", "2359c9a9ba0ba8aa694601ff12538c4e74b82cd5"

rows, err := db.Query("SELECT path, contents FROM files(?, ?) WHERE path LIKE 'Makefile' OR path LIKE 'go.mod'", repo, hash)
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions extensions/internal/git/native/stats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

func TestSelectLast5CommitStats(t *testing.T) {
db := Connect(t, Memory)
repo := "https://github.com/mergestat/mergestat"
repo := "https://github.com/mergestat/mergestat-lite"

rows, err := db.Query("SELECT commits.hash, file_path, additions, deletions FROM commits($1), stats($1, commits.hash) LIMIT 5", repo)
if err != nil {
Expand All @@ -31,7 +31,7 @@ func TestSelectLast5CommitStats(t *testing.T) {

func TestInitialCommitStats(t *testing.T) {
db := Connect(t, Memory)
repo, initialCommit := "https://github.com/mergestat/mergestat", "a4562d2d5a35536771745b0aa19d705eb47234e7"
repo, initialCommit := "https://github.com/mergestat/mergestat-lite", "a4562d2d5a35536771745b0aa19d705eb47234e7"

var filesChanged, additions, deletions int
err := db.QueryRow("SELECT count(DISTINCT file_path), sum(additions), sum(deletions) FROM stats(?, ?)", repo, initialCommit).
Expand Down Expand Up @@ -59,7 +59,7 @@ func TestInitialCommitStats(t *testing.T) {

func TestFromAndToStats(t *testing.T) {
db := Connect(t, Memory)
repo, fromHash, toHash := "https://github.com/mergestat/mergestat", "2359c9a9ba0ba8aa694601ff12538c4e74b82cd5", "d65736fd08fab5a64027f0c050ee148d88549406"
repo, fromHash, toHash := "https://github.com/mergestat/mergestat-lite", "2359c9a9ba0ba8aa694601ff12538c4e74b82cd5", "d65736fd08fab5a64027f0c050ee148d88549406"

var filesChanged, additions, deletions int
err := db.QueryRow("SELECT count(DISTINCT file_path), sum(additions), sum(deletions) FROM stats(?, ?, ?)", repo, fromHash, toHash).
Expand Down
2 changes: 1 addition & 1 deletion extensions/internal/git/refs_func_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

func TestCommitFromTagFn(t *testing.T) {
db := Connect(t, Memory)
repo := "https://github.com/mergestat/mergestat"
repo := "https://github.com/mergestat/mergestat-lite"

rows, err := db.Query("SELECT name, full_name, COMMIT_FROM_TAG(tag) FROM refs(?) WHERE type = 'tag'", repo)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion extensions/internal/git/refs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

func TestSelectAllRefs(t *testing.T) {
db := Connect(t, Memory)
repo := "https://github.com/mergestat/mergestat"
repo := "https://github.com/mergestat/mergestat-lite"

rows, err := db.Query("SELECT * FROM refs(?)", repo)
if err != nil {
Expand Down

0 comments on commit 98f4e8d

Please sign in to comment.