33using GVFS . FunctionalTests . Tests . MultiEnlistmentTests ;
44using GVFS . FunctionalTests . Tools ;
55using GVFS . FunctionalTests . Windows . Tests ;
6- using GVFS . FunctionalTests . Windows . Tools ;
76using GVFS . Tests . Should ;
87using NUnit . Framework ;
98using System ;
10- using System . Collections . Generic ;
119using System . IO ;
1210
1311namespace GVFS . FunctionalTests . Windows . Windows . Tests
@@ -33,115 +31,6 @@ public void SetCacheLocation()
3331 this . localCachePath = Path . Combine ( this . localCacheParentPath , ".customGVFSCache" ) ;
3432 }
3533
36- [ TestCase ]
37- public void MountUpgradesLocalSizesToSharedCache ( )
38- {
39- GVFSFunctionalTestEnlistment enlistment = this . CloneAndMountEnlistment ( ) ;
40- enlistment . UnmountGVFS ( ) ;
41-
42- string localCacheRoot = GVFSHelpers . GetPersistedLocalCacheRoot ( enlistment . DotGVFSRoot ) ;
43- string gitObjectsRoot = GVFSHelpers . GetPersistedGitObjectsRoot ( enlistment . DotGVFSRoot ) ;
44-
45- // Delete the existing repo metadata
46- string versionJsonPath = Path . Combine ( enlistment . DotGVFSRoot , GVFSHelpers . RepoMetadataName ) ;
47- versionJsonPath . ShouldBeAFile ( this . fileSystem ) ;
48- this . fileSystem . DeleteFile ( versionJsonPath ) ;
49-
50- // Since there isn't a sparse-checkout file that is used anymore one needs to be added
51- // in order to test the old upgrades that might have needed it
52- string sparseCheckoutPath = Path . Combine ( enlistment . RepoRoot , TestConstants . DotGit . Info . SparseCheckoutPath ) ;
53- this . fileSystem . WriteAllText ( sparseCheckoutPath , "/.gitattributes\r \n " ) ;
54-
55- // "13.0" was the last version before blob sizes were moved out of Esent
56- string metadataPath = Path . Combine ( enlistment . DotGVFSRoot , GVFSHelpers . RepoMetadataName ) ;
57- this . fileSystem . CreateEmptyFile ( metadataPath ) ;
58- GVFSHelpers . SaveDiskLayoutVersion ( enlistment . DotGVFSRoot , "13" , "0" ) ;
59- GVFSHelpers . SaveLocalCacheRoot ( enlistment . DotGVFSRoot , localCacheRoot ) ;
60- GVFSHelpers . SaveGitObjectsRoot ( enlistment . DotGVFSRoot , gitObjectsRoot ) ;
61-
62- // Create a legacy PersistedDictionary sizes database
63- List < KeyValuePair < string , long > > entries = new List < KeyValuePair < string , long > > ( )
64- {
65- new KeyValuePair < string , long > ( new string ( '0' , 40 ) , 1 ) ,
66- new KeyValuePair < string , long > ( new string ( '1' , 40 ) , 2 ) ,
67- new KeyValuePair < string , long > ( new string ( '2' , 40 ) , 4 ) ,
68- new KeyValuePair < string , long > ( new string ( '3' , 40 ) , 8 ) ,
69- } ;
70-
71- ESENTDatabase . CreateEsentBlobSizesDatabase ( enlistment . DotGVFSRoot , entries ) ;
72-
73- enlistment . MountGVFS ( ) ;
74-
75- string majorVersion ;
76- string minorVersion ;
77- GVFSHelpers . GetPersistedDiskLayoutVersion ( enlistment . DotGVFSRoot , out majorVersion , out minorVersion ) ;
78-
79- majorVersion
80- . ShouldBeAnInt ( "Disk layout version should always be an int" )
81- . ShouldEqual ( WindowsDiskLayoutUpgradeTests . CurrentDiskLayoutMajorVersion , "Disk layout version should be upgraded to the latest" ) ;
82-
83- minorVersion
84- . ShouldBeAnInt ( "Disk layout version should always be an int" )
85- . ShouldEqual ( WindowsDiskLayoutUpgradeTests . CurrentDiskLayoutMinorVersion , "Disk layout version should be upgraded to the latest" ) ;
86-
87- string newBlobSizesRoot = Path . Combine ( Path . GetDirectoryName ( gitObjectsRoot ) , WindowsDiskLayoutUpgradeTests . BlobSizesCacheName ) ;
88- GVFSHelpers . GetPersistedBlobSizesRoot ( enlistment . DotGVFSRoot )
89- . ShouldEqual ( newBlobSizesRoot ) ;
90-
91- string blobSizesDbPath = Path . Combine ( newBlobSizesRoot , WindowsDiskLayoutUpgradeTests . BlobSizesDBFileName ) ;
92- newBlobSizesRoot . ShouldBeADirectory ( this . fileSystem ) ;
93- blobSizesDbPath . ShouldBeAFile ( this . fileSystem ) ;
94-
95- foreach ( KeyValuePair < string , long > entry in entries )
96- {
97- GVFSHelpers . SQLiteBlobSizesDatabaseHasEntry ( blobSizesDbPath , entry . Key , entry . Value ) ;
98- }
99-
100- // Upgrade a second repo, and make sure all sizes from both upgrades are in the shared database
101-
102- GVFSFunctionalTestEnlistment enlistment2 = this . CloneAndMountEnlistment ( ) ;
103- enlistment2 . UnmountGVFS ( ) ;
104-
105- // Delete the existing repo metadata
106- versionJsonPath = Path . Combine ( enlistment2 . DotGVFSRoot , GVFSHelpers . RepoMetadataName ) ;
107- versionJsonPath . ShouldBeAFile ( this . fileSystem ) ;
108- this . fileSystem . DeleteFile ( versionJsonPath ) ;
109-
110- // Since there isn't a sparse-checkout file that is used anymore one needs to be added
111- // in order to test the old upgrades that might have needed it
112- string sparseCheckoutPath2 = Path . Combine ( enlistment2 . RepoRoot , TestConstants . DotGit . Info . SparseCheckoutPath ) ;
113- this . fileSystem . WriteAllText ( sparseCheckoutPath2 , "/.gitattributes\r \n " ) ;
114-
115- // "13.0" was the last version before blob sizes were moved out of Esent
116- metadataPath = Path . Combine ( enlistment2 . DotGVFSRoot , GVFSHelpers . RepoMetadataName ) ;
117- this . fileSystem . CreateEmptyFile ( metadataPath ) ;
118- GVFSHelpers . SaveDiskLayoutVersion ( enlistment2 . DotGVFSRoot , "13" , "0" ) ;
119- GVFSHelpers . SaveLocalCacheRoot ( enlistment2 . DotGVFSRoot , localCacheRoot ) ;
120- GVFSHelpers . SaveGitObjectsRoot ( enlistment2 . DotGVFSRoot , gitObjectsRoot ) ;
121-
122- // Create a legacy PersistedDictionary sizes database
123- List < KeyValuePair < string , long > > additionalEntries = new List < KeyValuePair < string , long > > ( )
124- {
125- new KeyValuePair < string , long > ( new string ( '4' , 40 ) , 16 ) ,
126- new KeyValuePair < string , long > ( new string ( '5' , 40 ) , 32 ) ,
127- new KeyValuePair < string , long > ( new string ( '6' , 40 ) , 64 ) ,
128- } ;
129-
130- ESENTDatabase . CreateEsentBlobSizesDatabase ( enlistment2 . DotGVFSRoot , additionalEntries ) ;
131-
132- enlistment2 . MountGVFS ( ) ;
133-
134- foreach ( KeyValuePair < string , long > entry in entries )
135- {
136- GVFSHelpers . SQLiteBlobSizesDatabaseHasEntry ( blobSizesDbPath , entry . Key , entry . Value ) ;
137- }
138-
139- foreach ( KeyValuePair < string , long > entry in additionalEntries )
140- {
141- GVFSHelpers . SQLiteBlobSizesDatabaseHasEntry ( blobSizesDbPath , entry . Key , entry . Value ) ;
142- }
143- }
144-
14534 private GVFSFunctionalTestEnlistment CloneAndMountEnlistment ( string branch = null )
14635 {
14736 return this . CreateNewEnlistment ( this . localCachePath , branch ) ;
0 commit comments