Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion aws_lambda_builders/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"java11": [ARM64, X86_64],
"java17": [ARM64, X86_64],
"go1.x": [ARM64, X86_64],
"dotnetcore3.1": [ARM64, X86_64],
"dotnet6": [ARM64, X86_64],
"provided": [ARM64, X86_64],
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ package:
<ZIP-FILE> The name of the zip file to package the project into
Options:
-c | --configuration Configuration to build with, for example Release or Debug.
-f | --framework Target framework to compile, for example netcoreapp2.1.
-f | --framework Target framework to compile, for example net6.0.
--msbuild-parameters Additional msbuild parameters passed to the 'dotnet publish' command. Add quotes around the value if the value contains spaces.
-pl | --project-location The location of the project, if not set the current directory will be assumed.
-cfg | --config-file Configuration file storing default values for command line arguments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def run(self, args, cwd=None):
LOG.debug("executing dotnet: %s", invoke_dotnet)

# DotNet output is in system locale dependent encoding
# https://docs.microsoft.com/en-us/dotnet/api/system.console.outputencoding?view=netcore-3.1#remarks
# https://learn.microsoft.com/en-us/dotnet/api/system.console.outputencoding?view=net-6.0#remarks
# "The default code page that the console uses is determined by the system locale."
encoding = locale.getpreferredencoding()
p = self.os_utils.popen(invoke_dotnet, stdout=self.os_utils.pipe, stderr=self.os_utils.pipe, cwd=cwd)
Expand Down
78 changes: 2 additions & 76 deletions tests/integration/workflows/dotnet_clipackage/test_dotnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

class TestDotnetBase(TestCase):
"""
Base class for dotnetcore tests
Base class for dotnet tests
"""

TEST_DATA_FOLDER = os.path.join(os.path.dirname(__file__), "testdata")
Expand All @@ -25,7 +25,7 @@ def setUp(self):
self.artifacts_dir = tempfile.mkdtemp()
self.scratch_dir = tempfile.mkdtemp()
self.builder = LambdaBuilder(language="dotnet", dependency_manager="cli-package", application_framework=None)
self.runtime = "dotnetcore3.1"
self.runtime = "dotnet6"

def tearDown(self):
shutil.rmtree(self.artifacts_dir)
Expand All @@ -50,80 +50,6 @@ def verify_execute_permissions(self, entrypoint_file_name):
self.assertTrue(os.access(entrypoint_file_path, os.X_OK))


class TestDotnet31(TestDotnetBase):
"""
Tests for dotnetcore 3.1
"""

def setUp(self):
super(TestDotnet31, self).setUp()
self.runtime = "dotnetcore3.1"

def test_with_defaults_file(self):
source_dir = os.path.join(self.TEST_DATA_FOLDER, "WithDefaultsFile3.1")

self.builder.build(source_dir, self.artifacts_dir, self.scratch_dir, source_dir, runtime=self.runtime)

expected_files = {
"Amazon.Lambda.Core.dll",
"Amazon.Lambda.Serialization.Json.dll",
"Newtonsoft.Json.dll",
"WithDefaultsFile.deps.json",
"WithDefaultsFile.dll",
"WithDefaultsFile.pdb",
"WithDefaultsFile.runtimeconfig.json",
}

output_files = set(os.listdir(self.artifacts_dir))

self.assertEqual(expected_files, output_files)
self.verify_architecture("WithDefaultsFile.deps.json", "linux-x64")

def test_with_defaults_file_x86(self):
source_dir = os.path.join(self.TEST_DATA_FOLDER, "WithDefaultsFile3.1")

self.builder.build(
source_dir, self.artifacts_dir, self.scratch_dir, source_dir, runtime=self.runtime, architecture=X86_64
)

expected_files = {
"Amazon.Lambda.Core.dll",
"Amazon.Lambda.Serialization.Json.dll",
"Newtonsoft.Json.dll",
"WithDefaultsFile.deps.json",
"WithDefaultsFile.dll",
"WithDefaultsFile.pdb",
"WithDefaultsFile.runtimeconfig.json",
}

output_files = set(os.listdir(self.artifacts_dir))

self.assertEqual(expected_files, output_files)
self.verify_architecture("WithDefaultsFile.deps.json", "linux-x64")

def test_with_defaults_file_arm64(self):
source_dir = os.path.join(self.TEST_DATA_FOLDER, "WithDefaultsFile3.1")

self.builder.build(
source_dir, self.artifacts_dir, self.scratch_dir, source_dir, runtime=self.runtime, architecture=ARM64
)

expected_files = {
"Amazon.Lambda.Core.dll",
"Amazon.Lambda.Serialization.Json.dll",
"Newtonsoft.Json.dll",
"WithDefaultsFile.deps.json",
"WithDefaultsFile.dll",
"WithDefaultsFile.pdb",
"WithDefaultsFile.runtimeconfig.json",
}

output_files = set(os.listdir(self.artifacts_dir))

self.assertEqual(expected_files, output_files)
self.verify_architecture("WithDefaultsFile.deps.json", "linux-arm64")


class TestDotnet6(TestDotnetBase):
"""
Tests for dotnet 6
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AWSProjectType>Lambda</AWSProjectType>
</PropertyGroup>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

4 changes: 2 additions & 2 deletions tests/unit/workflows/dotnet_clipackage/test_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def test_build_package_arm64(self):

def test_build_package_arguments(self):
mode = "Release"
options = {"--framework": "netcoreapp2.1"}
options = {"--framework": "net6.0"}
action = RunPackageAction(
self.source_dir, self.subprocess_dotnet, self.artifacts_dir, options, mode, os_utils=self.os_utils
)
Expand All @@ -176,7 +176,7 @@ def test_build_package_arguments(self):
"--msbuild-parameters",
"--runtime linux-x64",
"--framework",
"netcoreapp2.1",
"net6.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the issue is in the Doc one, I added a wrong value.

],
cwd="/source_dir",
)
Expand Down