public void DehydrateShouldFailOnWrongDiskLayoutVersion()
        {
            this.Enlistment.UnmountGVFS();

            string majorVersion;
            string minorVersion;

            GVFSHelpers.GetPersistedDiskLayoutVersion(this.Enlistment.DotGVFSRoot, out majorVersion, out minorVersion);

            int majorVersionNum;
            int minorVersionNum;

            int.TryParse(majorVersion.ShouldNotBeNull(), out majorVersionNum).ShouldEqual(true);
            int.TryParse(minorVersion.ShouldNotBeNull(), out minorVersionNum).ShouldEqual(true);

            int previousMajorVersionNum = majorVersionNum - 1;

            if (previousMajorVersionNum >= GVFSHelpers.GetCurrentDiskLayoutMinimumMajorVersion())
            {
                GVFSHelpers.SaveDiskLayoutVersion(this.Enlistment.DotGVFSRoot, previousMajorVersionNum.ToString(), "0");
                this.DehydrateShouldFail(new[] { "disk layout version doesn't match current version" }, noStatus: true);
            }

            GVFSHelpers.SaveDiskLayoutVersion(this.Enlistment.DotGVFSRoot, (majorVersionNum + 1).ToString(), "0");
            this.DehydrateShouldFail(new[] { "Changes to GVFS disk layout do not allow mounting after downgrade." }, noStatus: true);

            GVFSHelpers.SaveDiskLayoutVersion(this.Enlistment.DotGVFSRoot, majorVersionNum.ToString(), minorVersionNum.ToString());
        }
コード例 #2
0
 public void MountFailsIfBeforeMinimumVersion()
 {
     // Mount should fail if on disk version is below minimum supported version
     this.Enlistment.UnmountGVFS();
     GVFSHelpers.SaveDiskLayoutVersion(
         this.Enlistment.DotGVFSRoot,
         (GVFSHelpers.GetCurrentDiskLayoutMinimumMajorVersion() - 1).ToString(),
         CurrentDiskLayoutMinorVersion.ToString());
     this.Enlistment.TryMountGVFS().ShouldBeFalse("Mount should fail because we are before minimum version");
 }