Skip to content

Commit 460cdf8

Browse files
authored
Merge pull request #506 from ericksoen/update-aws-lambda-tools-docs
Update aws lambda tools docs
2 parents ed152d6 + 5e43d51 commit 460cdf8

File tree

4 files changed

+32
-21
lines changed

4 files changed

+32
-21
lines changed

Tools/LambdaTestTool/Amazon.Lambda.TestTool.Tests/LoadLambdaFunctionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Amazon.Lambda.TestTool.Tests
99
public class LoadLambdaFunctionTests
1010
{
1111
[Fact]
12-
public void LoadInstaneMethodWithAssemblySerializer()
12+
public void LoadInstanceMethodWithAssemblySerializer()
1313
{
1414
var configFile = Path.GetFullPath(@"../../../../LambdaFunctions/S3EventFunction/aws-lambda-tools-defaults.json");
1515
var buildPath = Path.GetFullPath(@"../../../../LambdaFunctions/S3EventFunction/bin/debug/netcoreapp2.1");

Tools/LambdaTestTool/Amazon.Lambda.TestTool/Runtime/LocalLambdaRuntime.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public interface ILocalLambdaRuntime : IDisposable
1818
IList<LambdaFunction> LoadLambdaFunctions(IList<LambdaFunctionInfo> configInfos);
1919
ExecutionResponse ExecuteLambdaFunction(ExecutionRequest request);
2020
}
21-
21+
2222
/// <summary>
2323
/// A mock Lambda runtime to execute Lambda functions.
2424
/// </summary>
@@ -44,18 +44,18 @@ public static ILocalLambdaRuntime Initialize(string directory)
4444
var depsFile = Directory.GetFiles(directory, "*.deps.json").FirstOrDefault();
4545
if (depsFile == null)
4646
{
47-
throw new Exception("Failed to find a deps.json file");
47+
throw new Exception($"Failed to find a deps.json file in the specified directory ({directory})");
4848
}
4949

5050
var fileName = depsFile.Substring(0, depsFile.Length - ".deps.json".Length) + ".dll";
5151
if (!File.Exists(fileName))
5252
{
53-
throw new Exception("Failed to find Lambda project entry assembly");
53+
throw new Exception($"Failed to find Lambda project entry assembly in the specified directory ({directory})");
5454
}
55-
55+
5656
// The resolver provides the ability to load the assemblies containing the select Lambda function.
5757
var resolver = new LambdaAssemblyResolver(fileName);
58-
58+
5959
var runtime = new LocalLambdaRuntime(resolver, directory);
6060
return runtime;
6161
}
@@ -68,7 +68,7 @@ public IList<LambdaFunction> LoadLambdaFunctions(IList<LambdaFunctionInfo> confi
6868
{
6969
functions.Add(LoadLambdaFunction(configInfo));
7070
}
71-
71+
7272
return functions;
7373
}
7474

@@ -88,7 +88,7 @@ public LambdaFunction LoadLambdaFunction(LambdaFunctionInfo functionInfo)
8888
function.ErrorMessage = $"Invalid format for function handler string {functionInfo.Handler}. Format is <assembly>::<type-name>::<method>.";
8989
return function;
9090
}
91-
91+
9292
// Using our custom Assembly resolver load the target Assembly.
9393
function.LambdaAssembly = this.Resolver.LoadAssembly(handlerTokens[0]);
9494
if (function.LambdaAssembly == null)
@@ -114,7 +114,7 @@ public LambdaFunction LoadLambdaFunction(LambdaFunctionInfo functionInfo)
114114
else
115115
{
116116
// TODO: Handle method overloads
117-
if(methodInfos.Length > 1)
117+
if (methodInfos.Length > 1)
118118
{
119119
function.ErrorMessage = $"More then one method called {handlerTokens[2]} was found. This tool does not currently support method overloading.";
120120
}
@@ -128,8 +128,8 @@ public LambdaFunction LoadLambdaFunction(LambdaFunctionInfo functionInfo)
128128
// Search to see if a Lambda serializer is registered.
129129
var attribute = function.LambdaMethod.GetCustomAttribute(typeof(LambdaSerializerAttribute)) as LambdaSerializerAttribute ??
130130
function.LambdaAssembly.GetCustomAttribute(typeof(LambdaSerializerAttribute)) as LambdaSerializerAttribute;
131-
132-
131+
132+
133133
if (attribute != null)
134134
{
135135
function.Serializer = Activator.CreateInstance(attribute.SerializerType) as ILambdaSerializer;
@@ -138,7 +138,7 @@ public LambdaFunction LoadLambdaFunction(LambdaFunctionInfo functionInfo)
138138

139139
return function;
140140
}
141-
141+
142142
/// <summary>
143143
/// Execute the Lambda function.
144144
/// </summary>

Tools/LambdaTestTool/README.md

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,20 @@
22

33
The AWS .NET Mock Lambda Test Tool is a tool that can be used to load a .NET Core Lambda project and execute the selected code inside an emulated Lambda environment. An IDE that is attached to the process hosting this tool can then debug and step through the .NET Core Lambda code. The tool is optimized for quick local debugging with minimal dependencies.
44

5-
**Note:** this tool is not a local Lambda environment. This tool is optimized for quick local debugging with minimal dependencies. For example, the targeted .NET Core Lambda code is run within the process of this tool which is run on the host OS. The host OS is usually Windows or macOS. The host OS is not Amazon Linux, the OS for the Lambda service. Due to these design differences, this tool is not intended to diagnose platform specific issues but instead it can be useful for debugging application logic issues.
5+
![](./Resources/TestHarness.png)
66

7-
* [Getting Started](#getting-help)
8-
* [Installing and Running](#installing-and-running)
9-
* [Configure for Visual Studio](#configure-for-visual-studio)
10-
* [Configure for Visual Studio Code](#configure-for-visual-studio-code)
11-
* [Configure for JetBrains Rider](#configure-for-jetbrains-rider)
12-
* [Configure for Visual Studio for Mac](#configure-for-visual-studio-for-mac)
13-
* [Known Limitations](#known-limitations)
7+
**Note:** this tool is not a local Lambda environment. This tool is optimized for quick local debugging with minimal dependencies. For example, the targeted .NET Core Lambda code is run within the process of this tool which is run on the host OS. The host OS is usually Windows or macOS. The host OS is not Amazon Linux, the OS for the Lambda service. Due to these design differences, this tool is not intended to diagnose platform specific issues but instead it can be useful for debugging application logic issues.
8+
9+
- [Getting Started](#getting-help)
10+
- [Installing and Running](#installing-and-running)
11+
- [Configure for Visual Studio](#configure-for-visual-studio)
12+
- [Configure for Visual Studio Code](#configure-for-visual-studio-code)
13+
- [Configure for JetBrains Rider](#configure-for-jetbrains-rider)
14+
- [Configure for Visual Studio for Mac](#configure-for-visual-studio-for-mac)
15+
- [Known Limitations](#known-limitations)
1416

1517
## Getting Help
18+
1619
This tool is currently in preview and there are some known limitations. For questions and problems please open a GitHub issue in this repository.
1720

1821
## AWS Credentials
@@ -88,7 +91,15 @@ To debug with Visual Studio Code and the .NET Mock Lambda Test Tool edit the [la
8891
"stopAtEntry": false,
8992
"internalConsoleOptions": "openOnSessionStart"
9093
},
91-
```
94+
```
95+
96+
To customize the launch behavior for the debugger, you can pass additional arguments via the `args` property:
97+
98+
| Name | Default Value | Example |
99+
| ---------------- | ------------------------- | ------------------------------------------- |
100+
| port | 5050 | `["--port", "5001"`] |
101+
| suppress browser | False | `["--no-launch-window", "true"`] |
102+
| path | Current working directory | `["--path", "C:\\different\\launch\\path"]` |
92103

93104
## Configure for JetBrains Rider
94105

141 KB
Loading

0 commit comments

Comments
 (0)