From 7de6420174b028dd3fd16ac1f3aa4efb1e6be7ef Mon Sep 17 00:00:00 2001 From: Tejas Deshpande Date: Tue, 14 Mar 2017 14:50:05 +0530 Subject: [PATCH] Uncommenting L0 tests; were commented earlier by mistake (#3731) * Unconnenting L0 tests * Few changes for L0 tests --- .../Tests/EnablePrereq.ts | 2 ++ Tasks/AzureResourceGroupDeployment/Tests/L0.ts | 6 +++--- .../Tests/VMOperations.ts | 2 ++ .../Tests/createOrUpdate.ts | 2 ++ .../Tests/deleteResourceGroup.ts | 2 ++ .../lib/operations/virtualMachines.js | 14 +++++++------- .../Tests/selectResourceGroup.ts | 2 ++ 7 files changed, 20 insertions(+), 10 deletions(-) diff --git a/Tasks/AzureResourceGroupDeployment/Tests/EnablePrereq.ts b/Tasks/AzureResourceGroupDeployment/Tests/EnablePrereq.ts index 383ea1c9be65..f7f466cd0742 100644 --- a/Tasks/AzureResourceGroupDeployment/Tests/EnablePrereq.ts +++ b/Tasks/AzureResourceGroupDeployment/Tests/EnablePrereq.ts @@ -19,6 +19,8 @@ tr.setInput("csmParametersFile", path.join(__dirname, "CSM.json")); process.env["ENDPOINT_AUTH_AzureRM"] = "{\"parameters\":{\"serviceprincipalid\":\"id\",\"serviceprincipalkey\":\"key\",\"tenantid\":\"tenant\"},\"scheme\":\"ServicePrincipal\"}"; process.env["ENDPOINT_DATA_AzureRM_SUBSCRIPTIONID"] = "sId"; process.env["ENDPOINT_DATA_AzureRM_SUBSCRIPTIONNAME"] = "sName"; +process.env["ENDPOINT_URL_AzureRM"] = "https://management.azure.com/"; +process.env["ENDPOINT_DATA_AzureRM_ENVIRONMENTAUTHORITYURL"] = "https://login.windows.net/"; tr.registerMock('vsts-task-lib/toolrunner', require('vsts-task-lib/mock-toolrunner')); tr.registerMock('./azure-rest/azure-arm-compute', require('./mock_node_modules/azure-arm-compute')); diff --git a/Tasks/AzureResourceGroupDeployment/Tests/L0.ts b/Tasks/AzureResourceGroupDeployment/Tests/L0.ts index 78c52324abd4..d0b90a1ed43b 100644 --- a/Tasks/AzureResourceGroupDeployment/Tests/L0.ts +++ b/Tasks/AzureResourceGroupDeployment/Tests/L0.ts @@ -372,7 +372,7 @@ describe('Azure Resource Group Deployment', function () { done(error); } }); - /*it('Successfully triggered createOrUpdate deployment', (done) => { + it('Successfully triggered createOrUpdate deployment', (done) => { let tp = path.join(__dirname, 'createOrUpdate.js'); process.env["csmFile"] = "CSM.json"; process.env["csmParametersFile"] = "CSM.json"; @@ -558,7 +558,7 @@ describe('Azure Resource Group Deployment', function () { assert(tr.stdout.indexOf("Enabling winrm for virtual machine") > 0, "Should add Custom Script Extension to the virual machine"); assert(tr.stdout.indexOf("virtualMachineExtensions.get is called on vm customVM") > 0, "Should try getting the extension on the virtual machine"); assert(tr.stdout.indexOf("virtualMachineExtensions.createOrUpdate is called") > 0, "Should call createOrUpdate of virtual Machine extensions"); - assert(tr.stdout.indexOf("Addition of extension completed for vmcustomVM") > 0, "Should be able to add the extension"); + assert(tr.stdout.indexOf("Addition of extension completed for vm: customVM") > 0, "Should be able to add the extension"); assert(tr.stdout.indexOf("Provisioning of CustomScriptExtension on vm customVM is in Succeeded State") > 0, "Provisioning of the Custom Script Extension should be in succeeded state"); assert(tr.stdout.indexOf("Trying to add a network security group rule") <= 0, "Shouldn't try adding NSG rule"); done(); @@ -975,5 +975,5 @@ describe('Azure Resource Group Deployment', function () { console.log("STDOUT", tr.stdout); done(error); } - });*/ + }); }); diff --git a/Tasks/AzureResourceGroupDeployment/Tests/VMOperations.ts b/Tasks/AzureResourceGroupDeployment/Tests/VMOperations.ts index 0eb906eab80d..202cbe04b215 100644 --- a/Tasks/AzureResourceGroupDeployment/Tests/VMOperations.ts +++ b/Tasks/AzureResourceGroupDeployment/Tests/VMOperations.ts @@ -12,6 +12,8 @@ tr.setInput("resourceGroupName", "dummy"); process.env[ "ENDPOINT_AUTH_AzureRM"] = "{\"parameters\":{\"serviceprincipalid\":\"id\",\"serviceprincipalkey\":\"key\",\"tenantid\":\"tenant\"},\"scheme\":\"ServicePrincipal\"}"; process.env["ENDPOINT_DATA_AzureRM_SUBSCRIPTIONID"] = "sId"; process.env["ENDPOINT_DATA_AzureRM_SUBSCRIPTIONNAME"] = "sName"; +process.env["ENDPOINT_URL_AzureRM"] = "https://management.azure.com/"; +process.env["ENDPOINT_DATA_AzureRM_ENVIRONMENTAUTHORITYURL"] = "https://login.windows.net/"; tr.registerMock('vsts-task-lib/toolrunner', require('vsts-task-lib/mock-toolrunner')); tr.registerMock('./azure-rest/azure-arm-compute', require('./mock_node_modules/azure-arm-compute')); diff --git a/Tasks/AzureResourceGroupDeployment/Tests/createOrUpdate.ts b/Tasks/AzureResourceGroupDeployment/Tests/createOrUpdate.ts index 68c72c8331d9..ac794e1a2ee8 100644 --- a/Tasks/AzureResourceGroupDeployment/Tests/createOrUpdate.ts +++ b/Tasks/AzureResourceGroupDeployment/Tests/createOrUpdate.ts @@ -19,6 +19,8 @@ tr.setInput("csmParametersFile", path.join(__dirname, process.env["csmParameters process.env[ "ENDPOINT_AUTH_AzureRM"] = "{\"parameters\":{\"serviceprincipalid\":\"id\",\"serviceprincipalkey\":\"key\",\"tenantid\":\"tenant\"},\"scheme\":\"ServicePrincipal\"}"; process.env["ENDPOINT_DATA_AzureRM_SUBSCRIPTIONID"] = "sId"; process.env["ENDPOINT_DATA_AzureRM_SUBSCRIPTIONNAME"] = "sName"; +process.env["ENDPOINT_URL_AzureRM"] = "https://management.azure.com/"; +process.env["ENDPOINT_DATA_AzureRM_ENVIRONMENTAUTHORITYURL"] = "https://login.windows.net/"; tr.registerMock('vsts-task-lib/toolrunner', require('vsts-task-lib/mock-toolrunner')); tr.registerMock('./azure-rest/azure-arm-resource', require('./mock_node_modules/azure-arm-resource')); diff --git a/Tasks/AzureResourceGroupDeployment/Tests/deleteResourceGroup.ts b/Tasks/AzureResourceGroupDeployment/Tests/deleteResourceGroup.ts index e2697f3d294b..195a91c09284 100644 --- a/Tasks/AzureResourceGroupDeployment/Tests/deleteResourceGroup.ts +++ b/Tasks/AzureResourceGroupDeployment/Tests/deleteResourceGroup.ts @@ -12,6 +12,8 @@ tr.setInput("resourceGroupName", "dummy"); process.env[ "ENDPOINT_AUTH_AzureRM"] = "{\"parameters\":{\"serviceprincipalid\":\"id\",\"serviceprincipalkey\":\"key\",\"tenantid\":\"tenant\"},\"scheme\":\"ServicePrincipal\"}"; process.env["ENDPOINT_DATA_AzureRM_SUBSCRIPTIONID"] = "sId"; process.env["ENDPOINT_DATA_AzureRM_SUBSCRIPTIONNAME"] = "sName"; +process.env["ENDPOINT_URL_AzureRM"] = "https://management.azure.com/"; +process.env["ENDPOINT_DATA_AzureRM_ENVIRONMENTAUTHORITYURL"] = "https://login.windows.net/"; tr.registerMock('vsts-task-lib/toolrunner', require('vsts-task-lib/mock-toolrunner')); tr.registerMock('./azure-rest/azure-arm-resource', require('./mock_node_modules/azure-arm-resource')); diff --git a/Tasks/AzureResourceGroupDeployment/Tests/mock_node_modules/azure-arm-compute/lib/operations/virtualMachines.js b/Tasks/AzureResourceGroupDeployment/Tests/mock_node_modules/azure-arm-compute/lib/operations/virtualMachines.js index 7255a794cad9..566a01047f1b 100644 --- a/Tasks/AzureResourceGroupDeployment/Tests/mock_node_modules/azure-arm-compute/lib/operations/virtualMachines.js +++ b/Tasks/AzureResourceGroupDeployment/Tests/mock_node_modules/azure-arm-compute/lib/operations/virtualMachines.js @@ -181,7 +181,7 @@ VirtualMachines.prototype.get = (resourceGroupName, vmName, options, callback) = { "extensions": [ { - "name": "CustomScriptExtension", + "name": "WinRMCustomScriptExtension", "substatuses": [ { @@ -200,13 +200,13 @@ VirtualMachines.prototype.get = (resourceGroupName, vmName, options, callback) = }; if (resourceGroupName.includes("InvalidSubstatus")) { result = { - "name": "CustomScriptExtension", + "name": "WinRMCustomScriptExtension", properties: { "instanceView": { "extensions": [ { - "name": "CustomScriptExtension", + "name": "WinRMCustomScriptExtension", "substatuses": [ { @@ -222,13 +222,13 @@ VirtualMachines.prototype.get = (resourceGroupName, vmName, options, callback) = } if (resourceGroupName.includes("StoppedVM")) { result = { - "name": "CustomScriptExtension", + "name": "WinRMCustomScriptExtension", properties: { "instanceView": { "extensions": [ { - "name": "CustomScriptExtension", + "name": "WinRMCustomScriptExtension", } ], "statuses": @@ -243,13 +243,13 @@ VirtualMachines.prototype.get = (resourceGroupName, vmName, options, callback) = } if (resourceGroupName.includes("TransitioningVM")) { result = { - "name": "CustomScriptExtension", + "name": "WinRMCustomScriptExtension", properties: { "instanceView": { "extensions": [ { - "name": "CustomScriptExtension", + "name": "WinRMCustomScriptExtension", }], "statuses": [ diff --git a/Tasks/AzureResourceGroupDeployment/Tests/selectResourceGroup.ts b/Tasks/AzureResourceGroupDeployment/Tests/selectResourceGroup.ts index 637bd283e00b..4358d9dfd64a 100644 --- a/Tasks/AzureResourceGroupDeployment/Tests/selectResourceGroup.ts +++ b/Tasks/AzureResourceGroupDeployment/Tests/selectResourceGroup.ts @@ -14,6 +14,8 @@ tr.setInput("enableDeploymentPrerequisites", "None"); process.env[ "ENDPOINT_AUTH_AzureRM"] = "{\"parameters\":{\"serviceprincipalid\":\"id\",\"serviceprincipalkey\":\"key\",\"tenantid\":\"tenant\"},\"scheme\":\"ServicePrincipal\"}"; process.env["ENDPOINT_DATA_AzureRM_SUBSCRIPTIONID"] = "sId"; process.env["ENDPOINT_DATA_AzureRM_SUBSCRIPTIONNAME"] = "sName"; +process.env["ENDPOINT_URL_AzureRM"] = "https://management.azure.com/"; +process.env["ENDPOINT_DATA_AzureRM_ENVIRONMENTAUTHORITYURL"] = "https://login.windows.net/"; tr.registerMock('vsts-task-lib/toolrunner', require('vsts-task-lib/mock-toolrunner')); tr.registerMock('./azure-rest/azure-arm-resource', require('./mock_node_modules/azure-arm-resource'));