From 4ab235c06c9c4852e260428f62ff7e35e2b52cd9 Mon Sep 17 00:00:00 2001 From: Dan McArdle Date: Thu, 11 Apr 2024 10:47:03 -0400 Subject: [PATCH] cmd/gitannex: Repeat TestEndToEnd for all layout modes I'm hopeful that running these in parallel will not impact CI runtime very much, but that likely depends on the number of CPU cores and whether the tmp filesystem is backed by memory vs a physical disk. Issue #7625 --- cmd/gitannex/e2e_test.go | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/cmd/gitannex/e2e_test.go b/cmd/gitannex/e2e_test.go index c989168a2..eda888c6b 100644 --- a/cmd/gitannex/e2e_test.go +++ b/cmd/gitannex/e2e_test.go @@ -220,23 +220,31 @@ func skipE2eTestIfNecessary(t *testing.T) { func TestEndToEnd(t *testing.T) { skipE2eTestIfNecessary(t) - // Create a temp directory and chdir there, just in case. - originalWd, err := os.Getwd() - require.NoError(t, err) - tempDir := t.TempDir() - require.NoError(t, os.Chdir(tempDir)) - defer func() { require.NoError(t, os.Chdir(originalWd)) }() + for _, mode := range allLayoutModes() { + mode := mode + t.Run(string(mode), func(t *testing.T) { + t.Parallel() - testingContext := makeE2eTestingContext(t) - testingContext.installRcloneGitannexSymlink(t) - testingContext.installRcloneConfig(t) - testingContext.createGitRepo(t) + // Create a temp directory and chdir there, just in case. + originalWd, err := os.Getwd() + require.NoError(t, err) + tempDir := t.TempDir() + require.NoError(t, os.Chdir(tempDir)) + t.Cleanup(func() { require.NoError(t, os.Chdir(originalWd)) }) - testingContext.runInRepo(t, "git", "annex", "initremote", "MyTestRemote", - "type=external", "externaltype=rclone-builtin", "encryption=none", - "rcloneremotename=MyRcloneRemote", "rcloneprefix="+testingContext.ephemeralRepoDir) + testingContext := makeE2eTestingContext(t) + testingContext.installRcloneGitannexSymlink(t) + testingContext.installRcloneConfig(t) + testingContext.createGitRepo(t) - testingContext.runInRepo(t, "git", "annex", "testremote", "MyTestRemote") + testingContext.runInRepo(t, "git", "annex", "initremote", "MyTestRemote", + "type=external", "externaltype=rclone-builtin", "encryption=none", + "rcloneremotename=MyRcloneRemote", "rcloneprefix="+testingContext.ephemeralRepoDir, + "rclonelayout="+string(mode)) + + testingContext.runInRepo(t, "git", "annex", "testremote", "MyTestRemote") + }) + } } // For each layout mode, ensure that we're compatible with data written by