@@ -179,8 +179,8 @@ func TestFileManagerService_ConfigApply_Add(t *testing.T) {
179179
180180 overview := protos .FileOverview (filePath , fileHash )
181181
182- manifestDirPath = tempDir
183- manifestFilePath = manifestDirPath + "/manifest.json"
182+ manifestDirPath : = tempDir
183+ manifestFilePath : = manifestDirPath + "/manifest.json"
184184 helpers .CreateFileWithErrorCheck (t , manifestDirPath , "manifest.json" )
185185
186186 fakeFileServiceClient := & v1fakes.FakeFileServiceClient {}
@@ -194,7 +194,10 @@ func TestFileManagerService_ConfigApply_Add(t *testing.T) {
194194 }, nil )
195195 agentConfig := types .AgentConfig ()
196196 agentConfig .AllowedDirectories = []string {tempDir }
197+
197198 fileManagerService := NewFileManagerService (fakeFileServiceClient , agentConfig )
199+ fileManagerService .agentConfig .ManifestDir = manifestDirPath
200+ fileManagerService .manifestFilePath = manifestFilePath
198201
199202 request := protos .CreateConfigApplyRequest (overview )
200203 writeStatus , err := fileManagerService .ConfigApply (ctx , request )
@@ -218,10 +221,6 @@ func TestFileManagerService_ConfigApply_Add_LargeFile(t *testing.T) {
218221
219222 overview := protos .FileOverviewLargeFile (filePath , fileHash )
220223
221- manifestDirPath = tempDir
222- manifestFilePath = manifestDirPath + "/manifest.json"
223- helpers .CreateFileWithErrorCheck (t , manifestDirPath , "manifest.json" )
224-
225224 fakeFileServiceClient := & v1fakes.FakeFileServiceClient {}
226225 fakeFileServiceClient .GetOverviewReturns (& mpi.GetOverviewResponse {
227226 Overview : overview ,
@@ -237,10 +236,15 @@ func TestFileManagerService_ConfigApply_Add_LargeFile(t *testing.T) {
237236 fakeServerStreamingClient .chunks [uint32 (i )] = []byte {fileContent [i ]}
238237 }
239238
239+ manifestDirPath := tempDir
240+ manifestFilePath := manifestDirPath + "/manifest.json"
241+
240242 fakeFileServiceClient .GetFileStreamReturns (fakeServerStreamingClient , nil )
241243 agentConfig := types .AgentConfig ()
242244 agentConfig .AllowedDirectories = []string {tempDir }
243245 fileManagerService := NewFileManagerService (fakeFileServiceClient , agentConfig )
246+ fileManagerService .agentConfig .ManifestDir = manifestDirPath
247+ fileManagerService .manifestFilePath = manifestFilePath
244248
245249 request := protos .CreateConfigApplyRequest (overview )
246250 writeStatus , err := fileManagerService .ConfigApply (ctx , request )
@@ -279,8 +283,8 @@ func TestFileManagerService_ConfigApply_Update(t *testing.T) {
279283 },
280284 }
281285
282- manifestDirPath = tempDir
283- manifestFilePath = manifestDirPath + "/manifest.json"
286+ manifestDirPath : = tempDir
287+ manifestFilePath : = manifestDirPath + "/manifest.json"
284288 helpers .CreateFileWithErrorCheck (t , manifestDirPath , "manifest.json" )
285289
286290 overview := protos .FileOverview (tempFile .Name (), fileHash )
@@ -296,12 +300,14 @@ func TestFileManagerService_ConfigApply_Update(t *testing.T) {
296300 }, nil )
297301 agentConfig := types .AgentConfig ()
298302 agentConfig .AllowedDirectories = []string {tempDir }
303+
299304 fileManagerService := NewFileManagerService (fakeFileServiceClient , agentConfig )
305+ fileManagerService .agentConfig .ManifestDir = manifestDirPath
306+ fileManagerService .manifestFilePath = manifestFilePath
300307 err := fileManagerService .UpdateCurrentFilesOnDisk (ctx , filesOnDisk , false )
301308 require .NoError (t , err )
302309
303310 request := protos .CreateConfigApplyRequest (overview )
304-
305311 writeStatus , err := fileManagerService .ConfigApply (ctx , request )
306312 require .NoError (t , err )
307313 assert .Equal (t , model .OK , writeStatus )
@@ -336,14 +342,17 @@ func TestFileManagerService_ConfigApply_Delete(t *testing.T) {
336342 },
337343 }
338344
339- manifestDirPath = tempDir
340- manifestFilePath = manifestDirPath + "/manifest.json"
345+ manifestDirPath : = tempDir
346+ manifestFilePath : = manifestDirPath + "/manifest.json"
341347 helpers .CreateFileWithErrorCheck (t , manifestDirPath , "manifest.json" )
342348
343349 fakeFileServiceClient := & v1fakes.FakeFileServiceClient {}
344350 agentConfig := types .AgentConfig ()
345351 agentConfig .AllowedDirectories = []string {tempDir }
352+
346353 fileManagerService := NewFileManagerService (fakeFileServiceClient , agentConfig )
354+ fileManagerService .agentConfig .ManifestDir = manifestDirPath
355+ fileManagerService .manifestFilePath = manifestFilePath
347356 err := fileManagerService .UpdateCurrentFilesOnDisk (ctx , filesOnDisk , false )
348357 require .NoError (t , err )
349358
@@ -462,8 +471,8 @@ func TestFileManagerService_Rollback(t *testing.T) {
462471 _ , writeErr = updateFile .Write (newFileContent )
463472 require .NoError (t , writeErr )
464473
465- manifestDirPath = tempDir
466- manifestFilePath = manifestDirPath + "/manifest.json"
474+ manifestDirPath : = tempDir
475+ manifestFilePath : = manifestDirPath + "/manifest.json"
467476 helpers .CreateFileWithErrorCheck (t , manifestDirPath , "manifest.json" )
468477
469478 filesCache := map [string ]* model.FileCache {
@@ -529,6 +538,8 @@ func TestFileManagerService_Rollback(t *testing.T) {
529538 fileManagerService := NewFileManagerService (fakeFileServiceClient , types .AgentConfig ())
530539 fileManagerService .rollbackFileContents = fileContentCache
531540 fileManagerService .fileActions = filesCache
541+ fileManagerService .agentConfig .ManifestDir = manifestDirPath
542+ fileManagerService .manifestFilePath = manifestFilePath
532543
533544 err := fileManagerService .Rollback (ctx , instanceID )
534545 require .NoError (t , err )
@@ -690,11 +701,14 @@ func TestFileManagerService_DetermineFileActions(t *testing.T) {
690701 // Delete manifest file if it already exists
691702 manifestFile := CreateTestManifestFile (t , tempDir , test .currentFiles )
692703 defer manifestFile .Close ()
693- manifestDirPath = tempDir
694- manifestFilePath = manifestFile .Name ()
704+ manifestDirPath : = tempDir
705+ manifestFilePath : = manifestFile .Name ()
695706
696707 fakeFileServiceClient := & v1fakes.FakeFileServiceClient {}
697708 fileManagerService := NewFileManagerService (fakeFileServiceClient , types .AgentConfig ())
709+ fileManagerService .agentConfig .ManifestDir = manifestDirPath
710+ fileManagerService .manifestFilePath = manifestFilePath
711+
698712 require .NoError (tt , err )
699713
700714 diff , contents , fileActionErr := fileManagerService .DetermineFileActions (test .currentFiles ,
0 commit comments