Exemplo n.º 1
0
        internal void GenericEnableDisableServiceMetrics(ServiceType serviceType, GetMetricsProperty <ServiceProperties> getServiceProperties)
        {
            Test.Info("Enable/Disable service hour metrics for {0}", serviceType);
            int retentionDays = 10;

            Test.Assert(CommandAgent.SetAzureStorageServiceMetrics(serviceType, Constants.MetricsType.Hour, MetricsLevel.Service.ToString(), retentionDays.ToString(), string.Empty), "Enable service hour metrics should succeed");
            ServiceProperties retrievedProperties;

            retrievedProperties = getServiceProperties(Constants.MetricsType.Hour, retentionDays, MetricsLevel.Service.ToString());
            ExpectEqual(retentionDays, retrievedProperties.HourMetrics.RetentionDays.Value, "metrics retention days");

            retentionDays = lang == Language.PowerShell ? -1 : 0;
            Test.Assert(CommandAgent.SetAzureStorageServiceMetrics(serviceType, Constants.MetricsType.Hour, MetricsLevel.Service.ToString(), retentionDays.ToString(), string.Empty), "Disable blob service hour metrics should succeed");

            retrievedProperties = getServiceProperties(Constants.MetricsType.Hour, retentionDays, MetricsLevel.Service.ToString());
            Test.Assert(!retrievedProperties.HourMetrics.RetentionDays.HasValue, "service hour metrics retention days should be null");

            Test.Info("Enable/Disable service minute metrics for {0}", serviceType);
            retentionDays = 10;
            Test.Assert(CommandAgent.SetAzureStorageServiceMetrics(serviceType, Constants.MetricsType.Minute, MetricsLevel.ServiceAndApi.ToString(), retentionDays.ToString(), string.Empty), "Enable service minute metrics should succeed");
            retrievedProperties = getServiceProperties(Constants.MetricsType.Minute, retentionDays, MetricsLevel.ServiceAndApi.ToString());
            ExpectEqual(retentionDays, retrievedProperties.MinuteMetrics.RetentionDays.Value, "metrics retention days");

            retentionDays = lang == Language.PowerShell ? -1 : 0;
            Test.Assert(CommandAgent.SetAzureStorageServiceMetrics(serviceType, Constants.MetricsType.Minute, MetricsLevel.ServiceAndApi.ToString(), retentionDays.ToString(), string.Empty), "Disable blob service minute metrics should succeed");

            retrievedProperties = getServiceProperties(Constants.MetricsType.Minute, retentionDays, MetricsLevel.ServiceAndApi.ToString());
            Test.Assert(!retrievedProperties.MinuteMetrics.RetentionDays.HasValue, "service minute metrics retention days should be null");
        }
Exemplo n.º 2
0
 internal void GenericSetMetricsOperation(ServiceType serviceType, GetMetricsProperty <ServiceProperties> getServiceProperties)
 {
     Test.Info("Set service metrics operation for {0}", serviceType);
     string[] operations = { "None", "Service", "ServiceAndApi" };
     foreach (string op in operations)
     {
         ExpectValidmetricsOperation(serviceType, op, getServiceProperties);
     }
 }
Exemplo n.º 3
0
        internal void ExpectValidmetricsOperation(Constants.ServiceType serviceType,
                                                  string operations, GetMetricsProperty <ServiceProperties> getServiceProperties)
        {
            int retentionDays = Utility.GetRandomTestCount(1, 365 + 1);

            Test.Assert(CommandAgent.SetAzureStorageServiceMetrics(serviceType, Constants.MetricsType.Hour, operations, retentionDays.ToString(), string.Empty), "Set hour metrics level should succeed");
            ServiceProperties retrievedProperties = getServiceProperties(Constants.MetricsType.Hour, retentionDays, operations);
            MetricsLevel      expectOperation     = (MetricsLevel)Enum.Parse(typeof(MetricsLevel), operations, true);

            ExpectEqual(expectOperation.ToString(), retrievedProperties.HourMetrics.MetricsLevel.ToString(), "hour metrics level");

            Test.Assert(CommandAgent.SetAzureStorageServiceMetrics(serviceType, Constants.MetricsType.Minute, operations, retentionDays.ToString(), string.Empty), "Set minute metrics level should succeed");
            retrievedProperties = getServiceProperties(Constants.MetricsType.Minute, retentionDays, operations);
            expectOperation     = (MetricsLevel)Enum.Parse(typeof(MetricsLevel), operations, true);
            ExpectEqual(expectOperation.ToString(), retrievedProperties.MinuteMetrics.MetricsLevel.ToString(), "minute metrics level");
        }