Exemplo n.º 1
0
        public void DeployGameExecutablePopulatesActionEventOnFailureInDeployment(
            [Values(DeployOnLaunchSetting.DELTA, DeployOnLaunchSetting.ALWAYS)]
            DeployOnLaunchSetting value)
        {
            string        localPath = GetLocalPath();
            IAsyncProject project   = GetProjectWithLocalPathAndDeployMode(localPath, value);

            (SshTarget target, IAction action, ICancelable cancelable) = GetDeploymentArguments();
            (IRemoteFile file, _, IRemoteDeploy deploy, _)             = GetTestObjects();
            file
            .SyncAsync(Arg.Any <SshTarget>(), Arg.Any <string>(), Arg.Any <string>(),
                       Arg.Any <ICancelable>(), Arg.Any <bool>())
            .Returns <Task>(_ => throw new ProcessException(_rsyncFailed));

            var error = Assert.ThrowsAsync <DeployException>(
                async() =>
                await deploy.DeployGameExecutableAsync(
                    project, target, cancelable, action));

            Assert.Multiple(() =>
            {
                string expectedError = ErrorStrings.FailedToDeployExecutable(_rsyncFailed);
                Assert.That(error.Message, Is.EqualTo(expectedError));
                CopyBinaryData actionEvent = action.GetEvent().CopyExecutable;
                Assert.NotNull(actionEvent);
                Assert.NotNull(actionEvent.CopyBinaryBytes);
                Assert.IsTrue(actionEvent.CopyAttempted);
                Assert.That(actionEvent.CopyExitCode, Is.EqualTo(-1));
                Assert.IsNull(actionEvent.SshChmodExitCode);
            });
        }
Exemplo n.º 2
0
        public void DeployLldbServerPopulatesActionEventOnFailureInDeployment()
        {
            (SshTarget target, IAction action, var _)     = GetDeploymentArguments();
            (IRemoteFile file, _, RemoteDeploy deploy, _) = GetTestObjects();
            file
            .SyncAsync(Arg.Any <SshTarget>(), Arg.Any <string>(), Arg.Any <string>(),
                       Arg.Any <ICancelable>(), Arg.Any <bool>())
            .Returns(_ => throw new ProcessException(_rsyncFailed));

            var error = Assert.ThrowsAsync <DeployException>(
                async() => await deploy.DeployLldbServerAsync(target, action));

            Assert.Multiple(() =>
            {
                string expectedError = ErrorStrings.FailedToDeployExecutable(_rsyncFailed);
                Assert.That(error.Message, Is.EqualTo(expectedError));
                CopyBinaryData actionEvent = action.GetEvent().CopyLldbServer;
                Assert.NotNull(actionEvent);
                Assert.NotNull(actionEvent.CopyBinaryBytes);
                Assert.IsTrue(actionEvent.CopyAttempted);
                Assert.That(actionEvent.CopyExitCode, Is.EqualTo(-1));
                Assert.That(actionEvent.SshChmodExitCode, Is.EqualTo(null));
            });
        }