Skip to content

Commit

Permalink
added checks for destinatioDir and file contents
Browse files Browse the repository at this point in the history
Signed-off-by: satyazzz123 <[email protected]>
  • Loading branch information
satyazzz123 authored and HarikrishnanBalagopal committed Mar 21, 2024
1 parent 99bc3c5 commit c48391b
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions filesystem/delta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func TestGenerateDelta(t *testing.T) {

storeDir, err := ioutil.TempDir("", "store")
if err != nil {
t.Fatalf("failed to create store directory")
t.Fatal("failed to create source directory")
}
defer os.RemoveAll(storeDir)

Expand All @@ -56,15 +56,12 @@ func TestGenerateDelta(t *testing.T) {
destCommonFilePath := filepath.Join(destinationDir, commonFile)
if err := ioutil.WriteFile(sourceCommonFilePath, []byte("original"), 0644); err != nil {
t.Fatalf("Failed to write original content to source common file: %v", err)

}
if err := ioutil.WriteFile(destCommonFilePath, []byte("original"), 0644); err != nil {
t.Fatalf("Failed to write original content to destinatio common file: %v", err)

t.Fatalf("Failed to write original content to destination common file: %v", err)
}
if err := ioutil.WriteFile(sourceCommonFilePath, []byte("modified"), 0644); err != nil {
t.Fatalf("Failed to modify common file in source directory: %v", err)

}

// Call GenerateDelta
Expand All @@ -77,7 +74,7 @@ func TestGenerateDelta(t *testing.T) {
expectedFiles := []string{commonFile}
files, err := ioutil.ReadDir(destinationDir)
if err != nil {
t.Errorf("destination directory contents mismatch. got: %v, want: %v", destFiles, expectedFiles)
t.Fatalf("failed to read destination directory %v", err)
}

var destFiles []string
Expand Down

0 comments on commit c48391b

Please sign in to comment.