Skip to content

Commit 8df943f

Browse files
[INS-331] Fix the issue causing the tests file system soruce tests to fail on windows (#4743)
* fix excludepaths flag causing the test to fail * fixed bugbot comms
1 parent 041f07e commit 8df943f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pkg/sources/filesystem/filesystem_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,8 @@ func TestSkipDir(t *testing.T) {
347347
defer cleanupDir()
348348

349349
// create an ExcludePathsFile that contains the ignoreDir path
350-
excludeFile, cleanupFile, err := createTempFile("", ignoreDir+"\n")
350+
// In windows path contains \ so we escape it by replacing it with \\ in ignoreDir
351+
excludeFile, cleanupFile, err := createTempFile("", strings.ReplaceAll(ignoreDir, `\`, `\\`)+"\n")
351352
require.NoError(t, err)
352353
defer cleanupFile()
353354

@@ -392,8 +393,8 @@ func TestScanSubDirFile(t *testing.T) {
392393

393394
// Create an IncludePathsFile with the absolute path of the file
394395
includeFilePath := filepath.Join(testDir, "include.txt")
395-
err = os.WriteFile(includeFilePath, []byte(filePath+"\n"), 0644)
396-
require.NoError(t, err)
396+
err = os.WriteFile(includeFilePath, []byte(strings.ReplaceAll(filePath, `\`, `\\`)+"\n"), 0644)
397+
require.NoError(t, err)
397398

398399
conn, err := anypb.New(&sourcespb.Filesystem{
399400
IncludePathsFile: includeFilePath,

0 commit comments

Comments
 (0)