microsoft / microsoft/VFSForGit

Accessor methods should not change machine state

Open
#1,048 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

affects: tests pr: refactoring
Dominant language
C#
Stars
6.1k
Forks
474
Avg merge
2d 4h
Merged PRs (30d)
8

Description

Enlistment.GetNewLogFileName(logsRoot) method checks whether the logsRoot exists and if not tries to create it.

This causes un-desired side effects when logsRoot is a Mock path and cause UT of classes (like ProductUpgrader) which uses this method to fail.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at Enlistment.GetNewLogFileName(logsRoot) and inspect how it checks and creates the logsRoot path. Use the ProductUpgrader unit tests as the relevant validation; done means accessor use with a mock path causes no filesystem changes and those tests no longer fail.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.