public void EnableRemoteDesktopForWebAndWorkerRoles() { using (FileSystemHelper files = new FileSystemHelper(this)) { files.CreateAzureSdkDirectoryAndImportPublishSettings(); string rootPath = files.CreateNewService("NEW_SERVICE"); addNodeWebCmdlet = new AddAzureNodeWebRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime, Name = "WebRole", Instances = 1 }; addNodeWebCmdlet.ExecuteCmdlet(); addNodeWorkerCmdlet = new AddAzureNodeWorkerRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime, Name = "WorkerRole", Instances = 1 }; addNodeWorkerCmdlet.ExecuteCmdlet(); mockCommandRuntime.ResetPipelines(); EnableRemoteDesktop("user", "GoodPassword!"); // Verify the roles have been setup with forwarding, access, // and certs CloudServiceProject service = new CloudServiceProject(rootPath, FileUtilities.GetContentFilePath("Services")); VerifyWebRole(service.Components.Definition.WebRole[0], false); VerifyWorkerRole(service.Components.Definition.WorkerRole[0], true); VerifyRoleSettings(service); Assert.Equal <int>(0, mockCommandRuntime.OutputPipeline.Count); } }
public void AddAzurePythonWebRoleProcess() { var pyInstall = AddAzureDjangoWebRoleCommand.FindPythonInterpreterPath(); if (pyInstall == null) { Assert.Inconclusive("Python is not installed on this machine and therefore the Python tests cannot be run"); return; } string stdOut, stdErr; ProcessHelper.StartAndWaitForProcess( new ProcessStartInfo( Path.Combine(pyInstall, "python.exe"), String.Format("-m django.bin.django-admin") ), out stdOut, out stdErr ); if (stdOut.IndexOf("django-admin.py") == -1) { Assert.Inconclusive("Django is not installed on this machine and therefore the Python tests cannot be run"); return; } using (FileSystemHelper files = new FileSystemHelper(this)) { string roleName = "WebRole1"; string serviceName = "AzureService"; string rootPath = files.CreateNewService(serviceName); addPythonWebCmdlet = new AddAzureDjangoWebRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime }; addPythonWebCmdlet.CommandRuntime = mockCommandRuntime; string expectedVerboseMessage = string.Format(Resources.AddRoleMessageCreatePython, rootPath, roleName); mockCommandRuntime.ResetPipelines(); addPythonWebCmdlet.ExecuteCmdlet(); AzureAssert.ScaffoldingExists(Path.Combine(rootPath, roleName), Path.Combine(Resources.PythonScaffolding, Resources.WebRole)); Assert.AreEqual <string>(roleName, ((PSObject)mockCommandRuntime.OutputPipeline[0]).GetVariableValue <string>(Parameters.RoleName)); Assert.AreEqual <string>(expectedVerboseMessage, mockCommandRuntime.VerboseStream[0]); Assert.IsTrue(Directory.Exists(Path.Combine(rootPath, roleName, roleName))); Assert.IsTrue(File.Exists(Path.Combine(rootPath, roleName, roleName, "manage.py"))); Assert.IsTrue(Directory.Exists(Path.Combine(rootPath, roleName, roleName, roleName))); Assert.IsTrue(File.Exists(Path.Combine(rootPath, roleName, roleName, roleName, "__init__.py"))); Assert.IsTrue(File.Exists(Path.Combine(rootPath, roleName, roleName, roleName, "settings.py"))); Assert.IsTrue(File.Exists(Path.Combine(rootPath, roleName, roleName, roleName, "urls.py"))); Assert.IsTrue(File.Exists(Path.Combine(rootPath, roleName, roleName, roleName, "wsgi.py"))); } }
public void EnableAzureMemcacheRoleProcess() { using (FileSystemHelper files = new FileSystemHelper(this)) { string serviceName = "AzureService"; string rootPath = files.CreateNewService(serviceName); string cacheRoleName = "WorkerRole"; string webRoleName = "WebRole"; string expectedMessage = string.Format(Resources.EnableMemcacheMessage, webRoleName, cacheRoleName, Resources.MemcacheEndpointPort); addNodeWebCmdlet = new AddAzureNodeWebRoleCommand() { RootPath = rootPath, CommandRuntime = mockCommandRuntime, Name = webRoleName }; addNodeWebCmdlet.ExecuteCmdlet(); addCacheRoleCmdlet.AddAzureCacheWorkerRoleProcess(cacheRoleName, 1, rootPath); mockCommandRuntime.ResetPipelines(); enableCacheCmdlet.PassThru = true; enableCacheCmdlet.CacheRuntimeVersion = "2.0.0"; enableCacheCmdlet.EnableAzureMemcacheRoleProcess(webRoleName, cacheRoleName, rootPath); AssertCachingEnabled(files, serviceName, rootPath, webRoleName, expectedMessage); } }