public void Deserialize_ServerTypeSupplied_SetsServerName(string rawType, MySqlServerType expectedType)
 {
     YamlAssert.PropertySet <MySqlResourceV1, AzureResourceDefinitionV1, MySqlServerType>(
         _deserializer,
         $"type: {rawType}",
         expectedType,
         r => r.Type);
 }
Пример #2
0
        public override AzureResourceDefinition ParseResults(JToken resultRowEntry)
        {
            Guard.NotNull(resultRowEntry, nameof(resultRowEntry));

            MySqlServerType serverType = MySqlServerType.Single;

            var resourceType = resultRowEntry[2]?.ToString();

            switch (resourceType?.ToLower())
            {
            case SingleServerResourceType:
                serverType = MySqlServerType.Single;
                break;

            case FlexibleServerResourceType:
                serverType = MySqlServerType.Flexible;
                break;
            }

            var resource = new MySqlResourceDefinition(resultRowEntry[0]?.ToString(), resultRowEntry[1]?.ToString(), resultRowEntry[3]?.ToString(), serverType);

            return(resource);
        }
        public void MySqlMetricsDeclaration_DeclarationWithSpecificServerType_Succeeds(MySqlServerType serverType)
        {
            // Arrange
            var rawDeclaration = MetricsDeclarationBuilder.WithMetadata()
                                 .WithMySqlMetric(serverType: serverType)
                                 .Build(Mapper);
            var metricsDeclarationProvider = new MetricsDeclarationProviderStub(rawDeclaration, Mapper);

            // Act
            var scrapingScheduleValidationStep = new MetricsDeclarationValidationStep(metricsDeclarationProvider, NullLogger <MetricsDeclarationValidationStep> .Instance);
            var validationResult = scrapingScheduleValidationStep.Run();

            // Assert
            PromitorAssert.ValidationIsSuccessful(validationResult);
        }
Пример #4
0
 public MySqlResourceDefinition(string subscriptionId, string resourceGroupName, string serverName, MySqlServerType type)
     : base(ResourceType.MySql, subscriptionId, resourceGroupName, $"{serverName}-{type}")
 {
     ServerName = serverName;
     Type       = type;
 }