Exemple #1
0
        public void CompareVersion_ProvidedVersionToSupportedVersion(
            string providedVersion,
            string supportedVersion,
            int resultExpected)
        {
            // Arrange and Act
            int comparisonResult = SemanticVersionResolver.CompareVersions(providedVersion, supportedVersion);

            // Assert
            Assert.Equal(resultExpected, comparisonResult);
        }
Exemple #2
0
        public void CompareVersions_VersionDoesNotHaveMinorAndOrPatchVersion(
            string providedVersion,
            string supportedVersion,
            int resultExpected)
        {
            // Arrange and Act
            int comparisonResult = SemanticVersionResolver.CompareVersions(providedVersion, supportedVersion);

            // Assert
            Assert.Equal(resultExpected, comparisonResult);
        }
        public IEnumerable <ICheckerMessage> CheckToolVersions(IDictionary <string, string> tools)
        {
            if (tools.ContainsKey(NodeConstants.NodeJsName))
            {
                var used = tools[NodeConstants.NodeJsName];
                if (SemanticVersionResolver.CompareVersions(used, NodeScriptGeneratorOptionsSetup.NodeLtsVersion) < 0)
                {
                    return(new[]
                    {
                        new CheckerMessage($"An outdated version of Node.js was used ({used}). Consider updating. " +
                                           $"Versions supported in Oryx: {Constants.OryxGitHubUrl}")
                    });
                }
            }

            return(Enumerable.Empty <ICheckerMessage>());
        }
        public IEnumerable <ICheckerMessage> CheckToolVersions(IDictionary <string, string> tools)
        {
            var used       = tools[NodeConstants.NodeToolName];
            var comparison = SemanticVersionResolver.CompareVersions(used, NodeScriptGeneratorOptionsSetup.NodeLtsVersion);

            _logger.LogDebug($"SemanticVersionResolver.CompareVersions returned {comparison}");
            if (comparison < 0)
            {
                return(new[]
                {
                    new CheckerMessage(string.Format(Resources.Labels.NodeVersionCheckerMessageFormat,
                                                     used,
                                                     Constants.OryxGitHubUrl))
                });
            }

            return(Enumerable.Empty <ICheckerMessage>());
        }
Exemple #5
0
        public IEnumerable <ICheckerMessage> CheckToolVersions(IDictionary <string, string> tools)
        {
            var used       = tools[PythonConstants.PlatformName];
            var comparison = SemanticVersionResolver.CompareVersions(used, PythonConstants.PythonLtsVersion);

            _logger.LogDebug($"SemanticVersionResolver.CompareVersions returned {comparison}");
            if (comparison < 0)
            {
                return(new[]
                {
                    new CheckerMessage(string.Format(Resources.Labels.ToolVersionCheckerMessageFormat,
                                                     PythonConstants.PlatformName,
                                                     used,
                                                     Constants.OryxGitHubUrl)),
                });
            }

            return(Enumerable.Empty <ICheckerMessage>());
        }