Beispiel #1
0
        public void init()
        {
            var s = Properties.Settings.Default;

            using (hypervisor_vmware hyp = new hypervisor_vmware(new hypSpec_vmware(
                                                                     s.NASVMName, s.NASVMServerHostname, s.NASVMServerUsername, s.NASVMServerPassword,
                                                                     nasusername, naspassword,
                                                                     "clean", null, 0, null, nashostname), clientExecutionMethod.SSHToBASH))
            {
                // Restore the FreeNAS VM to a known-good state, power it on, and wait for it to boot.
                hyp.powerOff();
                hyp.restoreSnapshot();
                hyp.powerOn();

                // Wait until boot has finished (this isn't a great way of checking, but oh well)
                while (true)
                {
                    executionResult cronStatus = hyp.startExecutable("service", "cron status");
                    if (cronStatus.resultCode == 0)
                    {
                        break;
                    }
                    Thread.Sleep(TimeSpan.FromSeconds(2));
                }

                var aa = hyp.startExecutable("service", "collectd stop");
                var bb = hyp.startExecutable("service", "syslog-ng stop");

                hyp.patchFreeNASInstallation();
            }
        }
 public static void doWorkingDirTest(clientExecutionMethod exec, string newWorkingDir)
 {
     using (hypervisor_vmware hyp = machinePools.vmware.createHypervisorForNextFreeVMOrWait(execType: exec))
     {
         prepVM(hyp);
         executionResult res = hyp.startExecutable("cmd /c", "cd", newWorkingDir);
         Assert.AreEqual(newWorkingDir + "\r\n", res.stdout);
     }
 }
 public static void doExecTest(clientExecutionMethod exec)
 {
     using (hypervisor_vmware hyp = machinePools.vmware.createHypervisorForNextFreeVMOrWait(execType: exec))
     {
         prepVM(hyp);
         executionResult res = hyp.startExecutable("cmd.exe", "/c echo This is a test&&echo and stderr 1>&2 && exit /b 1234");
         Assert.AreEqual("This is a test\r\n", res.stdout);
         Assert.AreEqual("and stderr  \r\n", res.stderr);
         Assert.AreEqual(1234, res.resultCode);
     }
 }