From bed83b0b64058b1725c915ed35fe93c554aa176d Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sun, 25 Oct 2020 16:15:41 +0000 Subject: [PATCH] test: add ListRetries config parameter to integration tests Occasionally the b2 tests fail because the integration tests don't retry hard enough with their new setting of -list-retries 3. Override this setting to 5 for the b2 tests only. --- fstest/test_all/config.go | 40 +++++++++++++++++++------------------ fstest/test_all/config.yaml | 1 + fstest/test_all/run.go | 29 ++++++++++++++++----------- 3 files changed, 39 insertions(+), 31 deletions(-) diff --git a/fstest/test_all/config.go b/fstest/test_all/config.go index ab271b58d..9d3440d15 100644 --- a/fstest/test_all/config.go +++ b/fstest/test_all/config.go @@ -27,15 +27,16 @@ type Test struct { // // FIXME make bucket based remotes set sub-dir automatically??? type Backend struct { - Backend string // name of the backend directory - Remote string // name of the test remote - FastList bool // set to test with -fast-list - Short bool // set to test with -short - OneOnly bool // set to run only one backend test at once - MaxFile string // file size limit - CleanUp bool // when running clean, run cleanup first - Ignore []string // test names to ignore the failure of - Tests []string // paths of tests to run, blank for all + Backend string // name of the backend directory + Remote string // name of the test remote + FastList bool // set to test with -fast-list + Short bool // set to test with -short + OneOnly bool // set to run only one backend test at once + MaxFile string // file size limit + CleanUp bool // when running clean, run cleanup first + Ignore []string // test names to ignore the failure of + Tests []string // paths of tests to run, blank for all + ListRetries int // -list-retries if > 0 } // includeTest returns true if this backend should be included in this @@ -79,16 +80,17 @@ func (b *Backend) MakeRuns(t *Test) (runs []*Run) { continue } run := &Run{ - Remote: b.Remote, - Backend: b.Backend, - Path: t.Path, - FastList: fastlist, - Short: (b.Short && t.Short), - NoRetries: t.NoRetries, - OneOnly: b.OneOnly, - NoBinary: t.NoBinary, - SizeLimit: int64(maxSize), - Ignore: ignore, + Remote: b.Remote, + Backend: b.Backend, + Path: t.Path, + FastList: fastlist, + Short: (b.Short && t.Short), + NoRetries: t.NoRetries, + OneOnly: b.OneOnly, + NoBinary: t.NoBinary, + SizeLimit: int64(maxSize), + Ignore: ignore, + ListRetries: b.ListRetries, } if t.AddBackend { run.Path = path.Join(run.Path, b.Backend) diff --git a/fstest/test_all/config.yaml b/fstest/test_all/config.yaml index 6086f5159..44a74ff46 100644 --- a/fstest/test_all/config.yaml +++ b/fstest/test_all/config.yaml @@ -20,6 +20,7 @@ backends: - backend: "b2" remote: "TestB2:" fastlist: true + listretries: 5 - backend: "crypt" remote: "TestCryptDrive:" fastlist: true diff --git a/fstest/test_all/run.go b/fstest/test_all/run.go index e4f8b2ee8..89cb96070 100644 --- a/fstest/test_all/run.go +++ b/fstest/test_all/run.go @@ -35,16 +35,17 @@ var ( // if retries are needed. type Run struct { // Config - Remote string // name of the test remote - Backend string // name of the backend - Path string // path to the source directory - FastList bool // add -fast-list to tests - Short bool // add -short - NoRetries bool // don't retry if set - OneOnly bool // only run test for this backend at once - NoBinary bool // set to not build a binary - SizeLimit int64 // maximum test file size - Ignore map[string]struct{} + Remote string // name of the test remote + Backend string // name of the backend + Path string // path to the source directory + FastList bool // add -fast-list to tests + Short bool // add -short + NoRetries bool // don't retry if set + OneOnly bool // only run test for this backend at once + NoBinary bool // set to not build a binary + SizeLimit int64 // maximum test file size + Ignore map[string]struct{} + ListRetries int // -list-retries if > 0 // Internals CmdLine []string CmdString string @@ -336,8 +337,12 @@ func (r *Run) Init() { r.CmdLine = []string{"./" + r.BinaryName()} } r.CmdLine = append(r.CmdLine, prefix+"v", prefix+"timeout", timeout.String(), "-remote", r.Remote) - if *listRetries > 0 { - r.CmdLine = append(r.CmdLine, "-list-retries", fmt.Sprint(*listRetries)) + listRetries := *listRetries + if r.ListRetries > 0 { + listRetries = r.ListRetries + } + if listRetries > 0 { + r.CmdLine = append(r.CmdLine, "-list-retries", fmt.Sprint(listRetries)) } r.Try = 1 if *verbose {