Beispiel #1
0
        public async Task DeployGamePopulatesDeploymentModeAsync(
            [Values(DeployOnLaunchSetting.DELTA, DeployOnLaunchSetting.ALWAYS)]
            DeployOnLaunchSetting value, [Values] bool commandSucceeds)
        {
            string        localPath = GetLocalPath();
            IAsyncProject project   = GetProjectWithLocalPathAndDeployMode(localPath, value);

            (SshTarget target, IAction action, ICancelable cancelable) = GetDeploymentArguments();
            (_, IRemoteCommand command, IRemoteDeploy deploy, _)       = GetTestObjects();

            if (!commandSucceeds)
            {
                command.RunWithSuccessAsync(Arg.Any <SshTarget>(), Arg.Any <string>())
                .Returns(_ => throw new ProcessException(_chmodFailed));
            }

            try
            {
                await deploy.DeployGameExecutableAsync(project, target, cancelable, action);
            }
            catch (DeployException)
            {
                Assert.IsFalse(commandSucceeds);
            }

            CopyBinaryData actionEvent = action.GetEvent().CopyExecutable;

            Assert.That(actionEvent.DeploymentMode,
                        Is.EqualTo(CopyBinaryType.Types.DeploymentMode.GgpRsync));
        }
Beispiel #2
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);
            });
        }
Beispiel #3
0
        public async Task DeployGameSetToNeverDoesNotPopulateDeploymentModeAsync()
        {
            string        localPath = GetLocalPath();
            IAsyncProject project   = GetProjectWithLocalPathAndDeployMode(localPath,
                                                                           DeployOnLaunchSetting.FALSE);

            (SshTarget target, IAction action, ICancelable cancelable) = GetDeploymentArguments();
            (_, _, IRemoteDeploy deploy, _) = GetTestObjects();

            await deploy.DeployGameExecutableAsync(project, target, cancelable, action);

            CopyBinaryData actionEvent = action.GetEvent().CopyExecutable;

            Assert.That(actionEvent.DeploymentMode, Is.Null);
        }
Beispiel #4
0
        public async Task DeployGamePopulatesSignatureCheckModeAsync(
            DeployOnLaunchSetting deploySetting,
            BinarySignatureCheck.Types.Result signatureCheck)
        {
            string        localPath = GetLocalPath();
            IAsyncProject project   = GetProjectWithLocalPathAndDeployMode(localPath, deploySetting);

            (SshTarget target, IAction action, ICancelable cancelable) = GetDeploymentArguments();
            (_, _, IRemoteDeploy deploy, _) = GetTestObjects();

            await deploy.DeployGameExecutableAsync(project, target, cancelable, action);

            CopyBinaryData actionEvent = action.GetEvent().CopyExecutable;

            Assert.That(actionEvent.SignatureCheckResult, Is.EqualTo(signatureCheck));
        }
Beispiel #5
0
        public async Task DeployLldbServerPopulatesActionEventOnSuccessAsync()
        {
            (SshTarget target, IAction action, var _) = GetDeploymentArguments();
            (_, _, RemoteDeploy deploy, _)            = GetTestObjects();

            await deploy.DeployLldbServerAsync(target, action);

            Assert.Multiple(() =>
            {
                CopyBinaryData actionEvent = action.GetEvent().CopyLldbServer;
                Assert.NotNull(actionEvent);
                Assert.NotNull(actionEvent.CopyBinaryBytes);
                Assert.IsTrue(actionEvent.CopyAttempted);
                Assert.That(actionEvent.CopyExitCode, Is.EqualTo(0));
                Assert.That(actionEvent.SshChmodExitCode, Is.EqualTo(0));
            });
        }
Beispiel #6
0
            void RecordData(CopyBinaryData copyBinaryData)
            {
                switch (_file)
                {
                case File.GAME_EXECUTABLE:
                    _action.UpdateEvent(new DeveloperLogEvent
                    {
                        CopyExecutable = copyBinaryData
                    });
                    break;

                case File.LLDB_SERVER:
                    _action.UpdateEvent(new DeveloperLogEvent
                    {
                        CopyLldbServer = copyBinaryData
                    });
                    break;
                }
            }
Beispiel #7
0
        public async Task DeployGameExecutablePopulatesActionEventOnSuccessAsync(
            [Values(DeployOnLaunchSetting.DELTA, DeployOnLaunchSetting.ALWAYS)]
            DeployOnLaunchSetting value)
        {
            string        localPath = GetLocalPath();
            IAsyncProject project   = GetProjectWithLocalPathAndDeployMode(localPath, value);

            (SshTarget target, IAction action, ICancelable cancelable) = GetDeploymentArguments();
            (_, _, IRemoteDeploy deploy, _) = GetTestObjects();
            await deploy.DeployGameExecutableAsync(project, target, cancelable, action);

            Assert.Multiple(() =>
            {
                CopyBinaryData actionEvent = action.GetEvent().CopyExecutable;
                Assert.NotNull(actionEvent);
                Assert.NotNull(actionEvent.CopyBinaryBytes);
                Assert.IsTrue(actionEvent.CopyAttempted);
                Assert.That(actionEvent.CopyExitCode, Is.EqualTo(0));
                Assert.That(actionEvent.SshChmodExitCode, Is.EqualTo(0));
            });
        }
Beispiel #8
0
        public void DeployLldbServerPopulatesActionEventOnFailureInSettingExecutableBit()
        {
            (SshTarget target, IAction action, var _)           = GetDeploymentArguments();
            (_, IRemoteCommand command, RemoteDeploy deploy, _) = GetTestObjects();
            command.RunWithSuccessAsync(Arg.Any <SshTarget>(), Arg.Any <string>())
            .Returns(_ => throw new ProcessException(_chmodFailed));

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

            Assert.Multiple(() =>
            {
                string expectedError =
                    ErrorStrings.FailedToSetExecutablePermissions(_chmodFailed);
                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(0));
                Assert.That(actionEvent.SshChmodExitCode, Is.EqualTo(-1));
            });
        }
Beispiel #9
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));
            });
        }