Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Conversation

@smashwilson
Copy link
Contributor

Please be sure to read the contributor's guide to the GitHub package before submitting any pull requests.

Requirements

  • Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • Suggestion: You can use checklists to keep track of progress for the sections on metrics, tests, documentation, and user research.

Description of the Change

Adds test coverage for GitTempDir to prevent coverage flapping in unrelated pull requests.

Alternate Designs

I could have only covered the lines that weren't hit by other codepaths, but it's a small class so I just covered the whole thing.

Benefits

GitTempDir is one of the culprits in test coverage flapping that we see on unrelated PRs. This is one step toward minimizing those changes and keeping CodeCov output relevent.

Possible Drawbacks

N/A

Applicable Issues

N/A

Metrics

N/A

Tests

This should raise GitTempDir's coverage to 100%.

Documentation

N/A

Release Notes

N/A

User Experience Research (Optional)

N/A

@codecov
Copy link

codecov bot commented Jan 10, 2019

Codecov Report

Merging #1901 into master will decrease coverage by 0.04%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1901      +/-   ##
==========================================
- Coverage   91.09%   91.05%   -0.05%     
==========================================
  Files         185      185              
  Lines       10719    10719              
  Branches     1575     1575              
==========================================
- Hits         9765     9760       -5     
- Misses        954      959       +5
Impacted Files Coverage Δ
lib/models/conflicts/side.js 92.18% <0%> (-4.69%) ⬇️
lib/atom/decoration.js 84.33% <0%> (-2.41%) ⬇️
lib/controllers/editor-conflict-controller.js 94.94% <0%> (-1.02%) ⬇️
lib/git-temp-dir.js 100% <0%> (+3.03%) ⬆️

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 4786390...9658e1e. Read the comment docs.

@smashwilson smashwilson requested a review from a team January 10, 2019 20:09
@smashwilson
Copy link
Contributor Author

Looks like we're good 👌

Copy link

@annthurium annthurium left a comment

Choose a reason for hiding this comment

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

thanks for making our test coverage more stable! I have a question or two for my own education but nothing blocking.

Why were these files causing flapping in the first place? Were there timing issues or something, where sometimes we met certain conditions and sometimes not?

}

await tempDir.ensure();
assert.strictEqual(root, tempDir.getRootPath());

Choose a reason for hiding this comment

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

just for my own education...

you assign root = tempDir.getRootPath on line 11, and then assert that that these are still equal. With this assertion, are you testing that ensure() does not change the root path?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With this assertion, are you testing that ensure() does not change the root path?

Yup, exactly. I wanted to assert that multiple calls to ensure() wouldn't create new temp directories, basically.

const tempDir = new GitTempDir();
await tempDir.ensure();

assert.match(tempDir.getSocketPath(), /^\\\\\?\\pipe\\/);

Choose a reason for hiding this comment

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

fun regex. oh, windows.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Named pipes are fun 🙃

@smashwilson
Copy link
Contributor Author

Why were these files causing flapping in the first place? Were there timing issues or something, where sometimes we met certain conditions and sometimes not?

GitTempDir was only tested incidentally through GitShellOutStrategy and Repository tests, so we had a few lines that weren't being explicitly exercised. Getting us to full coverage with an explicit test is the best way to make sure these don't fall through the cracks.

@smashwilson smashwilson merged commit 4316bb8 into master Jan 11, 2019
@smashwilson smashwilson deleted the aw/coverage/git-temp-dir branch January 11, 2019 14:50
@kuychaco kuychaco mentioned this pull request Feb 4, 2019
18 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants