MCPcopy
hub / github.com/yuk7/wsldl / TestBackupTarWithDeps_GzipTempDirEmptyReturnsError

Function TestBackupTarWithDeps_GzipTempDirEmptyReturnsError

src/backup/backup_test.go:129–153  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

127}
128
129func TestBackupTarWithDeps_GzipTempDirEmptyReturnsError(t *testing.T) {
130 t.Parallel()
131
132 deps := backupTarDeps{
133 tempDir: func() string { return "" },
134 export: func(distributionName, destFileName string) error {
135 t.Fatal("export should not be called when temp dir is empty")
136 return nil
137 },
138 copyFile: func(srcPath, destPath string, compress bool) error {
139 t.Fatal("copyFile should not be called when temp dir is empty")
140 return nil
141 },
142 remove: func(path string) error { return nil },
143 randIntn: func(n int) int { return 0 },
144 }
145
146 err := backupTarWithDeps("Arch", "backup.tar.gz", deps)
147 if err == nil {
148 t.Fatal("backupTarWithDeps succeeded unexpectedly")
149 }
150 if err.Error() != "failed to create temp directory" {
151 t.Fatalf("error = %q, want %q", err.Error(), "failed to create temp directory")
152 }
153}
154
155func TestBackupExt4Vhdx_GetProfileError(t *testing.T) {
156 t.Parallel()

Callers

nothing calls this directly

Calls 2

backupTarWithDepsFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected