Fix up the delta integration test

This commit is contained in:
Paul Betts
2014-07-29 09:59:40 +02:00
parent 70f9bb7190
commit e654e17a4d

View File

@@ -124,12 +124,10 @@ namespace Squirrel.Tests.Core
[Fact]
public void CreateDeltaPackageIntegrationTest()
{
Assert.False(true, "Need to recreate the fixtures and checks for this class");
var basePackage = IntegrationTestHelper.GetPath("fixtures", "Squirrel.Tests.0.1.0-pre.nupkg");
var newPackage = IntegrationTestHelper.GetPath("fixtures", "Squirrel.Tests.0.2.0-pre.nupkg");
var basePackage = IntegrationTestHelper.GetPath("fixtures", "Squirrel.Core.1.0.0.0.nupkg");
var newPackage = IntegrationTestHelper.GetPath("fixtures", "Squirrel.Core.1.1.0.0.nupkg");
var sourceDir = IntegrationTestHelper.GetPath("..", "packages");
var sourceDir = IntegrationTestHelper.GetPath("fixtures", "packages");
(new DirectoryInfo(sourceDir)).Exists.ShouldBeTrue();
var baseFixture = new ReleasePackage(basePackage);
@@ -152,23 +150,45 @@ namespace Squirrel.Tests.Core
var fullPkg = new ZipPackage(tempFiles[1]);
var deltaPkg = new ZipPackage(tempFiles[2]);
//
// Package Checks
//
fullPkg.Id.ShouldEqual(deltaPkg.Id);
fullPkg.Version.CompareTo(deltaPkg.Version).ShouldEqual(0);
deltaPkg.GetFiles().Count().ShouldBeGreaterThan(0);
// Delta packages should be smaller than the original!
var fileInfos = tempFiles.Select(x => new FileInfo(x)).ToArray();
this.Log().Info("Base Size: {0}, Current Size: {1}, Delta Size: {2}",
fileInfos[0].Length, fileInfos[1].Length, fileInfos[2].Length);
(fileInfos[2].Length - fileInfos[1].Length).ShouldBeLessThan(0);
//
// File Checks
///
var deltaPkgFiles = deltaPkg.GetFiles().ToList();
deltaPkgFiles.Count.ShouldBeGreaterThan(0);
this.Log().Info("Files in delta package:");
deltaPkg.GetFiles().ForEach(x => this.Log().Info(x.Path));
deltaPkgFiles.ForEach(x => this.Log().Info(x.Path));
// v1.1 adds a dependency on DotNetZip
deltaPkg.GetFiles()
.Any(x => x.Path.ToLowerInvariant().Contains("ionic.zip"))
var newFilesAdded = new[] {
"Newtonsoft.Json.dll",
"Refit.dll",
"Refit-Portable.dll",
"Castle.Core.dll",
}.Select(x => x.ToLowerInvariant());
// vNext adds a dependency on Refit
newFilesAdded
.All(x => deltaPkgFiles.Any(y => y.Path.ToLowerInvariant().Contains(x)))
.ShouldBeTrue();
// All the other files should be diffs and shasums
deltaPkg.GetFiles().Any(x => !x.Path.ToLowerInvariant().Contains("ionic.zip")).ShouldBeTrue();
deltaPkg.GetFiles()
.Where(x => !x.Path.ToLowerInvariant().Contains("ionic.zip"))
deltaPkgFiles
.Where(x => !newFilesAdded.Any(y => x.Path.ToLowerInvariant().Contains(y)))
.All(x => x.Path.ToLowerInvariant().EndsWith("diff") || x.Path.ToLowerInvariant().EndsWith("shasum"))
.ShouldBeTrue();
@@ -181,13 +201,6 @@ namespace Squirrel.Tests.Core
this.Log().Info("Looking for corresponding shasum file: {0}", lookingFor);
deltaPkg.GetFiles().Any(y => y.Path == lookingFor).ShouldBeTrue();
});
// Delta packages should be smaller than the original!
var fileInfos = tempFiles.Select(x => new FileInfo(x)).ToArray();
this.Log().Info("Base Size: {0}, Current Size: {1}, Delta Size: {2}",
fileInfos[0].Length, fileInfos[1].Length, fileInfos[2].Length);
(fileInfos[2].Length - fileInfos[1].Length).ShouldBeLessThan(0);
} finally {
tempFiles.ForEach(File.Delete);
}