Skip to content

Commit

Permalink
refactor: rename "test_data" to "testdata" for consistency (#1072)
Browse files Browse the repository at this point in the history
* refactor: rename "test_data" to "testdata" for consistency https://github.com/konveyor/move2kube/tree/main/common/testdata

Signed-off-by: prakharagarwal1 <prakharagarwal3031@gmail.com>

* fix: delete old files

Signed-off-by: prakharagarwal1 <prakharagarwal3031@gmail.com>

---------

Signed-off-by: prakharagarwal1 <prakharagarwal3031@gmail.com>
  • Loading branch information
Prakhar-Agarwal-byte committed Aug 15, 2023
1 parent 11cfea1 commit 947c436
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions filesystem/replicator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ import (

func TestReplicateProcessFileCallBack(t *testing.T) {
t.Run("test for source file does not exist, should return an error", func(t *testing.T) {
sourceFilePath := "test_data/replicator_test/non_existent_file.txt"
destinationFilePath := "test_data/replicator_test/destination.txt"
sourceFilePath := "testdata/replicator_test/non_existent_file.txt"
destinationFilePath := "testdata/replicator_test/destination.txt"
err := replicateProcessFileCallBack(sourceFilePath, destinationFilePath, nil)
if err == nil {
t.Errorf("Expected error for non-existent source file, got nil")
}
})

t.Run("test for destination file doesn't exist, should copy the source file", func(t *testing.T) {
sourceFilePath := "test_data/replicator_test/emptyfile.txt"
destinationFilePath := "test_data/replicator_test/destination_file.txt"
sourceFilePath := "testdata/replicator_test/emptyfile.txt"
destinationFilePath := "testdata/replicator_test/destination_file.txt"

err := replicateProcessFileCallBack(sourceFilePath, destinationFilePath, nil)
if err != nil {
Expand All @@ -46,8 +46,8 @@ import (
})

t.Run("test for destination file exists but is different, should copy the source file", func(t *testing.T) {
sourceFilePath := "test_data/replicator_test/source_file.txt"
destinationFilePath := "test_data/replicator_test/destination_file.txt"
sourceFilePath := "testdata/replicator_test/source_file.txt"
destinationFilePath := "testdata/replicator_test/destination_file.txt"

sourceFile, err := os.Create(sourceFilePath)
if err != nil {
Expand Down Expand Up @@ -99,8 +99,8 @@ import (
})

t.Run("test for destination file exists and is the same, should return nil without copying", func(t *testing.T) {
sourceFilePath := "test_data/replicator_test/source_same.txt"
destinationFilePath := "test_data/replicator_test/destination_same.txt"
sourceFilePath := "testdata/replicator_test/source_same.txt"
destinationFilePath := "testdata/replicator_test/destination_same.txt"

// Store the destination file's modification time before calling replicateProcessFileCallBack
info, err := os.Stat(destinationFilePath)
Expand Down
6 changes: 3 additions & 3 deletions filesystem/templatecopy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestTemplateCopy(t *testing.T) {
testfilledFile := "test_filled.yaml"
testDataFile := "test.yaml"
templateDir := "template"
testDir := "test_data"
testDir := "testdata"
sourceFilePath := filepath.Join(testDir, templateDir, testDataFile)
src, err := os.ReadFile(sourceFilePath)
if err != nil {
Expand Down Expand Up @@ -84,7 +84,7 @@ func TestTemplateCopy(t *testing.T) {
addOnConfig := AddOnConfig{Config: TestTPLValues{TplVariable: "world"}}
testDataFile := "test.yaml"
sourceTestDir := "template"
testDataDir := "test_data"
testDataDir := "testdata"
sourceFilePath := filepath.Join(testDataDir, sourceTestDir, testDataFile)
destTempDir, err := ioutil.TempDir("", "destTempDir")
if err != nil {
Expand All @@ -105,7 +105,7 @@ func TestTemplateCopy(t *testing.T) {
addOnConfig := AddOnConfig{Config: TestTPLValues{TplVariable: "World"}}
testDataFile := "test.yaml"
sourceTestDir := "template"
testDataDir := "test_data"
testDataDir := "testdata"
sourceFilePath := filepath.Join(testDataDir, sourceTestDir, testDataFile)
destTempDir, err := ioutil.TempDir("", "destTempDir")
if err != nil {
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion filesystem/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestFileSystemUtils(t *testing.T) {
t.Fatal("Error creating temp directory:", err)
}
defer os.RemoveAll(destTempDir)
testDataDir := "test_data"
testDataDir := "testdata"
sourceTempDir := "copyfile"

destFilePath := filepath.Join(destTempDir, testDataFile)
Expand Down

0 comments on commit 947c436

Please sign in to comment.