@@ -1012,7 +1012,6 @@ public void AzureServiceDiagnosticsExtensionConfigScenarioTest()
1012
1012
[ Ignore ]
1013
1013
public void AzureServiceDiagnosticsExtensionTest ( )
1014
1014
{
1015
-
1016
1015
StartTest ( MethodBase . GetCurrentMethod ( ) . Name , testStartTime ) ;
1017
1016
1018
1017
// Choose the package and config files from local machine
@@ -1064,6 +1063,77 @@ public void AzureServiceDiagnosticsExtensionTest()
1064
1063
pass &= Utilities . CheckRemove ( vmPowershellCmdlets . GetAzureDeployment , serviceName , DeploymentSlotType . Production ) ;
1065
1064
}
1066
1065
1066
+ [ TestMethod ( ) , TestCategory ( Category . Scenario ) , TestProperty ( "Feature" , "PAAS" ) , Priority ( 1 ) , Owner ( "hylee" ) , Description ( "Test the cmdlet ((Get,Set,Remove)-AzureServiceRemoteDesktopExtension)" ) ]
1067
+ [ DataSource ( "Microsoft.VisualStudio.TestTools.DataSource.CSV" , "|DataDirectory|\\ Resources\\ nodiagpackage.csv" , "nodiagpackage#csv" , DataAccessMethod . Sequential ) ]
1068
+ [ Ignore ]
1069
+ public void VipSwapWithDiagnosticsExtensionTest ( )
1070
+ {
1071
+ StartTest ( MethodBase . GetCurrentMethod ( ) . Name , testStartTime ) ;
1072
+
1073
+ // Choose the package and config files from local machine
1074
+ string packageName = Convert . ToString ( TestContext . DataRow [ "packageName" ] ) ;
1075
+ string configName = Convert . ToString ( TestContext . DataRow [ "configName" ] ) ;
1076
+ var packagePath = new FileInfo ( Directory . GetCurrentDirectory ( ) + "\\ " + packageName ) ;
1077
+ var configPath = new FileInfo ( Directory . GetCurrentDirectory ( ) + "\\ " + configName ) ;
1078
+
1079
+ Assert . IsTrue ( File . Exists ( packagePath . FullName ) , "Package file not exist={0}" , packagePath ) ;
1080
+ Assert . IsTrue ( File . Exists ( configPath . FullName ) , "Config file not exist={0}" , configPath ) ;
1081
+
1082
+ string deploymentName = "deployment1" ;
1083
+ string deploymentLabel = "label1" ;
1084
+ DeploymentInfoContext result ;
1085
+
1086
+ string storage = defaultAzureSubscription . CurrentStorageAccountName ;
1087
+ string daConfig = @"da.xml" ;
1088
+
1089
+ string storageKey = vmPowershellCmdlets . GetAzureStorageAccountKey ( storage ) . Primary ;
1090
+ StorageCredentials creds = new StorageCredentials ( storage , storageKey ) ;
1091
+ CloudStorageAccount csa = new WindowsAzure . Storage . CloudStorageAccount ( creds , true ) ;
1092
+ var storageContext = new AzureStorageContext ( csa ) ;
1093
+
1094
+ serviceName = Utilities . GetUniqueShortName ( serviceNamePrefix ) ;
1095
+ vmPowershellCmdlets . NewAzureService ( serviceName , serviceName , locationName ) ;
1096
+ Console . WriteLine ( "service, {0}, is created." , serviceName ) ;
1097
+
1098
+ // deploy staging
1099
+ vmPowershellCmdlets . NewAzureDeployment ( serviceName , packagePath . FullName , configPath . FullName , DeploymentSlotType . Staging , deploymentLabel , deploymentName , false , false ) ;
1100
+ result = vmPowershellCmdlets . GetAzureDeployment ( serviceName , DeploymentSlotType . Staging ) ;
1101
+ pass = Utilities . PrintAndCompareDeployment ( result , serviceName , deploymentName , deploymentLabel , DeploymentSlotType . Staging , null , 2 ) ;
1102
+ Console . WriteLine ( "successfully deployed the package" ) ;
1103
+
1104
+ vmPowershellCmdlets . SetAzureServiceDiagnosticsExtension ( serviceName , storageContext , daConfig , null , slot : DeploymentSlotType . Staging ) ;
1105
+ DiagnosticExtensionContext resultContext = vmPowershellCmdlets . GetAzureServiceDiagnosticsExtension ( serviceName , slot : DeploymentSlotType . Staging ) [ 0 ] ;
1106
+ VerifyDiagExtContext ( resultContext , "AllRoles" , "Default-PaaSDiagnostics-Staging-Ext-0" , storage , daConfig ) ;
1107
+
1108
+ // swap staging -> production
1109
+ // production will be retain diagnosting config from staging, named Default-PaaSDiagnostics-Staging-Ext-0
1110
+ vmPowershellCmdlets . MoveAzureDeployment ( serviceName ) ;
1111
+
1112
+ // deploy a new staging
1113
+ deploymentName = "deployment2" ;
1114
+ deploymentLabel = "label2" ;
1115
+
1116
+ vmPowershellCmdlets . NewAzureDeployment ( serviceName , packagePath . FullName , configPath . FullName , DeploymentSlotType . Staging , deploymentLabel , deploymentName , false , false ) ;
1117
+ result = vmPowershellCmdlets . GetAzureDeployment ( serviceName , DeploymentSlotType . Staging ) ;
1118
+ pass = Utilities . PrintAndCompareDeployment ( result , serviceName , deploymentName , deploymentLabel , DeploymentSlotType . Staging , null , 2 ) ;
1119
+ Console . WriteLine ( "successfully deployed the package" ) ;
1120
+
1121
+ // should detect that Default-PaaSDiagnostics-Staging-Ext-0 is in use
1122
+ vmPowershellCmdlets . SetAzureServiceDiagnosticsExtension ( serviceName , storageContext , daConfig , null , slot : DeploymentSlotType . Staging ) ;
1123
+ DiagnosticExtensionContext resultContext2 = vmPowershellCmdlets . GetAzureServiceDiagnosticsExtension ( serviceName , slot : DeploymentSlotType . Staging ) [ 0 ] ;
1124
+ VerifyDiagExtContext ( resultContext2 , "AllRoles" , "Default-PaaSDiagnostics-Staging-Ext-1" , storage , daConfig ) ;
1125
+
1126
+ // execute again to make sure max number of extensions will handled correctly (1 for production and 1 for staging, 1 unused)
1127
+ // should not fail due to ExtensionIdLiveCycleCount limit
1128
+ vmPowershellCmdlets . SetAzureServiceDiagnosticsExtension ( serviceName , storageContext , daConfig , null , slot : DeploymentSlotType . Staging ) ;
1129
+ DiagnosticExtensionContext resultContext3 = vmPowershellCmdlets . GetAzureServiceDiagnosticsExtension ( serviceName , slot : DeploymentSlotType . Staging ) [ 0 ] ;
1130
+
1131
+ // azure splits config from All Roles to specific role in that case, so role name should not be validated
1132
+ VerifyDiagExtContext ( resultContext3 , null , "Default-PaaSDiagnostics-Staging-Ext-2" , storage , daConfig ) ;
1133
+
1134
+ vmPowershellCmdlets . RemoveAzureService ( serviceName , true ) ;
1135
+ }
1136
+
1067
1137
#endregion
1068
1138
1069
1139
@@ -1696,10 +1766,14 @@ private void VerifyDiagExtContext(DiagnosticExtensionContext resultContext, stri
1696
1766
{
1697
1767
Utilities . PrintContext ( resultContext ) ;
1698
1768
1699
- Assert . AreEqual ( role , resultContext . Role . RoleType . ToString ( ) , "role is not same" ) ;
1769
+ if ( role != null )
1770
+ {
1771
+ Assert . AreEqual ( role , resultContext . Role . RoleType . ToString ( ) , "role is not same" ) ;
1772
+ }
1773
+
1700
1774
Assert . AreEqual ( Utilities . PaaSDiagnosticsExtensionName , resultContext . Extension , "extension is not Diagnostics" ) ;
1775
+
1701
1776
Assert . AreEqual ( extID , resultContext . Id , "extension id is not same" ) ;
1702
- //Assert.AreEqual(storage, resultContext.StorageAccountName, "storage account name is not same");
1703
1777
1704
1778
XmlDocument doc = new XmlDocument ( ) ;
1705
1779
doc . Load ( "da.xml" ) ;
0 commit comments