[arvados] updated: 2.5.0-42-g1ddc21430
git repository hosting
git at public.arvados.org
Fri Jan 27 16:07:24 UTC 2023
Summary of changes:
services/keep-balance/balance.go | 9 ++++++++-
services/keep-balance/balance_run_test.go | 31 +++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+), 1 deletion(-)
via 1ddc21430ede024aa6841e6c49deafe87788c287 (commit)
via c78c9ff6942cfe6fad3f4035bbef0c779c5659fa (commit)
from 7fd14a123d0099c5dcfb0646125afa0b643bd6d2 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 1ddc21430ede024aa6841e6c49deafe87788c287
Author: Tom Clegg <tom at curii.com>
Date: Fri Jan 27 11:01:15 2023 -0500
19923: Sanity check provided chunk prefix.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>
diff --git a/services/keep-balance/balance.go b/services/keep-balance/balance.go
index a0b888a51..ef15ea070 100644
--- a/services/keep-balance/balance.go
+++ b/services/keep-balance/balance.go
@@ -275,6 +275,14 @@ func (bal *Balancer) CheckSanityEarly(c *arvados.Client) error {
return fmt.Errorf("config error: %s: proxy servers cannot be balanced", srv)
}
}
+ for _, c := range bal.ChunkPrefix {
+ if !strings.ContainsRune("0123456789abcdef", c) {
+ return fmt.Errorf("invalid char %q in chunk prefix %q: only lowercase hex digits make sense", string(c), bal.ChunkPrefix)
+ }
+ }
+ if len(bal.ChunkPrefix) > 32 {
+ return fmt.Errorf("invalid chunk prefix %q: longer than a block hash", bal.ChunkPrefix)
+ }
mountProblem := false
type deviceMount struct {
diff --git a/services/keep-balance/balance_run_test.go b/services/keep-balance/balance_run_test.go
index 5c9a648b7..fb1c74d2f 100644
--- a/services/keep-balance/balance_run_test.go
+++ b/services/keep-balance/balance_run_test.go
@@ -450,6 +450,37 @@ func (s *runSuite) TestRefuseNonAdmin(c *check.C) {
c.Check(pullReqs.Count(), check.Equals, 0)
}
+func (s *runSuite) TestInvalidChunkPrefix(c *check.C) {
+ for _, trial := range []struct {
+ prefix string
+ errRe string
+ }{
+ {"123ABC", "invalid char \"A\" in chunk prefix.*"},
+ {"123xyz", "invalid char \"x\" in chunk prefix.*"},
+ {"123456789012345678901234567890123", "invalid chunk prefix .* longer than a block hash"},
+ } {
+ s.SetUpTest(c)
+ c.Logf("trying invalid prefix %q", trial.prefix)
+ opts := RunOptions{
+ CommitPulls: true,
+ CommitTrash: true,
+ ChunkPrefix: trial.prefix,
+ Logger: ctxlog.TestLogger(c),
+ }
+ s.stub.serveCurrentUserAdmin()
+ s.stub.serveFooBarFileCollections()
+ s.stub.serveKeepServices(stubServices)
+ s.stub.serveKeepstoreMounts()
+ trashReqs := s.stub.serveKeepstoreTrash()
+ pullReqs := s.stub.serveKeepstorePull()
+ srv := s.newServer(&opts)
+ _, err := srv.runOnce(context.Background())
+ c.Check(err, check.ErrorMatches, trial.errRe)
+ c.Check(trashReqs.Count(), check.Equals, 0)
+ c.Check(pullReqs.Count(), check.Equals, 0)
+ }
+}
+
func (s *runSuite) TestRefuseSameDeviceDifferentVolumes(c *check.C) {
opts := RunOptions{
CommitPulls: true,
commit c78c9ff6942cfe6fad3f4035bbef0c779c5659fa
Author: Tom Clegg <tom at curii.com>
Date: Fri Jan 27 10:50:29 2023 -0500
19923: Remove debug sleep.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>
diff --git a/services/keep-balance/balance.go b/services/keep-balance/balance.go
index 317121450..a0b888a51 100644
--- a/services/keep-balance/balance.go
+++ b/services/keep-balance/balance.go
@@ -156,7 +156,6 @@ func (bal *Balancer) Run(ctx context.Context, client *arvados.Client, cluster *a
return
}
bal.ComputeChangeSets()
- time.Sleep(time.Second)
bal.PrintStatistics()
if err = bal.CheckSanityLate(); err != nil {
return
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list