public void GetUpdates1199RegressionTest() { // Use the same package name, but force the version to be unique. string packageName = "NuGetGallery.FunctionalTests.ODataTests.GetUpdates1199RegressionTest"; string ticks = DateTime.Now.Ticks.ToString(); string version1 = new System.Version(ticks.Substring(0, 6) + "." + ticks.Substring(6, 6) + "." + ticks.Substring(12, 6)).ToString(); string version2 = new System.Version(Convert.ToInt32(ticks.Substring(0, 6) + 1).ToString() + "." + ticks.Substring(6, 6) + "." + ticks.Substring(12, 6)).ToString(); string standardOutput = string.Empty; string standardError = string.Empty; string package1Location = PackageCreationHelper.CreatePackageWithTargetFramework(packageName, version1, "net45"); int exitCode = CmdLineHelper.UploadPackage(package1Location, UrlHelper.V2FeedPushSourceUrl, out standardOutput, out standardError); Assert.IsTrue((exitCode == 0), "The package upload via Nuget.exe didnt suceed properly. Check the logs to see the process error and output stream. Exit Code: " + exitCode + ". Error message: \"" + standardError + "\""); string package2Location = PackageCreationHelper.CreatePackageWithTargetFramework(packageName, version2, "net40"); exitCode = CmdLineHelper.UploadPackage(package2Location, UrlHelper.V2FeedPushSourceUrl, out standardOutput, out standardError); Assert.IsTrue((exitCode == 0), "The package upload via Nuget.exe didnt suceed properly. Check the logs to see the process error and output stream. Exit Code: " + exitCode + ". Error message: \"" + standardError + "\""); WebRequest request = WebRequest.Create(UrlHelper.V2FeedRootUrl + @"/GetUpdates()?packageIds='NuGetGallery.FunctionalTests.ODataTests.GetUpdates1199RegressionTest%7COwin%7CMicrosoft.Web.Infrastructure%7CMicrosoft.AspNet.Identity.Core%7CMicrosoft.AspNet.Identity.EntityFramework%7CMicrosoft.AspNet.Identity.Owin%7CMicrosoft.AspNet.Web.Optimization%7CRespond%7CWebGrease%7CjQuery%7CjQuery.Validation%7CMicrosoft.Owin.Security.Twitter%7CMicrosoft.Owin.Security.OAuth%7CMicrosoft.Owin.Security.MicrosoftAccount%7CMicrosoft.Owin.Security.Google%7CMicrosoft.Owin.Security.Facebook%7CMicrosoft.Owin.Security.Cookies%7CMicrosoft.Owin%7CMicrosoft.Owin.Host.SystemWeb%7CMicrosoft.Owin.Security%7CModernizr%7CMicrosoft.jQuery.Unobtrusive.Validation%7CMicrosoft.AspNet.WebPages%7CMicrosoft.AspNet.Razor%7Cbootstrap%7CAntlr%7CMicrosoft.AspNet.Mvc%7CNewtonsoft.Json%7CEntityFramework'&versions='" + version1 + "%7C1.0%7C1.0.0.0%7C1.0.0%7C1.0.0%7C1.0.0%7C1.1.1%7C1.2.0%7C1.5.2%7C1.10.2%7C1.11.1%7C2.0.0%7C2.0.0%7C2.0.0%7C2.0.0%7C2.0.0%7C2.0.0%7C2.0.0%7C2.0.0%7C2.0.0%7C2.6.2%7C3.0.0%7C3.0.0%7C3.0.0%7C3.0.0%7C3.4.1.9004%7C5.0.0%7C5.0.6%7C6.0.0'&includePrerelease=false&includeAllVersions=false&targetFrameworks='net45'&versionConstraints='%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C%7C'"); // Get the response. WebResponse response = request.GetResponse(); StreamReader sr = new StreamReader(response.GetResponseStream()); string responseText = sr.ReadToEnd(); // Verify at least one package is in the output. Assert.IsTrue(responseText.Contains(@"<title type=""text"">NuGetGallery.FunctionalTests.ODataTests.GetUpdates1199RegressionTest</title>")); Assert.IsTrue(responseText.Contains(@"<d:Version>" + version2 + "</d:Version><d:NormalizedVersion>" + version2 + "</d:NormalizedVersion>")); }
public void AddPackageToWindows8CuratedFeed() { string packageId = testContextInstance.TestName + DateTime.Now.Ticks.ToString(); string packageFullPath = PackageCreationHelper.CreateWindows8CuratedPackage(packageId); int exitCode = CmdLineHelper.UploadPackage(packageFullPath, UrlHelper.V2FeedPushSourceUrl); Assert.IsTrue((exitCode == 0), "The package upload via Nuget.exe didnt suceed properly. Check the logs to see the process error and output stream"); //check if the package is present in windows 8 feed. //TBD : Need to check the exact the url for curated feed. System.Threading.Thread.Sleep(60000); Assert.IsTrue(ClientSDKHelper.CheckIfPackageExistsInSource(packageId, UrlHelper.Windows8CuratedFeedUrl), "Package {0} is not found in the site {1} after uploading.", packageId, UrlHelper.Windows8CuratedFeedUrl); }
public int UploadPackageToCuratedFeed(string packageName, string version, FeedType feedType) { string packageFullPath = string.Empty; switch (feedType) { case FeedType.Windows8CuratedFeed: packageFullPath = PackageCreationHelper.CreateWindows8CuratedPackage(packageName, version); break; case FeedType.WebMatrixCuratedFeed: packageFullPath = PackageCreationHelper.CreateWindows8CuratedPackage(packageName, version); break; } int exitCode = CmdLineHelper.UploadPackage(packageFullPath, UrlHelper.V2FeedPushSourceUrl); return(exitCode); }
public void UploadAndDownLoadPackageWithMinClientVersion() { string packageId = DateTime.Now.Ticks.ToString() + "PackageWithDotCsNames.Cs"; string version = "1.0.0"; string packageFullPath = PackageCreationHelper.CreatePackageWithMinClientVersion(packageId, version, "2.3"); int exitCode = CmdLineHelper.UploadPackage(packageFullPath, UrlHelper.V2FeedPushSourceUrl); Assert.IsTrue((exitCode == 0), Constants.UploadFailureMessage); Assert.IsTrue(ClientSDKHelper.CheckIfPackageVersionExistsInSource(packageId, version, UrlHelper.V2FeedRootUrl), Constants.PackageNotFoundAfterUpload, packageId, UrlHelper.V2FeedRootUrl); //Delete package from local disk so once it gets uploaded if (File.Exists(packageFullPath)) { File.Delete(packageFullPath); Directory.Delete(Path.GetFullPath(Path.GetDirectoryName(packageFullPath)), true); } AssertAndValidationHelper.DownloadPackageAndVerify(packageId); }
[Ignore] //This method is marked ignore as we don't it to be run in regular runs. It will be run only when required. public void UploadAndDownLoadTestBombPackage() { string packageId = DateTime.Now.Ticks.ToString() + testContextInstance.TestName; string version = "1.0.0"; string packageFullPath = PackageCreationHelper.CreateGalleryTestBombPackage(packageId); int exitCode = CmdLineHelper.UploadPackage(packageFullPath, UrlHelper.V2FeedPushSourceUrl); Assert.IsTrue((exitCode == 0), "The package upload via Nuget.exe didnt suceed properly. Check the logs to see the process error and output stream"); Assert.IsTrue(ClientSDKHelper.CheckIfPackageVersionExistsInSource(packageId, version, UrlHelper.V2FeedRootUrl), "Package {0} is not found in the site {1} after uploading.", packageId, UrlHelper.V2FeedRootUrl); //Delete package from local disk so once it gets uploaded if (File.Exists(packageFullPath)) { File.Delete(packageFullPath); Directory.Delete(Path.GetFullPath(Path.GetDirectoryName(packageFullPath)), true); } AssertAndValidationHelper.DownloadPackageAndVerify(packageId); }
/// <summary> /// Creates a package with the specified Id and Version and uploads it and checks if the upload has suceeded. /// This will be used by test classes which tests scenarios on top of upload. /// </summary> /// <param name="packageId"></param> /// <param name="version"></param> public static void UploadNewPackageAndVerify(string packageId, string version = "1.0.0") { if (string.IsNullOrEmpty(packageId)) { packageId = DateTime.Now.Ticks.ToString(); } string packageFullPath = PackageCreationHelper.CreatePackage(packageId, version); string standardOutput = string.Empty; string standardError = string.Empty; int exitCode = CmdLineHelper.UploadPackage(packageFullPath, UrlHelper.V2FeedPushSourceUrl, out standardOutput, out standardError); Assert.IsTrue((exitCode == 0), "The package upload via Nuget.exe didnt suceed properly. Check the logs to see the process error and output stream. Exit Code: " + exitCode + ". Error message: \"" + standardError + "\""); Console.WriteLine(standardOutput); Console.WriteLine(standardError); Assert.IsTrue(ClientSDKHelper.CheckIfPackageVersionExistsInSource(packageId, version, UrlHelper.V2FeedRootUrl), "Package {0} is not found in the site {1} after uploading.", packageId, UrlHelper.V2FeedRootUrl); //Delete package from local disk so once it gets uploaded if (File.Exists(packageFullPath)) { File.Delete(packageFullPath); Directory.Delete(Path.GetFullPath(Path.GetDirectoryName(packageFullPath)), true); } }
public void SearchWebMatrixCuratedFeed() { string packageName = "NuGetGallery.FunctionalTests.SearchWebMatrixCuratedFeed"; string ticks = DateTime.Now.Ticks.ToString(); string version = new System.Version(ticks.Substring(0, 6) + "." + ticks.Substring(6, 6) + "." + ticks.Substring(12, 6)).ToString(); string packageFullPath = PackageCreationHelper.CreateWebMatrixCuratedPackage(packageName, version); int exitCode = CmdLineHelper.UploadPackage(packageFullPath, UrlHelper.V2FeedPushSourceUrl); Assert.IsTrue((exitCode == 0), "The package upload via Nuget.exe didnt suceed properly. Check the logs to see the process error and output stream"); // The feed could update anytime in the next 5 minutes and this test would be considered a success. bool applied = false; for (int i = 0; i < 10 && applied == false; i++) { System.Threading.Thread.Sleep(30000); if (ClientSDKHelper.CheckIfPackageExistsInSource(packageName, UrlHelper.WebMatrixCuratedFeedUrl)) { applied = true; } } Assert.IsTrue(applied, "Package {0} is not found in the site {1} after uploading.", packageName, UrlHelper.WebMatrixCuratedFeedUrl); }