Skip to content

Commit 8d2b799

Browse files
committed
Fix up tests
1 parent a9b373c commit 8d2b799

5 files changed

Lines changed: 606 additions & 26 deletions

File tree

Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/Snapshots/ServerlessTemplates/albEvents.template

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
]
1515
},
1616
"Properties": {
17-
"Runtime": "dotnet6",
17+
"Runtime": "dotnet10",
1818
"CodeUri": ".",
1919
"MemorySize": 512,
2020
"Timeout": 30,
@@ -67,7 +67,6 @@
6767
"Tool": "Amazon.Lambda.Annotations"
6868
},
6969
"Properties": {
70-
"ListenerArn": "arn:aws:elasticloadbalancing:us-east-1:123456789012:listener/app/my-alb/abc/def",
7170
"Priority": 1,
7271
"Conditions": [
7372
{
@@ -86,7 +85,8 @@
8685
"Ref": "ALBHelloWorldALBTargetGroup"
8786
}
8887
}
89-
]
88+
],
89+
"ListenerArn": "arn:aws:elasticloadbalancing:us-east-1:123456789012:listener/app/my-alb/abc/def"
9090
}
9191
},
9292
"ALBWithOptions": {
@@ -100,7 +100,7 @@
100100
]
101101
},
102102
"Properties": {
103-
"Runtime": "dotnet6",
103+
"Runtime": "dotnet10",
104104
"CodeUri": ".",
105105
"MemorySize": 512,
106106
"Timeout": 30,
@@ -159,9 +159,6 @@
159159
"Tool": "Amazon.Lambda.Annotations"
160160
},
161161
"Properties": {
162-
"ListenerArn": {
163-
"Ref": "MyALBListener"
164-
},
165162
"Priority": 5,
166163
"Conditions": [
167164
{
@@ -196,7 +193,10 @@
196193
"Ref": "ALBWithOptionsALBTargetGroup"
197194
}
198195
}
199-
]
196+
],
197+
"ListenerArn": {
198+
"Ref": "MyALBListener"
199+
}
200200
}
201201
}
202202
}

Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/Snapshots/ServerlessTemplates/dynamoDBEvents.template

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
"MyTable": {
4949
"Type": "DynamoDB",
5050
"Properties": {
51-
"Stream": "arn:aws:dynamodb:us-east-2:444455556666:table/MyTable/stream/2024-01-01T00:00:00",
5251
"StartingPosition": "LATEST",
5352
"BatchSize": 50,
5453
"MaximumBatchingWindowInSeconds": 2,
@@ -61,27 +60,28 @@
6160
"Pattern": "My-Filter-2"
6261
}
6362
]
64-
}
63+
},
64+
"Stream": "arn:aws:dynamodb:us-east-2:444455556666:table/MyTable/stream/2024-01-01T00:00:00"
6565
}
6666
},
6767
"MyTable2": {
6868
"Type": "DynamoDB",
6969
"Properties": {
70-
"Stream": "arn:aws:dynamodb:us-east-2:444455556666:table/MyTable2/stream/2024-01-01T00:00:00",
7170
"StartingPosition": "TRIM_HORIZON",
72-
"Enabled": false
71+
"Enabled": false,
72+
"Stream": "arn:aws:dynamodb:us-east-2:444455556666:table/MyTable2/stream/2024-01-01T00:00:00"
7373
}
7474
},
7575
"testTableEvent": {
7676
"Type": "DynamoDB",
7777
"Properties": {
78+
"StartingPosition": "LATEST",
7879
"Stream": {
7980
"Fn::GetAtt": [
8081
"testTable",
8182
"StreamArn"
8283
]
83-
},
84-
"StartingPosition": "LATEST"
84+
}
8585
}
8686
}
8787
}
@@ -118,8 +118,8 @@
118118
"MyTable": {
119119
"Type": "DynamoDB",
120120
"Properties": {
121-
"Stream": "arn:aws:dynamodb:us-east-2:444455556666:table/MyTable/stream/2024-01-01T00:00:00",
122-
"StartingPosition": "LATEST"
121+
"StartingPosition": "LATEST",
122+
"Stream": "arn:aws:dynamodb:us-east-2:444455556666:table/MyTable/stream/2024-01-01T00:00:00"
123123
}
124124
}
125125
}

Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/Snapshots/ServerlessTemplates/snsEvents.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
"MyTopic": {
3939
"Type": "SNS",
4040
"Properties": {
41-
"Topic": "arn:aws:sns:us-east-2:444455556666:MyTopic",
42-
"FilterPolicy": "{ \"store\": [\"example_corp\"] }"
41+
"FilterPolicy": "{ \"store\": [\"example_corp\"] }",
42+
"Topic": "arn:aws:sns:us-east-2:444455556666:MyTopic"
4343
}
4444
},
4545
"testTopicEvent": {

Libraries/test/Amazon.Lambda.Annotations.SourceGenerators.Tests/SourceGeneratorTests.cs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,13 @@ public async Task ToUpper_Net8()
12111211
ExpectedDiagnostics =
12121212
{
12131213
new DiagnosticResult("AWSLambda0103", DiagnosticSeverity.Info).WithArguments("Functions_ToUpper_Generated.g.cs", expectedFunctionContent),
1214-
new DiagnosticResult("AWSLambda0103", DiagnosticSeverity.Info).WithArguments($"TestServerlessApp.NET8{Path.DirectorySeparatorChar}serverless.template", expectedTemplateContent)
1214+
new DiagnosticResult("AWSLambda0103", DiagnosticSeverity.Info).WithArguments($"TestServerlessApp.NET8{Path.DirectorySeparatorChar}serverless.template", expectedTemplateContent),
1215+
DiagnosticResult.CompilerError("CS1705").WithArguments("Amazon.Lambda.Core", "Amazon.Lambda.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604", "System.Runtime, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Runtime", "System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"),
1216+
DiagnosticResult.CompilerError("CS1705").WithArguments("Amazon.Lambda.Core", "Amazon.Lambda.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604", "System.Runtime, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Runtime", "System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"),
1217+
DiagnosticResult.CompilerError("CS1705").WithArguments("Amazon.Lambda.Serialization.SystemTextJson", "Amazon.Lambda.Serialization.SystemTextJson, Version=0.0.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604", "System.Runtime, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Runtime", "System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"),
1218+
DiagnosticResult.CompilerError("CS1705").WithArguments("Amazon.Lambda.Serialization.SystemTextJson", "Amazon.Lambda.Serialization.SystemTextJson, Version=0.0.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604", "System.Runtime, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Runtime", "System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"),
1219+
DiagnosticResult.CompilerError("CS1705").WithArguments("Amazon.Lambda.Serialization.SystemTextJson", "Amazon.Lambda.Serialization.SystemTextJson, Version=0.0.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604", "System.Runtime, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Runtime", "System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"),
1220+
DiagnosticResult.CompilerError("CS1705").WithArguments("Amazon.Lambda.Serialization.SystemTextJson", "Amazon.Lambda.Serialization.SystemTextJson, Version=0.0.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604", "System.Runtime, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Runtime", "System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
12151221
}
12161222
}
12171223
}.RunAsync();
@@ -1388,13 +1394,13 @@ public async Task VerifyValidALBEvents()
13881394
ExpectedDiagnostics =
13891395
{
13901396
new DiagnosticResult("AWSLambda0103", DiagnosticSeverity.Info)
1391-
.WithArguments("ValidALBEvents_Hello_Generated.g.cs", validALBEventsHelloGeneratedContent),
1397+
.WithArguments($"TestServerlessApp{Path.DirectorySeparatorChar}serverless.template", expectedTemplateContent),
13921398

13931399
new DiagnosticResult("AWSLambda0103", DiagnosticSeverity.Info)
13941400
.WithArguments("ValidALBEvents_HandleRequest_Generated.g.cs", validALBEventsHandleRequestGeneratedContent),
13951401

13961402
new DiagnosticResult("AWSLambda0103", DiagnosticSeverity.Info)
1397-
.WithArguments($"TestServerlessApp{Path.DirectorySeparatorChar}serverless.template", expectedTemplateContent),
1403+
.WithArguments("ValidALBEvents_Hello_Generated.g.cs", validALBEventsHelloGeneratedContent),
13981404

13991405
new DiagnosticResult("AWSLambda0133", DiagnosticSeverity.Error)
14001406
}
@@ -1503,13 +1509,13 @@ public async Task VerifyValidDynamoDBEvents()
15031509
ExpectedDiagnostics =
15041510
{
15051511
new DiagnosticResult("AWSLambda0103", DiagnosticSeverity.Info)
1506-
.WithArguments("ValidDynamoDBEvents_ProcessMessages_Generated.g.cs", validDynamoDBEventsProcessMessagesGeneratedContent),
1512+
.WithArguments($"TestServerlessApp{Path.DirectorySeparatorChar}serverless.template", expectedTemplateContent),
15071513

15081514
new DiagnosticResult("AWSLambda0103", DiagnosticSeverity.Info)
15091515
.WithArguments("ValidDynamoDBEvents_ProcessMessagesAsync_Generated.g.cs", validDynamoDBEventsProcessMessagesAsyncGeneratedContent),
15101516

15111517
new DiagnosticResult("AWSLambda0103", DiagnosticSeverity.Info)
1512-
.WithArguments($"TestServerlessApp{Path.DirectorySeparatorChar}serverless.template", expectedTemplateContent)
1518+
.WithArguments("ValidDynamoDBEvents_ProcessMessages_Generated.g.cs", validDynamoDBEventsProcessMessagesGeneratedContent)
15131519
}
15141520
}
15151521
}.RunAsync();
@@ -1604,13 +1610,13 @@ public async Task VerifyValidSNSEvents()
16041610
ExpectedDiagnostics =
16051611
{
16061612
new DiagnosticResult("AWSLambda0103", DiagnosticSeverity.Info)
1607-
.WithArguments("ValidSNSEvents_ProcessMessages_Generated.g.cs", validSNSEventsProcessMessagesGeneratedContent),
1613+
.WithArguments($"TestServerlessApp{Path.DirectorySeparatorChar}serverless.template", expectedTemplateContent),
16081614

16091615
new DiagnosticResult("AWSLambda0103", DiagnosticSeverity.Info)
16101616
.WithArguments("ValidSNSEvents_ProcessMessagesAsync_Generated.g.cs", validSNSEventsProcessMessagesAsyncGeneratedContent),
16111617

16121618
new DiagnosticResult("AWSLambda0103", DiagnosticSeverity.Info)
1613-
.WithArguments($"TestServerlessApp{Path.DirectorySeparatorChar}serverless.template", expectedTemplateContent)
1619+
.WithArguments("ValidSNSEvents_ProcessMessages_Generated.g.cs", validSNSEventsProcessMessagesGeneratedContent)
16141620
}
16151621
}
16161622
}.RunAsync();
@@ -2230,6 +2236,7 @@ private static DiagnosticResult[] GetExpectedRuntimeSupportDiagnostics()
22302236
DiagnosticResult.CompilerError("CS0117").WithSpan(clientFile, 540, 135, 540, 142).WithArguments(runtimeApiContext, "Default"),
22312237
DiagnosticResult.CompilerError("CS0117").WithSpan(snapFile, 13, 34, 13, 71).WithArguments("Amazon.Lambda.Core.SnapshotRestore", "CopyBeforeSnapshotCallbacksToRegistry"),
22322238
DiagnosticResult.CompilerError("CS0117").WithSpan(snapFile, 14, 34, 14, 69).WithArguments("Amazon.Lambda.Core.SnapshotRestore", "CopyAfterRestoreCallbacksToRegistry"),
2239+
DiagnosticResult.CompilerError("CS0122").WithSpan($"Amazon.Lambda.RuntimeSupport{Path.DirectorySeparatorChar}Bootstrap{Path.DirectorySeparatorChar}LambdaBootstrap.cs", 228, 17, 228, 60).WithArguments("Amazon.Lambda.RuntimeSupport.ResponseStreamLambdaCoreInitializerIsolated"),
22332240
};
22342241
}
22352242
}

0 commit comments

Comments
 (0)