Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: failing test cases that uses github.com/mergestat/mergestat #324

Merged
merged 2 commits into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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