Skip to content

Commit 8961bad

Browse files
authored
Update contributing doc to to include testing information (#4222)
* Update to include testing information * Update
1 parent 208362c commit 8961bad

File tree

1 file changed

+52
-5
lines changed

1 file changed

+52
-5
lines changed

CONTRIBUTING.md

+52-5
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,71 @@
11
## Running the latest runtime version
2-
### Dependencies
2+
3+
## Dependencies
34

45
There is a dependency on the .NET Core tools for the cross platform support. You can [install these here](https://www.microsoft.com/net/core).
56

67
To install the required dotnet packages navigate into the repository root and run `dotnet restore`
78

8-
### Compiling the CLI Tools
9+
## Compiling the CLI Tools
10+
911
To build the project run `cd src/Azure.Functions.Cli; dotnet build` (note navigating into the src directory is required due to the test suite currently failing to compile on non-windows environments - see below)
1012

1113
### Running against a function app
14+
1215
To test this project against a local function app you can run from that function app's directory
1316

1417
`dotnet run --project PATH_TO_FUNCTIONS_CLI/src/Azure.Functions.Cli start`
1518

1619
where PATH_TO_FUNCTIONS_CLI is the absolute or relative path to the root of this repository.
1720

18-
## Running the Test Suite
19-
You cannot run the test suite at this moment in time using DotNet Core. We will update this file when this becomes possible.
21+
### Running the Test Suite
22+
23+
- Build the solution `dotnet build Azure.Functions.Cli.sln`
24+
- As part of this build, the cli is copied into the test project's output directory (`test/Azure.Functions.Cli.Tests/bin/Debug/net8.0`) - this is what will be used by the tests
25+
- If you wish to override this, you can set the `FUNC_PATH` environment variable to the path of the `func`/`func.exe` you wish to test against
26+
- Run the test suite in Visual Studio Test Explorer or by running `dotnet test` from the `test` project root.
27+
- i.e. `cd test/Azure.Functions.Cli.Tests; dotnet test`
28+
29+
#### Storage Emulator
30+
31+
Some tests, namely E2E, require an Azure storage emulator to be running. You can download the storage emulator [here](https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite?tabs=visual-studio%2Cblob-storage).
32+
33+
Run the emulator before your run the tests.
34+
35+
> There is a script you can use for this as well, see `tools/start-emulators.ps1`
36+
37+
#### Templates missing
38+
39+
If you see an error saying the templates folder is missing, you can follow either of the following steps:
40+
41+
##### (a)
42+
43+
- Find your offical func instation directory
44+
- i.e. `/opt/homebrew/Cellar/azure-functions-core-tools@4/4.0.6610`
45+
- or `%LOCALAPPDATA%\AzureFunctionsTools\Releases\4.69.0\cli_x64\`
46+
- Copy the templates folder to the test project's output directory (`test/Azure.Functions.Cli.Tests/bin/Debug/net8.0`)
47+
48+
##### or (b)
49+
50+
- Update `build/Program.cs` to just add the template nugets and json:
51+
52+
```csharp
53+
Orchestrator
54+
.CreateForTarget(args)
55+
.Then(AddTemplatesNupkgs)
56+
.Then(AddTemplatesJson)
57+
.Run();
58+
```
59+
- Set environment variables required to run the build script
60+
- Windows: `$env:IsReleaseBuild = "false"`
61+
- MacOS: `export IsReleaseBuild=false`
62+
- If using M1/M2, you may need to set the dotnet root as well `export DOTNET_ROOT=/usr/local/share/dotnet/x64`
63+
- Run the build script `build.ps1`
64+
- In the `artifacts` folder, you should find a `templates` folder within any the subfolders here
65+
- Copy the `templates` folder to the test project's output directory (`test/Azure.Functions.Cli.Tests/bin/Debug/net8.0`)
2066

2167
## Contributing to this Repository
68+
2269
### Filing Issues
2370

2471
Filing issues is a great way to contribute to the SDK. Here are some guidelines:
@@ -27,8 +74,8 @@ Filing issues is a great way to contribute to the SDK. Here are some guidelines:
2774
* Point to a test repository (e.g. hosted on GitHub) that can help reproduce the issue. This works better then trying to describe step by step how to create a repro scenario.
2875
* Github supports markdown, so when filing bugs make sure you check the formatting before clicking submit.
2976

30-
3177
### Submitting Pull Requests
78+
3279
If you don't know what a pull request is read this https://help.github.com/articles/using-pull-requests.
3380

3481
Before we can accept your pull-request you'll need to sign a [Contribution License Agreement (CLA)](http://en.wikipedia.org/wiki/Contributor_License_Agreement). You can sign ours [here](https://cla2.dotnetfoundation.org). However, you don't have to do this up-front. You can simply clone, fork, and submit your pull-request as usual.

0 commit comments

Comments
 (0)