Azure / Azure/azure-functions-host

FileUtility abstraction

Open
#10,954 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
2k
Forks
483
Avg merge
2d 10h
Merged PRs (30d)
36

Description

We need to introduce an abstraction to enhance the FileUtility class usage.

The class exposes an Instance property

https://github.com/Azure/azure-functions-host/blob/0ee99cb093fed43927754ed62f7b4b8f8914a192/src/WebJobs.Script/Extensions/FileUtility.cs#L21-L24

which I see many tests are overriding when running the tests with a mocked IFileSystem. But since FileUtility.Instance is a shared state, if multiple tests are running parallelly, this would cause one test to get the state set by another test.

https://github.com/Azure/azure-functions-host/blob/0ee99cb093fed43927754ed62f7b4b8f8914a192/test/WebJobs.Script.Tests/Security/SimpleKubernetesClientTests.cs#L64

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 with src/WebJobs.Script/Extensions/FileUtility.cs, especially the Instance property, then inspect the override in test/WebJobs.Script.Tests/Security/SimpleKubernetesClientTests.cs and related mocked IFileSystem usage. The abstraction is done when tests no longer rely on shared FileUtility.Instance state and can run in parallel without crossing state.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
testing
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.