Skip to content

Commit 2eb29ad

Browse files
authored
Add smoke test to Lambda OCI images for TZData being available. (#1636)
1 parent 88a6fce commit 2eb29ad

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

LambdaRuntimeDockerfiles/SmokeTests/test/ImageFunction.SmokeTests/ImageFunctionTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public ImageFunctionTests()
7171
[InlineData("ImageFunction::ImageFunction.Function::Ping", "ping", "pong")]
7272
[InlineData("ImageFunction::ImageFunction.Function::HttpsWorksAsync", "", "SUCCESS")]
7373
[InlineData("ImageFunction::ImageFunction.Function::VerifyLambdaContext", "", "SUCCESS")]
74+
[InlineData("ImageFunction::ImageFunction.Function::VerifyTzData", "", "SUCCESS")]
7475
public async Task SuccessfulTests(string handler, string input, string expectedResponse)
7576
{
7677
await UpdateHandlerAsync(handler);
@@ -170,6 +171,7 @@ await _lambdaClient.CreateFunctionAsync(new CreateFunctionRequest
170171
MemorySize = 512,
171172
Role = _executionRoleArn,
172173
PackageType = PackageType.Image,
174+
Timeout = 30,
173175
Architectures = new List<string> {GetArchitecture()}
174176
});
175177
break;

LambdaRuntimeDockerfiles/SmokeTests/test/ImageFunction/Function.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,18 @@ public string VerifyLambdaContext(ILambdaContext lambdaContext)
116116
return GetResponse(true);
117117
}
118118

119+
// .NET on Linux uses the tzdata system package to get time zone information.
120+
// If TzData is not installed/available in the Linux environment the
121+
// TimeZoneInfo.GetSystemTimeZones() will return an empty collection.
122+
// For futher information: https://github.com/aws/aws-lambda-dotnet/issues/1620
123+
public string VerifyTzData(ILambdaContext lambdaContext)
124+
{
125+
AssertTrue(TimeZoneInfo.GetSystemTimeZones().Count > 0, "No time zones were found");
126+
AssertNotNull(TimeZoneInfo.FindSystemTimeZoneById("Europe/London"), "Failed to find Europe/London timezone");
127+
128+
return SuccessResult;
129+
}
130+
119131
#endregion
120132

121133
#region Private methods

0 commit comments

Comments
 (0)