-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from lomorage/dev
add e2e test script and docker support
- Loading branch information
Showing
37 changed files
with
1,026 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "test/data"] | ||
path = test/data | ||
url = https://github.com/lomorage/homepage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package common | ||
|
||
import ( | ||
"os" | ||
"path/filepath" | ||
"testing" | ||
|
||
"github.com/djherbis/times" | ||
"github.com/sirupsen/logrus" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestKeepDirsTime(t *testing.T) { | ||
logrus.SetLevel(logrus.DebugLevel) | ||
|
||
tmpDir, err := os.MkdirTemp("", "lomotest") | ||
require.Nil(t, err) | ||
|
||
defer os.RemoveAll(tmpDir) | ||
|
||
srcRootDir := "../" | ||
dirs := []string{"cmd/lomob", "test", "test/scripts", "vendor/github.com/golang", | ||
"vendor/github.com/aws", "vendor/github.com/google"} | ||
testDirs := []string{"cmd", "cmd/lomob", "test", "test/scripts", "vendor", "vendor/github.com", | ||
"vendor/github.com/golang", "vendor/github.com/google", "vendor/github.com/aws"} | ||
|
||
dirsMap := map[string]string{} | ||
for _, d := range dirs { | ||
dst := filepath.Join(tmpDir, d) | ||
require.Nil(t, os.MkdirAll(dst, 0755)) | ||
|
||
dirsMap[dst] = filepath.Join(srcRootDir, d) | ||
} | ||
|
||
KeepDirsTime(tmpDir, dirsMap) | ||
|
||
for _, d := range testDirs { | ||
dst := filepath.Join(tmpDir, d) | ||
src := filepath.Join(srcRootDir, d) | ||
|
||
dstStat, err := times.Stat(dst) | ||
require.Nil(t, err) | ||
srcStat, err := times.Stat(src) | ||
require.Nil(t, err) | ||
|
||
require.Equal(t, srcStat.AccessTime(), dstStat.AccessTime(), d) | ||
require.Equal(t, srcStat.ModTime(), dstStat.ModTime(), d) | ||
} | ||
|
||
require.Nil(t, os.RemoveAll(tmpDir)) | ||
} |
Oops, something went wrong.