diff --git a/src/chocolatey.tests.integration/scenarios/InstallScenarios.cs b/src/chocolatey.tests.integration/scenarios/InstallScenarios.cs index 8509f8fe81..39d91adc5d 100644 --- a/src/chocolatey.tests.integration/scenarios/InstallScenarios.cs +++ b/src/chocolatey.tests.integration/scenarios/InstallScenarios.cs @@ -330,6 +330,26 @@ public void Should_have_a_version_of_one_dot_zero_dot_zero() _packageResult.Version.Should().Be(TestVersion()); } + [Fact] + public void Should_contain_message_with_source() + { + var message = "Downloading package from source '{0}'".FormatWith(Configuration.Sources); + + MockLogger.Messages.Should().ContainKey(LogLevel.Info.ToString()).WhoseValue.Should() + .Contain(message); + } + + [Fact] + public void Should_contain_message_with_download_uri() + { + var packagePath = "file:///{0}/{1}.{2}{3}".FormatWith(Configuration.Sources.Replace("\\","/"), Configuration.PackageNames, + TestVersion(), NuGetConstants.PackageExtension); + var message = "Package download location '{0}'".FormatWith(packagePath); + + MockLogger.Messages.Should().ContainKey(LogLevel.Debug.ToString()).WhoseValue.Should() + .Contain(message); + } + [Fact] [WindowsOnly] [Platform(Exclude = "Mono")] diff --git a/src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs b/src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs index 2231061fde..6d332f437b 100644 --- a/src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs +++ b/src/chocolatey.tests.integration/scenarios/UpgradeScenarios.cs @@ -265,6 +265,26 @@ public void Should_match_the_upgrade_version_of_one_dot_one_dot_zero() _packageResult.Version.Should().Be("1.1.0"); } + [Fact] + public void Should_contain_message_with_source() + { + var message = "Downloading package from source '{0}'".FormatWith(Configuration.Sources); + + MockLogger.Messages.Should().ContainKey(LogLevel.Info.ToString()).WhoseValue.Should() + .Contain(message); + } + + [Fact] + public void Should_contain_message_with_download_uri() + { + var packagePath = "file:///{0}/{1}.{2}{3}".FormatWith(Configuration.Sources.Replace("\\", "/"), Configuration.PackageNames, + "1.1.0", NuGetConstants.PackageExtension); + var message = "Package download location '{0}'".FormatWith(packagePath); + + MockLogger.Messages.Should().ContainKey(LogLevel.Debug.ToString()).WhoseValue.Should() + .Contain(message); + } + [Fact] [WindowsOnly] [Platform(Exclude = "Mono")] diff --git a/src/chocolatey/infrastructure.app/services/NugetService.cs b/src/chocolatey/infrastructure.app/services/NugetService.cs index 0407abc2fd..3184a614f5 100644 --- a/src/chocolatey/infrastructure.app/services/NugetService.cs +++ b/src/chocolatey/infrastructure.app/services/NugetService.cs @@ -828,6 +828,9 @@ Version was specified as '{0}'. It is possible that version _fileSystem.DeleteFile(pathResolver.GetInstalledPackageFilePath(packageDependencyInfo)); + this.Log().Info("Downloading package from source '{0}'".FormatWith(packageDependencyInfo.Source)); + this.Log().Debug("Package download location '{0}'".FormatWith(packageDependencyInfo.DownloadUri)); + ChocolateyProgressInfo.ShouldDisplayDownloadProgress = config.Features.ShowDownloadProgress; using (var downloadResult = downloadResource.GetDownloadResourceResultAsync( @@ -1560,6 +1563,9 @@ public virtual ConcurrentDictionary Upgrade(ChocolateyCon _fileSystem.DeleteFile(pathResolver.GetInstalledPackageFilePath(packageDependencyInfo)); + this.Log().Info("Downloading package from source '{0}'".FormatWith(packageDependencyInfo.Source)); + this.Log().Debug("Package download location '{0}'".FormatWith(packageDependencyInfo.DownloadUri)); + ChocolateyProgressInfo.ShouldDisplayDownloadProgress = config.Features.ShowDownloadProgress; using (var downloadResult = downloadResource.GetDownloadResourceResultAsync(