Пример #1
0
        public async Task RunDeployCommand()
        {
            var fullPath = Path.GetFullPath("../TestFunction");
            var command  = new DeployFunctionCommand(new ConsoleToolLogger(), fullPath, new string[0]);

            command.FunctionName = "test-function-" + DateTime.Now.Ticks;
            command.Handler      = "TestFunction::TestFunction.Function::ToUpper";
            command.Timeout      = 10;
            command.MemorySize   = 512;
            command.Role         = this._roleArn;
            command.Runtime      = "dotnetcore1.0";

            var created = await command.ExecuteAsync();

            try
            {
                Assert.True(created);

                var invokeRequest = new InvokeRequest
                {
                    FunctionName = command.FunctionName,
                    LogType      = LogType.Tail,
                    Payload      = "\"hello world\""
                };
                var response = await command.LambdaClient.InvokeAsync(invokeRequest);

                var payload = new StreamReader(response.Payload).ReadToEnd();
                var log     = System.Text.UTF8Encoding.UTF8.GetString(Convert.FromBase64String(response.LogResult));
                Assert.Equal("\"HELLO WORLD\"", payload);
            }
            finally
            {
                await command.LambdaClient.DeleteFunctionAsync(command.FunctionName);
            }
        }
Пример #2
0
        public async Task DeployWithPackage()
        {
            var assembly = this.GetType().GetTypeInfo().Assembly;

            string packageZip = Path.GetTempFileName() + ".zip";
            var    fullPath   = Path.GetFullPath(Path.GetDirectoryName(assembly.Location) + "../../../../../../testapps/TestFunction");

            var packageCommand = new PackageCommand(new ConsoleToolLogger(), fullPath, new string[0]);

            packageCommand.OutputPackageFileName = packageZip;
            packageCommand.Configuration         = "Release";
            packageCommand.TargetFramework       = "netcoreapp1.0";

            await packageCommand.ExecuteAsync();

            var deployCommand = new DeployFunctionCommand(new ConsoleToolLogger(), Path.GetTempPath(), new string[0]);

            deployCommand.FunctionName       = "test-function-" + DateTime.Now.Ticks;
            deployCommand.Handler            = "TestFunction::TestFunction.Function::ToUpper";
            deployCommand.Timeout            = 10;
            deployCommand.MemorySize         = 512;
            deployCommand.Role               = this._roleArn;
            deployCommand.Package            = packageZip;
            deployCommand.Runtime            = "dotnetcore1.0";
            deployCommand.Region             = "us-east-1";
            deployCommand.DisableInteractive = true;

            var created = await deployCommand.ExecuteAsync();

            try
            {
                Assert.True(created);

                var invokeRequest = new InvokeRequest
                {
                    FunctionName = deployCommand.FunctionName,
                    LogType      = LogType.Tail,
                    Payload      = "\"hello world\""
                };
                var response = await deployCommand.LambdaClient.InvokeAsync(invokeRequest);

                var payload = new StreamReader(response.Payload).ReadToEnd();
                Assert.Equal("\"HELLO WORLD\"", payload);
            }
            finally
            {
                if (File.Exists(packageZip))
                {
                    File.Delete(packageZip);
                }

                if (created)
                {
                    await deployCommand.LambdaClient.DeleteFunctionAsync(deployCommand.FunctionName);
                }
            }
        }
        public async Task TestPowerShellLambdaParallelTestCommand()
        {
            var assembly = this.GetType().GetTypeInfo().Assembly;

            var fullPath = Path.GetFullPath(Path.GetDirectoryName(assembly.Location) + "../../../../../../testapps/TestPowerShellParallelTest");
            var command  = new DeployFunctionCommand(new TestToolLogger(_testOutputHelper), fullPath, new string[0]);

            command.FunctionName = "test-function-" + DateTime.Now.Ticks;
            command.Timeout      = 10;
            command.MemorySize   = 512;
            command.Role         = await TestHelper.GetTestRoleArnAsync();

            command.Configuration      = "Release";
            command.S3Bucket           = this._testFixture.Bucket;
            command.S3Prefix           = "TestPowerShellParallelTest/";
            command.Region             = "us-east-1";
            command.DisableInteractive = true;

            var created = await command.ExecuteAsync();

            try
            {
                Assert.True(created);

                var invokeRequest = new InvokeRequest
                {
                    FunctionName = command.FunctionName,
                    LogType      = LogType.Tail,
                    Payload      = "{}"
                };
                var response = await command.LambdaClient.InvokeAsync(invokeRequest);

                var logTail = Encoding.UTF8.GetString(Convert.FromBase64String(response.LogResult));

                Assert.Equal(200, response.StatusCode);
                Assert.Contains("Running against: 1 for SharedVariable: Hello Shared Variable", logTail);
                Assert.Contains("Running against: 10 for SharedVariable: Hello Shared Variable", logTail);
            }
            finally
            {
                if (created)
                {
                    await command.LambdaClient.DeleteFunctionAsync(command.FunctionName);
                }
            }
        }
        public async Task RunDeployCommandWithCustomConfigAndProjectLocation()
        {
            var assembly = this.GetType().GetTypeInfo().Assembly;

            var fullPath = Path.GetFullPath(Path.GetDirectoryName(assembly.Location));
            var command  = new DeployFunctionCommand(new ConsoleToolLogger(), fullPath,
                                                     new string[] { "--config-file", "custom-config.json", "--project-location", "../../../../../testapps/TestFunction" });

            command.FunctionName = "test-function-" + DateTime.Now.Ticks;
            command.Handler      = "TestFunction::TestFunction.Function::ToUpper";
            command.Timeout      = 10;
            command.Role         = await TestHelper.GetTestRoleArnAsync();

            command.Configuration      = "Release";
            command.Runtime            = "dotnetcore2.1";
            command.DisableInteractive = true;

            var created = await command.ExecuteAsync();

            try
            {
                Assert.True(created);

                var invokeRequest = new InvokeRequest
                {
                    FunctionName = command.FunctionName,
                    LogType      = LogType.Tail,
                    Payload      = "\"hello world\""
                };
                var response = await command.LambdaClient.InvokeAsync(invokeRequest);

                var payload = new StreamReader(response.Payload).ReadToEnd();
                Assert.Equal("\"HELLO WORLD\"", payload);

                var log = UTF8Encoding.UTF8.GetString(Convert.FromBase64String(response.LogResult));
                Assert.Contains("Memory Size: 320 MB", log);
            }
            finally
            {
                if (created)
                {
                    await command.LambdaClient.DeleteFunctionAsync(command.FunctionName);
                }
            }
        }
Пример #5
0
        public async Task TestMultiStageBuildWithSupportLibrary()
        {
            var assembly = this.GetType().GetTypeInfo().Assembly;

            var toolLogger = new TestToolLogger(_testOutputHelper);

            var fullPath = Path.GetFullPath(Path.GetDirectoryName(assembly.Location) + "../../../../../../testapps/ImageBasedProjects/MultiStageBuildWithClassLibraries/TheFunction");

            var functionName = "test-multistage-with-support-library-" + DateTime.Now.Ticks;

            var command = new DeployFunctionCommand(toolLogger, fullPath, new string[0]);

            command.FunctionName = functionName;
            command.Region       = TEST_REGION;
            command.Role         = await TestHelper.GetTestRoleArnAsync();

            command.DockerImageTag     = $"{TEST_ECR_REPOSITORY}:multistagetest";
            command.DisableInteractive = true;

            var created = await command.ExecuteAsync();

            try
            {
                Assert.True(created);

                toolLogger.ClearBuffer();


                var invokeCommand = new InvokeFunctionCommand(toolLogger, fullPath, new string[0]);
                invokeCommand.FunctionName = command.FunctionName;
                invokeCommand.Region       = TEST_REGION;

                await invokeCommand.ExecuteAsync();

                Assert.Contains("Hello from support library", toolLogger.Buffer);
            }
            finally
            {
                if (created)
                {
                    await command.LambdaClient.DeleteFunctionAsync(command.FunctionName);
                }
            }
        }
        public async Task RunDeployCommand()
        {
            var assembly = this.GetType().GetTypeInfo().Assembly;

            var fullPath = Path.GetFullPath(Path.GetDirectoryName(assembly.Location) + "../../../../../../testapps/TestFunction");
            var command  = new DeployFunctionCommand(new TestToolLogger(_testOutputHelper), fullPath, new string[0]);

            command.FunctionName = "test-function-" + DateTime.Now.Ticks;
            command.Handler      = "TestFunction::TestFunction.Function::ToUpper";
            command.Timeout      = 10;
            command.MemorySize   = 512;
            command.Role         = await TestHelper.GetTestRoleArnAsync();

            command.Configuration      = "Release";
            command.TargetFramework    = "netcoreapp2.1";
            command.Runtime            = "dotnetcore2.1";
            command.DisableInteractive = true;

            var created = await command.ExecuteAsync();

            try
            {
                Assert.True(created);

                var invokeRequest = new InvokeRequest
                {
                    FunctionName = command.FunctionName,
                    LogType      = LogType.Tail,
                    Payload      = "\"hello world\""
                };
                var response = await command.LambdaClient.InvokeAsync(invokeRequest);

                var payload = new StreamReader(response.Payload).ReadToEnd();
                Assert.Equal("\"HELLO WORLD\"", payload);
            }
            finally
            {
                if (created)
                {
                    await command.LambdaClient.DeleteFunctionAsync(command.FunctionName);
                }
            }
        }
Пример #7
0
        public async Task RunDeployCommand()
        {
            var mockClient = new Mock <IAmazonLambda>();

            mockClient.Setup(client => client.CreateFunctionAsync(It.IsAny <CreateFunctionRequest>(), It.IsAny <CancellationToken>()))
            .Callback <CreateFunctionRequest, CancellationToken>((request, token) =>
            {
                Assert.Single(request.Architectures);
                Assert.Equal(Architecture.Arm64, request.Architectures[0]);

                Assert.Equal("linux-arm64", GetRuntimeFromBundle(request.Code.ZipFile));
            })
            .Returns((CreateFunctionRequest r, CancellationToken token) =>
            {
                return(Task.FromResult(new CreateFunctionResponse()));
            });

            var assembly = this.GetType().GetTypeInfo().Assembly;

            var fullPath = Path.GetFullPath(Path.GetDirectoryName(assembly.Location) + "../../../../../../testapps/TestFunction");
            var command  = new DeployFunctionCommand(new TestToolLogger(_testOutputHelper), fullPath, new string[0]);

            command.FunctionName = "test-function-" + DateTime.Now.Ticks;
            command.Handler      = "TestFunction::TestFunction.Function::ToUpper";
            command.Timeout      = 10;
            command.MemorySize   = 512;
            command.Role         = await TestHelper.GetTestRoleArnAsync();

            command.Configuration      = "Release";
            command.TargetFramework    = "netcoreapp2.1";
            command.Runtime            = "dotnetcor2.1";
            command.Architecture       = LambdaConstants.ARCHITECTURE_ARM64;
            command.DisableInteractive = true;
            command.LambdaClient       = mockClient.Object;

            var created = await command.ExecuteAsync();

            Assert.True(created);
        }
        public async Task FixIssueOfDLQBeingCleared()
        {
            var sqsClient = new AmazonSQSClient(RegionEndpoint.USEast2);

            var queueUrl = (await sqsClient.CreateQueueAsync("lambda-test-" + DateTime.Now.Ticks)).QueueUrl;
            var queueArn = (await sqsClient.GetQueueAttributesAsync(queueUrl, new List <string> {
                "QueueArn"
            })).QueueARN;

            try
            {
                var assembly = this.GetType().GetTypeInfo().Assembly;

                var fullPath             = Path.GetFullPath(Path.GetDirectoryName(assembly.Location) + "../../../../../../testapps/TestFunction");
                var initialDeployCommand = new DeployFunctionCommand(new TestToolLogger(_testOutputHelper), fullPath, new string[0]);
                initialDeployCommand.FunctionName        = "test-function-" + DateTime.Now.Ticks;
                initialDeployCommand.Handler             = "TestFunction::TestFunction.Function::ToUpper";
                initialDeployCommand.Timeout             = 10;
                initialDeployCommand.MemorySize          = 512;
                initialDeployCommand.Role                = TestHelper.GetTestRoleArn();
                initialDeployCommand.Configuration       = "Release";
                initialDeployCommand.TargetFramework     = "netcoreapp1.0";
                initialDeployCommand.Runtime             = "dotnetcore1.0";
                initialDeployCommand.DeadLetterTargetArn = queueArn;
                initialDeployCommand.DisableInteractive  = true;


                var created = await initialDeployCommand.ExecuteAsync();

                try
                {
                    Assert.True(created);

                    var funcConfig = await initialDeployCommand.LambdaClient.GetFunctionConfigurationAsync(initialDeployCommand.FunctionName);

                    Assert.Equal(queueArn, funcConfig.DeadLetterConfig?.TargetArn);

                    var redeployCommand = new DeployFunctionCommand(new TestToolLogger(_testOutputHelper), fullPath, new string[0]);
                    redeployCommand.FunctionName       = initialDeployCommand.FunctionName;
                    redeployCommand.Configuration      = "Release";
                    redeployCommand.TargetFramework    = "netcoreapp1.0";
                    redeployCommand.Runtime            = "dotnetcore1.0";
                    redeployCommand.DisableInteractive = true;

                    var redeployed = await redeployCommand.ExecuteAsync();

                    Assert.True(redeployed);

                    funcConfig = await initialDeployCommand.LambdaClient.GetFunctionConfigurationAsync(initialDeployCommand.FunctionName);

                    Assert.Equal(queueArn, funcConfig.DeadLetterConfig?.TargetArn);

                    redeployCommand = new DeployFunctionCommand(new TestToolLogger(_testOutputHelper), fullPath, new string[0]);
                    redeployCommand.FunctionName        = initialDeployCommand.FunctionName;
                    redeployCommand.Configuration       = "Release";
                    redeployCommand.TargetFramework     = "netcoreapp1.0";
                    redeployCommand.Runtime             = "dotnetcore1.0";
                    redeployCommand.DeadLetterTargetArn = "";
                    redeployCommand.DisableInteractive  = true;

                    redeployed = await redeployCommand.ExecuteAsync();

                    Assert.True(redeployed);

                    funcConfig = await initialDeployCommand.LambdaClient.GetFunctionConfigurationAsync(initialDeployCommand.FunctionName);

                    Assert.Null(funcConfig.DeadLetterConfig?.TargetArn);
                }
                finally
                {
                    if (created)
                    {
                        await initialDeployCommand.LambdaClient.DeleteFunctionAsync(initialDeployCommand.FunctionName);
                    }
                }
            }
            finally
            {
                await sqsClient.DeleteQueueAsync(queueUrl);
            }
        }
Пример #9
0
        public async Task PackageFunctionAsLocalImageThenDeployWithDifferentECRTag()
        {
            var assembly = this.GetType().GetTypeInfo().Assembly;

            var toolLogger = new TestToolLogger(_testOutputHelper);

            var fullPath = Path.GetFullPath(Path.GetDirectoryName(assembly.Location) + "../../../../../../testapps/ImageBasedProjects/TestSimpleImageProject");

            var packageCommand = new PackageCommand(toolLogger, fullPath, new string[0]);

            packageCommand.Region             = TEST_REGION;
            packageCommand.DockerImageTag     = $"{TEST_ECR_REPOSITORY}:packageanddeploywithdifferenttags1";
            packageCommand.DisableInteractive = true;
            packageCommand.PackageType        = "image";

            var packageSuccess = await packageCommand.ExecuteAsync();

            Assert.True(packageSuccess);

            Assert.Contains($"Packaged project as image: \"{packageCommand.DockerImageTag}\"", toolLogger.Buffer);
            Assert.DoesNotContain("Pushing image to ECR repository", toolLogger.Buffer);

            var functionName = "test-package-then-deploy-differenttags-" + DateTime.Now.Ticks;

            toolLogger.ClearBuffer();
            var deployCommand = new DeployFunctionCommand(toolLogger, fullPath, new string[0]);

            deployCommand.FunctionName = functionName;
            deployCommand.Region       = TEST_REGION;
            deployCommand.Role         = await TestHelper.GetTestRoleArnAsync();

            deployCommand.LocalDockerImage   = packageCommand.DockerImageTag;
            deployCommand.DockerImageTag     = $"{TEST_ECR_REPOSITORY}:packageanddeploywithdifferenttags2";
            deployCommand.DisableInteractive = true;

            var deploySuccess = await deployCommand.ExecuteAsync();

            try
            {
                Assert.True(deploySuccess);
                Assert.DoesNotContain("docker build", toolLogger.Buffer);
                Assert.Contains($"{TEST_ECR_REPOSITORY}:packageanddeploywithdifferenttags2 Push Complete.", toolLogger.Buffer);

                toolLogger.ClearBuffer();
                var invokeCommand = new InvokeFunctionCommand(toolLogger, fullPath, new string[0]);
                invokeCommand.FunctionName = deployCommand.FunctionName;
                invokeCommand.Payload      = "hello world";
                invokeCommand.Region       = TEST_REGION;

                await invokeCommand.ExecuteAsync();

                // Make sure waiting works.
                Assert.Contains("... Waiting", toolLogger.Buffer);
                Assert.Contains("HELLO WORLD", toolLogger.Buffer);
            }
            finally
            {
                if (deploySuccess)
                {
                    await deployCommand.LambdaClient.DeleteFunctionAsync(deployCommand.FunctionName);
                }
            }
        }
Пример #10
0
        public async Task TestSimpleImageProjectTest()
        {
            var assembly = this.GetType().GetTypeInfo().Assembly;

            var toolLogger = new TestToolLogger(_testOutputHelper);

            var fullPath = Path.GetFullPath(Path.GetDirectoryName(assembly.Location) + "../../../../../../testapps/ImageBasedProjects/TestSimpleImageProject");

            var functionName = "test-simple-image-project-" + DateTime.Now.Ticks;

            var command = new DeployFunctionCommand(toolLogger, fullPath, new string[0]);

            command.FunctionName = functionName;
            command.Region       = TEST_REGION;
            command.Role         = await TestHelper.GetTestRoleArnAsync();

            command.DockerImageTag     = $"{TEST_ECR_REPOSITORY}:simpleimageproject1";
            command.DisableInteractive = true;

            var created = await command.ExecuteAsync();

            try
            {
                Assert.True(created);

                toolLogger.ClearBuffer();


                var invokeCommand = new InvokeFunctionCommand(toolLogger, fullPath, new string[0]);
                invokeCommand.FunctionName = command.FunctionName;
                invokeCommand.Payload      = "hello world";
                invokeCommand.Region       = TEST_REGION;

                await invokeCommand.ExecuteAsync();

                // Make sure waiting works.
                Assert.Contains("... Waiting", toolLogger.Buffer);
                Assert.Contains("HELLO WORLD", toolLogger.Buffer);


                // Update function without changing settings.
                toolLogger.ClearBuffer();
                var updateCommand = new DeployFunctionCommand(toolLogger, fullPath, new string[0]);
                updateCommand.FunctionName       = functionName;
                updateCommand.DisableInteractive = true;
                updateCommand.Region             = TEST_REGION;
                updateCommand.DockerImageTag     = $"{TEST_ECR_REPOSITORY}:simpleimageproject1";

                var updated = await updateCommand.ExecuteAsync();

                Assert.True(updated);

                Assert.DoesNotContain("... Waiting", toolLogger.Buffer);

                toolLogger.ClearBuffer();
                invokeCommand = new InvokeFunctionCommand(toolLogger, fullPath, new string[0]);
                invokeCommand.FunctionName = command.FunctionName;
                invokeCommand.Payload      = "hello world";
                invokeCommand.Region       = TEST_REGION;
                await invokeCommand.ExecuteAsync();

                Assert.Contains("HELLO WORLD", toolLogger.Buffer);



                // Update function with changed settings.
                toolLogger.ClearBuffer();
                updateCommand = new DeployFunctionCommand(toolLogger, fullPath, new string[0]);
                updateCommand.FunctionName       = functionName;
                updateCommand.MemorySize         = 1024;
                updateCommand.DockerImageTag     = $"{TEST_ECR_REPOSITORY}:simpleimageproject1";
                updateCommand.Region             = TEST_REGION;
                updateCommand.DisableInteractive = true;

                updated = await updateCommand.ExecuteAsync();

                Assert.True(updated);
                Assert.Contains("... Waiting", toolLogger.Buffer);


                toolLogger.ClearBuffer();
                invokeCommand = new InvokeFunctionCommand(toolLogger, fullPath, new string[0]);
                invokeCommand.FunctionName = command.FunctionName;
                invokeCommand.Payload      = "hello world";
                invokeCommand.Region       = TEST_REGION;
                await invokeCommand.ExecuteAsync();

                Assert.Contains("HELLO WORLD", toolLogger.Buffer);
            }
            finally
            {
                if (created)
                {
                    try
                    {
                        await command.LambdaClient.DeleteFunctionAsync(command.FunctionName);
                    }
                    catch { }
                }
            }
        }
Пример #11
0
        public async Task DeployFunctionWithLayer(string optDirectory)
        {
            var logger = new TestToolLogger(_testOutputHelper);

            var publishLayerCommand = await PublishLayerAsync(_singleLayerFunctionPath, optDirectory);

            try
            {
                Assert.NotNull(publishLayerCommand.NewLayerVersionArn);


                var deployCommand = new DeployFunctionCommand(new TestToolLogger(_testOutputHelper), _singleLayerFunctionPath, new string[0]);
                deployCommand.FunctionName = "test-layer-function-" + DateTime.Now.Ticks;
                deployCommand.Region       = publishLayerCommand.Region;
                deployCommand.Handler      = "TestLayerExample::TestLayerExample.Function::FunctionHandler";
                deployCommand.Timeout      = 10;
                deployCommand.MemorySize   = 512;
                deployCommand.Role         = await TestHelper.GetTestRoleArnAsync();

                deployCommand.Configuration      = "Release";
                deployCommand.TargetFramework    = "netcoreapp2.1";
                deployCommand.Runtime            = "dotnetcore2.1";
                deployCommand.LayerVersionArns   = new string[] { publishLayerCommand.NewLayerVersionArn };
                deployCommand.DisableInteractive = true;

                var created = await deployCommand.ExecuteAsync();

                try
                {
                    // See if we got back the return which proves we were able to load an assembly from the S3 NuGet package
                    // return new Amazon.S3.Model.ListBucketsRequest().ToString();
                    await ValidateInvokeAsync(deployCommand.FunctionName, "\"TEST\"", "\"Amazon.S3.Model.ListBucketsRequest\"");


                    var getConfigResponse = await this._testFixture.LambdaClient.GetFunctionConfigurationAsync(new GetFunctionConfigurationRequest { FunctionName = deployCommand.FunctionName });

                    Assert.NotNull(getConfigResponse.Layers.FirstOrDefault(x => string.Equals(x.Arn, publishLayerCommand.NewLayerVersionArn)));

                    var dotnetSharedSource = getConfigResponse.Environment.Variables[LambdaConstants.ENV_DOTNET_SHARED_STORE];
                    if (!string.IsNullOrEmpty(optDirectory))
                    {
                        Assert.Equal($"/opt/{optDirectory}/", dotnetSharedSource);
                    }
                    else
                    {
                        Assert.Equal($"/opt/{LambdaConstants.DEFAULT_LAYER_OPT_DIRECTORY}/", dotnetSharedSource);
                    }

                    var getCodeResponse = await this._testFixture.LambdaClient.GetFunctionAsync(deployCommand.FunctionName);

                    using (var client = new HttpClient())
                    {
                        var data = await client.GetByteArrayAsync(getCodeResponse.Code.Location);

                        var zipArchive = new ZipArchive(new MemoryStream(data), ZipArchiveMode.Read);

                        Assert.NotNull(zipArchive.GetEntry("TestLayerExample.dll"));
                        Assert.Null(zipArchive.GetEntry("Amazon.Lambda.Core.dll"));
                        Assert.Null(zipArchive.GetEntry("AWSSDK.S3.dll"));
                    }

                    var redeployLayerCommand = await PublishLayerAsync(_singleLayerFunctionPath, optDirectory);

                    var redeployFunctionCommand = new DeployFunctionCommand(new TestToolLogger(_testOutputHelper), _singleLayerFunctionPath, new string[0]);
                    redeployFunctionCommand.FunctionName       = deployCommand.FunctionName;
                    redeployFunctionCommand.Region             = deployCommand.Region;
                    redeployFunctionCommand.Handler            = deployCommand.Handler;
                    redeployFunctionCommand.Timeout            = deployCommand.Timeout;
                    redeployFunctionCommand.MemorySize         = deployCommand.MemorySize;
                    redeployFunctionCommand.Role               = deployCommand.Role;
                    redeployFunctionCommand.Configuration      = deployCommand.Configuration;
                    redeployFunctionCommand.TargetFramework    = deployCommand.TargetFramework;
                    redeployFunctionCommand.Runtime            = deployCommand.Runtime;
                    redeployFunctionCommand.LayerVersionArns   = new string[] { redeployLayerCommand.NewLayerVersionArn };
                    redeployFunctionCommand.DisableInteractive = true;

                    if (!await redeployFunctionCommand.ExecuteAsync())
                    {
                        throw redeployFunctionCommand.LastToolsException;
                    }

                    await ValidateInvokeAsync(redeployFunctionCommand.FunctionName, "\"TEST\"", "\"Amazon.S3.Model.ListBucketsRequest\"");
                }
                finally
                {
                    await this._testFixture.LambdaClient.DeleteFunctionAsync(new DeleteFunctionRequest { FunctionName = deployCommand.FunctionName });
                }
            }
            finally
            {
                await this._testFixture.LambdaClient.DeleteLayerVersionAsync(new DeleteLayerVersionRequest { LayerName = publishLayerCommand.NewLayerArn, VersionNumber = publishLayerCommand.NewLayerVersionNumber });
            }
        }