MCPcopy Index your code
hub / github.com/devspace-sh/devspace / TestHashDirectoryExcludes

Function TestHashDirectoryExcludes

pkg/util/hash/hash_test.go:60–88  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

58}
59
60func TestHashDirectoryExcludes(t *testing.T) {
61 dir := t.TempDir()
62
63 wdBackup, err := os.Getwd()
64 if err != nil {
65 t.Fatalf("Error getting current working directory: %v", err)
66 }
67 err = os.Chdir(dir)
68 if err != nil {
69 t.Fatalf("Error changing working directory: %v", err)
70 }
71
72 // 8. Delete temp folder
73 defer func() {
74 err = os.Chdir(wdBackup)
75 if err != nil {
76 t.Fatalf("Error changing dir back: %v", err)
77 }
78 }()
79
80 _ = fsutil.WriteToFile([]byte(""), "inludedFile")
81 _ = fsutil.WriteToFile([]byte(""), "excludedFile")
82 _ = fsutil.WriteToFile([]byte(""), "excludedDir/someFile")
83 _, err = DirectoryExcludes(".", []string{"excludedFile", "excludedDir"}, false)
84 if err != nil {
85 t.Fatalf("Error creating hash of directory: %v", err)
86 }
87
88}

Callers

nothing calls this directly

Calls 3

WriteToFileFunction · 0.92
DirectoryExcludesFunction · 0.85
FatalfMethod · 0.45

Tested by

no test coverage detected