@@ -25,34 +25,38 @@ def setUp(self):
25
25
self .artifacts_dir = tempfile .mkdtemp ()
26
26
self .scratch_dir = tempfile .mkdtemp ()
27
27
self .builder = LambdaBuilder (language = "dotnet" , dependency_manager = "cli-package" , application_framework = None )
28
- self .runtime = "dotnetcore2 .1" # default to 2.1
28
+ self .runtime = "dotnetcore3 .1"
29
29
30
30
def tearDown (self ):
31
31
shutil .rmtree (self .artifacts_dir )
32
32
shutil .rmtree (self .scratch_dir )
33
33
34
- def verify_architecture (self , deps_file_name , expected_architecture ):
34
+ def verify_architecture (self , deps_file_name , expected_architecture , version = None ):
35
35
deps_file = pathlib .Path (self .artifacts_dir , deps_file_name )
36
36
37
37
if not deps_file .exists ():
38
38
self .fail ("Failed verifying architecture, {} file not found" .format (deps_file_name ))
39
39
40
40
with open (str (deps_file )) as f :
41
41
deps_json = json .loads (f .read ())
42
- version = self .runtime [- 3 :]
42
+ version = version or self .runtime [- 3 :]
43
43
target_name = ".NETCoreApp,Version=v{}/{}" .format (version , expected_architecture )
44
44
target = deps_json .get ("runtimeTarget" ).get ("name" )
45
45
46
46
self .assertEqual (target , target_name )
47
47
48
48
49
- class TestDotnet21 (TestDotnetBase ):
49
+ class TestDotnet31 (TestDotnetBase ):
50
50
"""
51
- Tests for dotnetcore 2 .1
51
+ Tests for dotnetcore 3 .1
52
52
"""
53
53
54
+ def setUp (self ):
55
+ super (TestDotnet31 , self ).setUp ()
56
+ self .runtime = "dotnetcore3.1"
57
+
54
58
def test_with_defaults_file (self ):
55
- source_dir = os .path .join (self .TEST_DATA_FOLDER , "WithDefaultsFile2 .1" )
59
+ source_dir = os .path .join (self .TEST_DATA_FOLDER , "WithDefaultsFile3 .1" )
56
60
57
61
self .builder .build (source_dir , self .artifacts_dir , self .scratch_dir , source_dir , runtime = self .runtime )
58
62
@@ -71,45 +75,62 @@ def test_with_defaults_file(self):
71
75
self .assertEqual (expected_files , output_files )
72
76
self .verify_architecture ("WithDefaultsFile.deps.json" , "linux-x64" )
73
77
74
- def test_require_parameters (self ):
75
- source_dir = os .path .join (self .TEST_DATA_FOLDER , "RequireParameters " )
78
+ def test_with_defaults_file_x86 (self ):
79
+ source_dir = os .path .join (self .TEST_DATA_FOLDER , "WithDefaultsFile3.1 " )
76
80
77
81
self .builder .build (
78
- source_dir ,
79
- self .artifacts_dir ,
80
- self .scratch_dir ,
81
- source_dir ,
82
- runtime = self .runtime ,
83
- options = {"--framework" : "netcoreapp2.1" , "--configuration" : "Debug" },
82
+ source_dir , self .artifacts_dir , self .scratch_dir , source_dir , runtime = self .runtime , architecture = X86_64
84
83
)
85
84
86
85
expected_files = {
87
86
"Amazon.Lambda.Core.dll" ,
88
87
"Amazon.Lambda.Serialization.Json.dll" ,
89
88
"Newtonsoft.Json.dll" ,
90
- "RequireParameters .deps.json" ,
91
- "RequireParameters .dll" ,
92
- "RequireParameters .pdb" ,
93
- "RequireParameters .runtimeconfig.json" ,
89
+ "WithDefaultsFile .deps.json" ,
90
+ "WithDefaultsFile .dll" ,
91
+ "WithDefaultsFile .pdb" ,
92
+ "WithDefaultsFile .runtimeconfig.json" ,
94
93
}
95
94
96
95
output_files = set (os .listdir (self .artifacts_dir ))
97
96
98
97
self .assertEqual (expected_files , output_files )
99
- self .verify_architecture ("RequireParameters.deps.json" , "linux-x64" )
98
+ self .verify_architecture ("WithDefaultsFile.deps.json" , "linux-x64" )
99
+
100
+ def test_with_defaults_file_arm64 (self ):
101
+ source_dir = os .path .join (self .TEST_DATA_FOLDER , "WithDefaultsFile3.1" )
100
102
103
+ self .builder .build (
104
+ source_dir , self .artifacts_dir , self .scratch_dir , source_dir , runtime = self .runtime , architecture = ARM64
105
+ )
101
106
102
- class TestDotnet31 (TestDotnetBase ):
107
+ expected_files = {
108
+ "Amazon.Lambda.Core.dll" ,
109
+ "Amazon.Lambda.Serialization.Json.dll" ,
110
+ "Newtonsoft.Json.dll" ,
111
+ "WithDefaultsFile.deps.json" ,
112
+ "WithDefaultsFile.dll" ,
113
+ "WithDefaultsFile.pdb" ,
114
+ "WithDefaultsFile.runtimeconfig.json" ,
115
+ }
116
+
117
+ output_files = set (os .listdir (self .artifacts_dir ))
118
+
119
+ self .assertEqual (expected_files , output_files )
120
+ self .verify_architecture ("WithDefaultsFile.deps.json" , "linux-arm64" )
121
+
122
+
123
+ class TestDotnet6 (TestDotnetBase ):
103
124
"""
104
- Tests for dotnetcore 3.1
125
+ Tests for dotnet 6
105
126
"""
106
127
107
128
def setUp (self ):
108
- super (TestDotnet31 , self ).setUp ()
109
- self .runtime = "dotnetcore3.1 "
129
+ super (TestDotnet6 , self ).setUp ()
130
+ self .runtime = "dotnet6 "
110
131
111
132
def test_with_defaults_file (self ):
112
- source_dir = os .path .join (self .TEST_DATA_FOLDER , "WithDefaultsFile3.1 " )
133
+ source_dir = os .path .join (self .TEST_DATA_FOLDER , "WithDefaultsFile6 " )
113
134
114
135
self .builder .build (source_dir , self .artifacts_dir , self .scratch_dir , source_dir , runtime = self .runtime )
115
136
@@ -126,10 +147,10 @@ def test_with_defaults_file(self):
126
147
output_files = set (os .listdir (self .artifacts_dir ))
127
148
128
149
self .assertEqual (expected_files , output_files )
129
- self .verify_architecture ("WithDefaultsFile.deps.json" , "linux-x64" )
150
+ self .verify_architecture ("WithDefaultsFile.deps.json" , "linux-x64" , version = "6.0" )
130
151
131
152
def test_with_defaults_file_x86 (self ):
132
- source_dir = os .path .join (self .TEST_DATA_FOLDER , "WithDefaultsFile3.1 " )
153
+ source_dir = os .path .join (self .TEST_DATA_FOLDER , "WithDefaultsFile6 " )
133
154
134
155
self .builder .build (
135
156
source_dir , self .artifacts_dir , self .scratch_dir , source_dir , runtime = self .runtime , architecture = X86_64
@@ -148,10 +169,10 @@ def test_with_defaults_file_x86(self):
148
169
output_files = set (os .listdir (self .artifacts_dir ))
149
170
150
171
self .assertEqual (expected_files , output_files )
151
- self .verify_architecture ("WithDefaultsFile.deps.json" , "linux-x64" )
172
+ self .verify_architecture ("WithDefaultsFile.deps.json" , "linux-x64" , version = "6.0" )
152
173
153
174
def test_with_defaults_file_arm64 (self ):
154
- source_dir = os .path .join (self .TEST_DATA_FOLDER , "WithDefaultsFile3.1 " )
175
+ source_dir = os .path .join (self .TEST_DATA_FOLDER , "WithDefaultsFile6 " )
155
176
156
177
self .builder .build (
157
178
source_dir , self .artifacts_dir , self .scratch_dir , source_dir , runtime = self .runtime , architecture = ARM64
@@ -170,4 +191,4 @@ def test_with_defaults_file_arm64(self):
170
191
output_files = set (os .listdir (self .artifacts_dir ))
171
192
172
193
self .assertEqual (expected_files , output_files )
173
- self .verify_architecture ("WithDefaultsFile.deps.json" , "linux-arm64" )
194
+ self .verify_architecture ("WithDefaultsFile.deps.json" , "linux-arm64" , version = "6.0" )
0 commit comments