Closed will-kienle-bayer closed 1 year ago
The https://github.com/aws/aws-lambda-dotnet/tree/master/Libraries/src/Amazon.Lambda.TestUtilities project was last updated 6 years ago. Needs reproduction and review with the team.
@will-kienle Thanks for reporting the issue and the code. Would it be possible to share the sample code solution along with the step-by-step instructions on how you configured to run the test code as part of GitHub action? I just want to make sure that this is reproducible using the exact same configuration.
Hi @will-kienle,
Good evening.
Somehow, I'm unable to reproduce the issue. Here are the steps:
using Microsoft.AspNetCore.Mvc;
namespace LambdaServerlessApiHyphen_Issue1342.Controllers;
[Route("get-values")]
public class ValuesController : ControllerBase
{
[HttpGet]
public IEnumerable
**Startup.cs**
```C#
namespace LambdaServerlessApiHyphen_Issue1342;
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseHttpsRedirection();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
.csproj
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AWSProjectType>Lambda</AWSProjectType>
<!-- This property makes the build directory similar to a publish directory and helps the AWS .NET Lambda Mock Test Tool find project dependencies. -->
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<!-- Generate ready to run images during publishing to improve cold start time. -->
<PublishReadyToRun>true</PublishReadyToRun>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Amazon.Lambda.AspNetCoreServer" Version="7.3.0" />
</ItemGroup>
</Project>
UnitTest .csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Amazon.Lambda.TestUtilities" Version="2.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.1.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LambdaServerlessApiHyphen_Issue1342\LambdaServerlessApiHyphen_Issue1342.csproj" />
</ItemGroup>
</Project>
UnitTest LambdaServerlessApiHyphenTests.cs
using Amazon.Lambda.APIGatewayEvents;
using LambdaServerlessApiHyphen_Issue1342;
using Amazon.Lambda.TestUtilities;
using Xunit;
namespace LambdaServerlessApiHyphenTests
{
public class LambdaServerlessApiHyphenTests
{
[Fact]
public async Task TestGet()
{
var lambdaFunction = new LambdaEntryPoint();
var request = new APIGatewayProxyRequest
{
Resource = "/{proxy+}",
Path = "/get-values",
HttpMethod = "GET"
};
var context = new TestLambdaContext();
var response = await lambdaFunction.FunctionHandlerAsync(request, context);
Assert.NotNull(response.Body);
}
}
}
.github\workflows\BuildanTest.yml
.
name: Build and Test
on: [push, pull_request]
jobs: build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: Setup .NET Core 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
- Checkin and pushed the code.
- Examined GitHub workflow run
2023-01-06T01:37:28.1392062Z Requested labels: ubuntu-latest
2023-01-06T01:37:28.1392102Z Job defined at: ashishdhingra/testrepo/.github/workflows/BuildandTest.yml@refs/heads/main
2023-01-06T01:37:28.1392125Z Waiting for a runner to pick up this job...
2023-01-06T01:37:28.3570327Z Job is waiting for a hosted runner to come online.
2023-01-06T01:37:33.4926032Z Job is about to start running on the hosted runner: Hosted Agent (hosted)
2023-01-06T01:37:37.6914420Z Current runner version: '2.299.1'
2023-01-06T01:37:37.6946388Z ##[group]Operating System
2023-01-06T01:37:37.6946983Z Ubuntu
2023-01-06T01:37:37.6947324Z 22.04.1
2023-01-06T01:37:37.6947625Z LTS
2023-01-06T01:37:37.6947910Z ##[endgroup]
2023-01-06T01:37:37.6948372Z ##[group]Runner Image
2023-01-06T01:37:37.6948779Z Image: ubuntu-22.04
2023-01-06T01:37:37.6949091Z Version: 20221212.1
2023-01-06T01:37:37.6949834Z Included Software: https://github.com/actions/runner-images/blob/ubuntu22/20221212.1/images/linux/Ubuntu2204-Readme.md
2023-01-06T01:37:37.6950814Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu22%2F20221212.1
2023-01-06T01:37:37.6951660Z ##[endgroup]
2023-01-06T01:37:37.6952104Z ##[group]Runner Image Provisioner
2023-01-06T01:37:37.6952722Z 2.0.98.1
2023-01-06T01:37:37.6953401Z ##[endgroup]
2023-01-06T01:37:37.6954701Z ##[group]GITHUB_TOKEN Permissions
2023-01-06T01:37:37.6955462Z Actions: write
2023-01-06T01:37:37.6955817Z Checks: write
2023-01-06T01:37:37.6956389Z Contents: write
2023-01-06T01:37:37.6956810Z Deployments: write
2023-01-06T01:37:37.6957183Z Discussions: write
2023-01-06T01:37:37.6957482Z Issues: write
2023-01-06T01:37:37.6957818Z Metadata: read
2023-01-06T01:37:37.6958227Z Packages: write
2023-01-06T01:37:37.6958523Z Pages: write
2023-01-06T01:37:37.6958877Z PullRequests: write
2023-01-06T01:37:37.6959264Z RepositoryProjects: write
2023-01-06T01:37:37.6959624Z SecurityEvents: write
2023-01-06T01:37:37.6960436Z Statuses: write
2023-01-06T01:37:37.6961159Z ##[endgroup]
2023-01-06T01:37:37.6966386Z Secret source: Actions
2023-01-06T01:37:37.6967248Z Prepare workflow directory
2023-01-06T01:37:37.7994370Z Prepare all required actions
2023-01-06T01:37:37.8250835Z Getting action download info
2023-01-06T01:37:38.9312597Z Download action repository 'actions/checkout@v2' (SHA:dc323e67f16fb5f7663d20ff7941f27f5809e9b6)
2023-01-06T01:37:39.3644284Z Download action repository 'actions/setup-dotnet@v1' (SHA:608ee757cfcce72c2e91e99aca128e0cae67de87)
2023-01-06T01:37:39.9280887Z ##[group]Run actions/checkout@v2
2023-01-06T01:37:39.9281293Z with:
2023-01-06T01:37:39.9281641Z fetch-depth: 0
2023-01-06T01:37:39.9282115Z repository: ashishdhingra/testrepo
2023-01-06T01:37:39.9282651Z token:
2023-01-06T01:37:39.9283005Z ssh-strict: true
2023-01-06T01:37:39.9283370Z persist-credentials: true
2023-01-06T01:37:39.9283656Z clean: true
2023-01-06T01:37:39.9284204Z lfs: false
2023-01-06T01:37:39.9284505Z submodules: false
2023-01-06T01:37:39.9284778Z set-safe-directory: true
2023-01-06T01:37:39.9285128Z ##[endgroup]
2023-01-06T01:37:40.3335656Z Syncing repository: ashishdhingra/testrepo
2023-01-06T01:37:40.3337648Z ##[group]Getting Git version info
2023-01-06T01:37:40.3338204Z Working directory is '/home/runner/work/testrepo/testrepo'
2023-01-06T01:37:40.3344925Z [command]/usr/bin/git version
2023-01-06T01:37:40.3543881Z git version 2.38.2
2023-01-06T01:37:40.3591143Z ##[endgroup]
2023-01-06T01:37:40.3616411Z Temporarily overriding HOME='/home/runner/work/_temp/7c792d88-7d07-4865-b26c-383100d547ac' before making global git config changes
2023-01-06T01:37:40.3617090Z Adding repository directory to the temporary git global config as a safe directory
2023-01-06T01:37:40.3617718Z [command]/usr/bin/git config --global --add safe.directory /home/runner/work/testrepo/testrepo
2023-01-06T01:37:40.3685152Z Deleting the contents of '/home/runner/work/testrepo/testrepo'
2023-01-06T01:37:40.3690802Z ##[group]Initializing the repository
2023-01-06T01:37:40.3695202Z [command]/usr/bin/git init /home/runner/work/testrepo/testrepo
2023-01-06T01:37:40.3844170Z hint: Using 'master' as the name for the initial branch. This default branch name
2023-01-06T01:37:40.3846145Z hint: is subject to change. To configure the initial branch name to use in all
2023-01-06T01:37:40.3847342Z hint: of your new repositories, which will suppress this warning, call:
2023-01-06T01:37:40.3899288Z hint:
2023-01-06T01:37:40.3901425Z hint: git config --global init.defaultBranch
2023-01-06T01:37:40.8533513Z remote: Counting objects: 3% (1/32)
2023-01-06T01:37:40.8534680Z remote: Counting objects: 6% (2/32)
2023-01-06T01:37:40.8535591Z remote: Counting objects: 9% (3/32)
2023-01-06T01:37:40.8537949Z remote: Counting objects: 12% (4/32)
2023-01-06T01:37:40.8538577Z remote: Counting objects: 15% (5/32)
2023-01-06T01:37:40.8538915Z remote: Counting objects: 18% (6/32)
2023-01-06T01:37:40.8539329Z remote: Counting objects: 21% (7/32)
2023-01-06T01:37:40.8539824Z remote: Counting objects: 25% (8/32)
2023-01-06T01:37:40.8540365Z remote: Counting objects: 28% (9/32)
2023-01-06T01:37:40.8540759Z remote: Counting objects: 31% (10/32)
2023-01-06T01:37:40.8541170Z remote: Counting objects: 34% (11/32)
2023-01-06T01:37:40.8541506Z remote: Counting objects: 37% (12/32)
2023-01-06T01:37:40.8542120Z remote: Counting objects: 40% (13/32)
2023-01-06T01:37:40.8542504Z remote: Counting objects: 43% (14/32)
2023-01-06T01:37:40.8542900Z remote: Counting objects: 46% (15/32)
2023-01-06T01:37:40.8543219Z remote: Counting objects: 50% (16/32)
2023-01-06T01:37:40.8543627Z remote: Counting objects: 53% (17/32)
2023-01-06T01:37:40.8544166Z remote: Counting objects: 56% (18/32)
2023-01-06T01:37:40.8544653Z remote: Counting objects: 59% (19/32)
2023-01-06T01:37:40.8545037Z remote: Counting objects: 62% (20/32)
2023-01-06T01:37:40.8545404Z remote: Counting objects: 65% (21/32)
2023-01-06T01:37:40.8545769Z remote: Counting objects: 68% (22/32)
2023-01-06T01:37:40.8546138Z remote: Counting objects: 71% (23/32)
2023-01-06T01:37:40.8546522Z remote: Counting objects: 75% (24/32)
2023-01-06T01:37:40.8546894Z remote: Counting objects: 78% (25/32)
2023-01-06T01:37:40.8547213Z remote: Counting objects: 81% (26/32)
2023-01-06T01:37:40.8547988Z remote: Counting objects: 84% (27/32)
2023-01-06T01:37:40.8548585Z remote: Counting objects: 87% (28/32)
2023-01-06T01:37:40.8548918Z remote: Counting objects: 90% (29/32)
2023-01-06T01:37:40.8549273Z remote: Counting objects: 93% (30/32)
2023-01-06T01:37:40.8549684Z remote: Counting objects: 96% (31/32)
2023-01-06T01:37:40.8550166Z remote: Counting objects: 100% (32/32)
2023-01-06T01:37:40.8550562Z remote: Counting objects: 100% (32/32), done.
2023-01-06T01:37:40.8550967Z remote: Compressing objects: 4% (1/21)
2023-01-06T01:37:40.8551314Z remote: Compressing objects: 9% (2/21)
2023-01-06T01:37:40.8551894Z remote: Compressing objects: 14% (3/21)
2023-01-06T01:37:40.8552287Z remote: Compressing objects: 19% (4/21)
2023-01-06T01:37:40.8552666Z remote: Compressing objects: 23% (5/21)
2023-01-06T01:37:40.8552992Z remote: Compressing objects: 28% (6/21)
2023-01-06T01:37:40.8553524Z remote: Compressing objects: 33% (7/21)
2023-01-06T01:37:40.8553971Z remote: Compressing objects: 38% (8/21)
2023-01-06T01:37:40.8554310Z remote: Compressing objects: 42% (9/21)
2023-01-06T01:37:40.8554701Z remote: Compressing objects: 47% (10/21)
2023-01-06T01:37:40.8558298Z remote: Compressing objects: 52% (11/21)
2023-01-06T01:37:40.8563096Z remote: Compressing objects: 57% (12/21)
2023-01-06T01:37:40.8563862Z remote: Compressing objects: 61% (13/21)
2023-01-06T01:37:40.8564277Z remote: Compressing objects: 66% (14/21)
2023-01-06T01:37:40.8564700Z remote: Compressing objects: 71% (15/21)
2023-01-06T01:37:40.8565049Z remote: Compressing objects: 76% (16/21)
2023-01-06T01:37:40.8565499Z remote: Compressing objects: 80% (17/21)
2023-01-06T01:37:40.8566259Z remote: Compressing objects: 85% (18/21)
2023-01-06T01:37:40.8566625Z remote: Compressing objects: 90% (19/21)
2023-01-06T01:37:40.8567029Z remote: Compressing objects: 95% (20/21)
2023-01-06T01:37:40.8567606Z remote: Compressing objects: 100% (21/21)
2023-01-06T01:37:40.8568079Z remote: Compressing objects: 100% (21/21), done.
2023-01-06T01:37:40.8572130Z remote: Total 32 (delta 5), reused 31 (delta 4), pack-reused 0
2023-01-06T01:37:40.8737919Z From https://github.com/ashishdhingra/testrepo
2023-01-06T01:37:40.8738705Z * [new branch] main -> origin/main
2023-01-06T01:37:40.8780063Z [command]/usr/bin/git branch --list --remote origin/main
2023-01-06T01:37:40.8813010Z origin/main
2023-01-06T01:37:40.8823486Z [command]/usr/bin/git rev-parse refs/remotes/origin/main
2023-01-06T01:37:40.8851866Z f8e06f646e987184b927e65c9a344c123685a9d8
2023-01-06T01:37:40.8856925Z ##[endgroup]
2023-01-06T01:37:40.8858023Z ##[group]Determining the checkout info
2023-01-06T01:37:40.8859207Z ##[endgroup]
2023-01-06T01:37:40.8860237Z ##[group]Checking out the ref
2023-01-06T01:37:40.8864743Z [command]/usr/bin/git checkout --progress --force -B main refs/remotes/origin/main
2023-01-06T01:37:40.8937036Z Switched to a new branch 'main'
2023-01-06T01:37:40.8942531Z branch 'main' set up to track 'origin/main'.
2023-01-06T01:37:40.8947041Z ##[endgroup]
2023-01-06T01:37:40.9198749Z [command]/usr/bin/git log -1 --format='%H'
2023-01-06T01:37:40.9213846Z 'f8e06f646e987184b927e65c9a344c123685a9d8'
2023-01-06T01:37:40.9499508Z ##[group]Run actions/setup-dotnet@v1
2023-01-06T01:37:40.9500235Z with:
2023-01-06T01:37:40.9500697Z dotnet-version: 6.0.x
2023-01-06T01:37:40.9500906Z ##[endgroup]
2023-01-06T01:37:42.1069619Z [command]/home/runner/work/_actions/actions/setup-dotnet/v1/externals/install-dotnet.sh --version 6.0.404
2023-01-06T01:37:42.1163469Z dotnet-install: Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:
2023-01-06T01:37:42.1164440Z dotnet-install: - The SDK needs to be installed without user interaction and without admin rights.
2023-01-06T01:37:42.1165222Z dotnet-install: - The SDK installation doesn't need to persist across multiple CI runs.
2023-01-06T01:37:42.1168034Z dotnet-install: To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.
2023-01-06T01:37:42.1168601Z
2023-01-06T01:37:43.1563249Z dotnet-install: Attempting to download using primary link https://dotnetcli.azureedge.net/dotnet/Sdk/6.0.404/dotnet-sdk-6.0.404-linux-x64.tar.gz
2023-01-06T01:37:44.2482165Z dotnet-install: Extracting zip from https://dotnetcli.azureedge.net/dotnet/Sdk/6.0.404/dotnet-sdk-6.0.404-linux-x64.tar.gz
2023-01-06T01:37:50.9705658Z dotnet-install: Adding to current process PATH: /home/runner/.dotnet
. Note: This change will be visible only when sourcing script.
2023-01-06T01:37:50.9709340Z dotnet-install: Note that the script does not resolve dependencies during installation.
2023-01-06T01:37:50.9710542Z dotnet-install: To check the list of dependencies, go to https://docs.microsoft.com/dotnet/core/install, select your operating system and check the "Dependencies" section.
2023-01-06T01:37:50.9711498Z dotnet-install: Installation finished successfully.
2023-01-06T01:37:50.9728650Z /home/runner/.dotnet:/home/runner/.local/bin:/opt/pipx_bin:/home/runner/.cargo/bin:/home/runner/.config/composer/vendor/bin:/usr/local/.ghcup/bin:/home/runner/.dotnet/tools:/snap/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
2023-01-06T01:37:50.9921882Z ##[group]Run dotnet restore
2023-01-06T01:37:50.9922244Z [36;1mdotnet restore[0m
2023-01-06T01:37:50.9994627Z shell: /usr/bin/bash -e {0}
2023-01-06T01:37:50.9994892Z env:
2023-01-06T01:37:50.9995135Z DOTNET_ROOT: /home/runner/.dotnet
2023-01-06T01:37:50.9995382Z ##[endgroup]
2023-01-06T01:37:52.6175296Z Determining projects to restore...
2023-01-06T01:37:59.3665410Z Restored /home/runner/work/testrepo/testrepo/LambdaServerlessApiHyphen.Tests/LambdaServerlessApiHyphen.Tests.csproj (in 6.14 sec).
2023-01-06T01:38:00.0636705Z Restored /home/runner/work/testrepo/testrepo/LambdaServerlessApiHyphen_Issue1342/LambdaServerlessApiHyphen_Issue1342.csproj (in 6.86 sec).
2023-01-06T01:38:00.1160642Z ##[group]Run dotnet build --no-restore
2023-01-06T01:38:00.1161008Z [36;1mdotnet build --no-restore[0m
2023-01-06T01:38:00.1231192Z shell: /usr/bin/bash -e {0}
2023-01-06T01:38:00.1231534Z env:
2023-01-06T01:38:00.1231760Z DOTNET_ROOT: /home/runner/.dotnet
2023-01-06T01:38:00.1232023Z ##[endgroup]
2023-01-06T01:38:00.2836737Z MSBuild version 17.3.2+561848881 for .NET
2023-01-06T01:38:05.1492836Z LambdaServerlessApiHyphen_Issue1342 -> /home/runner/work/testrepo/testrepo/LambdaServerlessApiHyphen_Issue1342/bin/Debug/net6.0/LambdaServerlessApiHyphen_Issue1342.dll
2023-01-06T01:38:06.1516485Z LambdaServerlessApiHyphen.Tests -> /home/runner/work/testrepo/testrepo/LambdaServerlessApiHyphen.Tests/bin/Debug/net6.0/LambdaServerlessApiHyphen.Tests.dll
2023-01-06T01:38:06.2033043Z
2023-01-06T01:38:06.2033620Z Build succeeded.
2023-01-06T01:38:06.2034083Z 0 Warning(s)
2023-01-06T01:38:06.2034290Z 0 Error(s)
2023-01-06T01:38:06.2034454Z
2023-01-06T01:38:06.2351023Z Time Elapsed 00:00:05.73
2023-01-06T01:38:06.2411403Z ##[group]Run dotnet test --no-build --verbosity normal
2023-01-06T01:38:06.2411814Z [36;1mdotnet test --no-build --verbosity normal[0m
2023-01-06T01:38:06.2469253Z shell: /usr/bin/bash -e {0}
2023-01-06T01:38:06.2469500Z env:
2023-01-06T01:38:06.2469736Z DOTNET_ROOT: /home/runner/.dotnet
2023-01-06T01:38:06.2469970Z ##[endgroup]
2023-01-06T01:38:06.6080226Z Build started 01/06/2023 01:38:06.
2023-01-06T01:38:06.8242571Z 1>Project "/home/runner/work/testrepo/testrepo/LambdaServerlessApiHyphen_Issue1342.sln" on node 1 (VSTest target(s)).
2023-01-06T01:38:06.8248101Z 1>ValidateSolutionConfiguration:
2023-01-06T01:38:06.8248935Z Building solution configuration "Debug|Any CPU".
2023-01-06T01:38:07.7204668Z Test run for /home/runner/work/testrepo/testrepo/LambdaServerlessApiHyphen.Tests/bin/Debug/net6.0/LambdaServerlessApiHyphen.Tests.dll (.NETCoreApp,Version=v6.0)
2023-01-06T01:38:07.8160470Z Microsoft (R) Test Execution Command Line Tool Version 17.3.1 (x64)
2023-01-06T01:38:07.8161645Z Copyright (c) Microsoft Corporation. All rights reserved.
2023-01-06T01:38:07.8222327Z
2023-01-06T01:38:08.0021902Z Starting test execution, please wait...
2023-01-06T01:38:08.0429528Z A total of 1 test files matched the specified pattern.
2023-01-06T01:38:09.7685377Z [40m[32minfo[39m[22m[49m: Microsoft.Hosting.Lifetime[0]
2023-01-06T01:38:09.7685991Z Application started. Press Ctrl+C to shut down.
2023-01-06T01:38:09.7686531Z [40m[32minfo[39m[22m[49m: Microsoft.Hosting.Lifetime[0]
2023-01-06T01:38:09.7686946Z Hosting environment: Production
2023-01-06T01:38:09.7687444Z [40m[32minfo[39m[22m[49m: Microsoft.Hosting.Lifetime[0]
2023-01-06T01:38:09.7687949Z Content root path: /home/runner/work/testrepo/testrepo/LambdaServerlessApiHyphen.Tests/bin/Debug/net6.0
2023-01-06T01:38:09.7841285Z [40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Hosting.Diagnostics[1]
2023-01-06T01:38:09.7842133Z Request starting GET https://apigateway--/get-values - 0
2023-01-06T01:38:09.8141355Z [40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
2023-01-06T01:38:09.8142938Z Executing endpoint 'LambdaServerlessApiHyphen_Issue1342.Controllers.ValuesController.GetValues (LambdaServerlessApiHyphen_Issue1342)'
2023-01-06T01:38:09.8224725Z [40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[3]
2023-01-06T01:38:09.8226440Z Route matched with {action = "GetValues", controller = "Values"}. Executing controller action with signature System.Collections.Generic.IEnumerable`1[System.String] GetValues() on controller LambdaServerlessApiHyphen_Issue1342.Controllers.ValuesController (LambdaServerlessApiHyphen_Issue1342).
2023-01-06T01:38:09.8297523Z [40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Mvc.Infrastructure.ObjectResultExecutor[1]
2023-01-06T01:38:09.8298478Z Executing ObjectResult, writing value of type 'System.String[]'.
2023-01-06T01:38:09.8429329Z [40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker[2]
2023-01-06T01:38:09.8431529Z Executed action LambdaServerlessApiHyphen_Issue1342.Controllers.ValuesController.GetValues (LambdaServerlessApiHyphen_Issue1342) in 14.2052ms
2023-01-06T01:38:09.8440478Z [40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Routing.EndpointMiddleware[1]
2023-01-06T01:38:09.8441615Z Executed endpoint 'LambdaServerlessApiHyphen_Issue1342.Controllers.ValuesController.GetValues (LambdaServerlessApiHyphen_Issue1342)'
2023-01-06T01:38:09.8504677Z [40m[32minfo[39m[22m[49m: Microsoft.AspNetCore.Hosting.Diagnostics[2]
2023-01-06T01:38:09.8505820Z Request finished GET https://apigateway--/get-values - 0 - 200 - application/json;+charset=utf-8 67.2436ms
2023-01-06T01:38:10.0423804Z
2023-01-06T01:38:10.0537096Z Passed! - Failed: 0, Passed: 1, Skipped: 0, Total: 1, Duration: 1 ms - /home/runner/work/testrepo/testrepo/LambdaServerlessApiHyphen.Tests/bin/Debug/net6.0/LambdaServerlessApiHyphen.Tests.dll (net6.0)
2023-01-06T01:38:10.0786920Z 1>Done Building Project "/home/runner/work/testrepo/testrepo/LambdaServerlessApiHyphen_Issue1342.sln" (VSTest target(s)).
2023-01-06T01:38:10.0950249Z
2023-01-06T01:38:10.0950539Z Build succeeded.
2023-01-06T01:38:10.0951083Z 0 Warning(s)
2023-01-06T01:38:10.0951414Z 0 Error(s)
2023-01-06T01:38:10.0951572Z
2023-01-06T01:38:10.0951745Z Time Elapsed 00:00:03.48
2023-01-06T01:38:10.1357446Z Post job cleanup.
2023-01-06T01:38:10.3032659Z [command]/usr/bin/git version
2023-01-06T01:38:10.3095443Z git version 2.38.2
2023-01-06T01:38:10.3154857Z Temporarily overriding HOME='/home/runner/work/_temp/e107c1fc-5d4f-4814-96ca-0050a08ca638' before making global git config changes
2023-01-06T01:38:10.3155898Z Adding repository directory to the temporary git global config as a safe directory
2023-01-06T01:38:10.3161072Z [command]/usr/bin/git config --global --add safe.directory /home/runner/work/testrepo/testrepo
2023-01-06T01:38:10.3225616Z [command]/usr/bin/git config --local --name-only --get-regexp core.sshCommand
2023-01-06T01:38:10.3269155Z [command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
2023-01-06T01:38:10.3582312Z [command]/usr/bin/git config --local --name-only --get-regexp http.https\:\/\/github.com\/.extraheader
2023-01-06T01:38:10.3651362Z http.https://github.com/.extraheader
2023-01-06T01:38:10.3674845Z [command]/usr/bin/git config --local --unset-all http.https://github.com/.extraheader
2023-01-06T01:38:10.3725506Z [command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http.https\:\/\/github.com\/.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
2023-01-06T01:38:10.4272691Z Cleaning up orphan processes
2023-01-06T01:38:10.4696208Z Terminate orphan process: pid (2022) (dotnet)
If you notice, the test execution passes. Unsure about your GitHub action setup.
Thanks,
Ashish
This issue has not received a response in 5 days. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled.
Describe the bug
I have a .NET 6.0 Lambda API. I am running unit tests over the controller classes using the APIGatewayProxyFunction, APIGatewayProxyRequest, and TestLambdaContext classes to simulate an HTTP request to the lambda resource. I've discovered that when the API endpoint route contains a hyphen, these simulated requests return a status code of 404, causing the tests to fail. However, this failure only occurs when running in our Github action. This behavior is not observed on my development machine, so there must be some configuration/environment that affects it. Further, the actual API itself works, both locally and when deployed to an actual lambda function. If I run the exact same test, but simply remove the hyphen from the API route and the request, the request succeeds.
Expected Behavior
Test API instance returns a response
Current Behavior
Test API instance returns 404
Reproduction Steps
code.txt
Possible Solution
No response
Additional Information/Context
No response
AWS .NET SDK and/or Package version used
Amazon.Lambda.Core 2.1.0 Amazon.Lambda.APIGatewayEvents 2.5.0 Amazon.Lambda.TestUtilities 2.0.0 AWSSDK.Core 3.7.13.14 AWSSDK.Extensions.NETCore.Setup 3.7.2
Targeted .NET Platform
.NET 6.0
Operating System and version
Development machine is win10, github action runner is undetermined Linux