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

Add the external test linguist dir from env var #114

Merged
merged 3 commits into from
Oct 26, 2017

Conversation

vmarkovtsev
Copy link
Collaborator

This allows to use a cached directory with linguist instead of cloning and speeds up the tests by 3x on my local machine.

@codecov
Copy link

codecov bot commented Sep 28, 2017

Codecov Report

Merging #114 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #114   +/-   ##
=======================================
  Coverage   83.95%   83.95%           
=======================================
  Files          17       17           
  Lines         985      985           
=======================================
  Hits          827      827           
  Misses         96       96           
  Partials       62       62

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 91c074e...09d6add. Read the comment docs.

This allows to use a cached directory with linguist instead of cloning and speeds up the tests by -10s on my local machine.

Signed-off-by: Vadim Markovtsev <vadim@sourced.tech>
Copy link
Contributor

@abeaumont abeaumont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be extended to benchmark_test.go as well, shouldn't it?

common_test.go Outdated
s.repoLinguist, err = ioutil.TempDir("", "linguist-")
assert.NoError(s.T(), err)
s.repoLinguist = os.Getenv("ENRY_TEST_REPO")
s.cloned = len(s.repoLinguist) == 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be better to compare strings than lengths: s.repoLinguist == ""

s.tmpLinguist, err = ioutil.TempDir("", "linguist-")
assert.NoError(s.T(), err)
s.tmpLinguist = os.Getenv("ENRY_TEST_REPO")
s.cloned = len(s.tmpLinguist) == 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Signed-off-by: Vadim Markovtsev <vadim@sourced.tech>
@vmarkovtsev
Copy link
Collaborator Author

@abeaumont Fixed

cmd := exec.Command("git", "clone", lingustURL, s.tmpLinguist)
err = cmd.Run()
assert.NoError(s.T(), err)
if s.cloned {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This second if is not needed, it should be inside the previous one

Signed-off-by: Vadim Markovtsev <vadim@sourced.tech>
@vmarkovtsev
Copy link
Collaborator Author

@abeaumont Fixed

@abeaumont abeaumont merged commit b92be47 into src-d:master Oct 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants