forked from TrueCloudLab/rclone
gitannex: make tests run more quietly - use go test -v for more info
These tests were generating 1000s of lines of logs and making it difficult to figure out what was failing in other tests.
This commit is contained in:
parent
ae887ad042
commit
1aa3a37a28
1 changed files with 7 additions and 5 deletions
|
@ -93,6 +93,7 @@ func findFileWithContents(t *testing.T, dir string, wantContents []byte) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
type e2eTestingContext struct {
|
type e2eTestingContext struct {
|
||||||
|
t *testing.T
|
||||||
tempDir string
|
tempDir string
|
||||||
binDir string
|
binDir string
|
||||||
homeDir string
|
homeDir string
|
||||||
|
@ -126,7 +127,7 @@ func makeE2eTestingContext(t *testing.T) e2eTestingContext {
|
||||||
require.NoError(t, os.Mkdir(dir, 0700))
|
require.NoError(t, os.Mkdir(dir, 0700))
|
||||||
}
|
}
|
||||||
|
|
||||||
return e2eTestingContext{tempDir, binDir, homeDir, configDir, rcloneConfigDir, ephemeralRepoDir}
|
return e2eTestingContext{t, tempDir, binDir, homeDir, configDir, rcloneConfigDir, ephemeralRepoDir}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Install the symlink that enables git-annex to invoke "rclone gitannex"
|
// Install the symlink that enables git-annex to invoke "rclone gitannex"
|
||||||
|
@ -154,16 +155,17 @@ func (e *e2eTestingContext) installRcloneConfig(t *testing.T) {
|
||||||
// variable to a subdirectory of the temp directory. It also ensures that the
|
// variable to a subdirectory of the temp directory. It also ensures that the
|
||||||
// git-annex-remote-rclone-builtin symlink will be found by extending the PATH.
|
// git-annex-remote-rclone-builtin symlink will be found by extending the PATH.
|
||||||
func (e *e2eTestingContext) runInRepo(t *testing.T, command string, args ...string) {
|
func (e *e2eTestingContext) runInRepo(t *testing.T, command string, args ...string) {
|
||||||
fmt.Printf("+ %s %v\n", command, args)
|
if testing.Verbose() {
|
||||||
|
t.Logf("Running %s %v\n", command, args)
|
||||||
|
}
|
||||||
cmd := exec.Command(command, args...)
|
cmd := exec.Command(command, args...)
|
||||||
cmd.Dir = e.ephemeralRepoDir
|
cmd.Dir = e.ephemeralRepoDir
|
||||||
cmd.Env = []string{
|
cmd.Env = []string{
|
||||||
"HOME=" + e.homeDir,
|
"HOME=" + e.homeDir,
|
||||||
"PATH=" + os.Getenv("PATH") + ":" + e.binDir,
|
"PATH=" + os.Getenv("PATH") + ":" + e.binDir,
|
||||||
}
|
}
|
||||||
cmd.Stdout = os.Stdout
|
buf, err := cmd.CombinedOutput()
|
||||||
cmd.Stderr = os.Stderr
|
require.NoError(t, err, fmt.Sprintf("+ %s %v failed:\n%s\n", command, args, buf))
|
||||||
require.NoError(t, cmd.Run())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// createGitRepo creates an empty git repository in the ephemeral repo
|
// createGitRepo creates an empty git repository in the ephemeral repo
|
||||||
|
|
Loading…
Add table
Reference in a new issue