[arvados] updated: 2.6.0-194-gaec8a66de
git repository hosting
git at public.arvados.org
Thu May 25 18:43:35 UTC 2023
Summary of changes:
lib/dispatchcloud/test/stub_driver.go | 17 ++++++++++++++---
lib/dispatchcloud/worker/pool_test.go | 4 ++++
2 files changed, 18 insertions(+), 3 deletions(-)
via aec8a66deeff226db672351cd3ab803bf01a186d (commit)
from 45b46550ecadf69a09390b4cefe3f16d5c1c7453 (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 aec8a66deeff226db672351cd3ab803bf01a186d
Author: Tom Clegg <tom at curii.com>
Date: Thu May 25 14:42:15 2023 -0400
20520: Add test for custom init command.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>
diff --git a/lib/dispatchcloud/test/stub_driver.go b/lib/dispatchcloud/test/stub_driver.go
index 01af8e6d5..e91878527 100644
--- a/lib/dispatchcloud/test/stub_driver.go
+++ b/lib/dispatchcloud/test/stub_driver.go
@@ -108,7 +108,7 @@ type StubInstanceSet struct {
lastInstanceID int
}
-func (sis *StubInstanceSet) Create(it arvados.InstanceType, image cloud.ImageID, tags cloud.InstanceTags, cmd cloud.InitCommand, authKey ssh.PublicKey) (cloud.Instance, error) {
+func (sis *StubInstanceSet) Create(it arvados.InstanceType, image cloud.ImageID, tags cloud.InstanceTags, initCommand cloud.InitCommand, authKey ssh.PublicKey) (cloud.Instance, error) {
if sis.driver.HoldCloudOps {
sis.driver.holdCloudOps <- true
}
@@ -127,11 +127,11 @@ func (sis *StubInstanceSet) Create(it arvados.InstanceType, image cloud.ImageID,
}
sis.lastInstanceID++
svm := &StubVM{
+ InitCommand: initCommand,
sis: sis,
id: cloud.InstanceID(fmt.Sprintf("inst%d,%s", sis.lastInstanceID, it.ProviderType)),
tags: copyTags(tags),
providerType: it.ProviderType,
- initCommand: cmd,
running: map[string]stubProcess{},
killing: map[string]bool{},
}
@@ -171,6 +171,15 @@ func (sis *StubInstanceSet) Stop() {
sis.stopped = true
}
+func (sis *StubInstanceSet) StubVMs() (svms []*StubVM) {
+ sis.mtx.Lock()
+ defer sis.mtx.Unlock()
+ for _, vm := range sis.servers {
+ svms = append(svms, vm)
+ }
+ return
+}
+
type RateLimitError struct{ Retry time.Time }
func (e RateLimitError) Error() string { return fmt.Sprintf("rate limited until %s", e.Retry) }
@@ -196,10 +205,12 @@ type StubVM struct {
CrashRunningContainer func(arvados.Container)
ExtraCrunchRunArgs string // extra args expected after "crunch-run --detach --stdin-config "
+ // Populated by (*StubInstanceSet)Create()
+ InitCommand cloud.InitCommand
+
sis *StubInstanceSet
id cloud.InstanceID
tags cloud.InstanceTags
- initCommand cloud.InitCommand
providerType string
SSHService SSHService
running map[string]stubProcess
diff --git a/lib/dispatchcloud/worker/pool_test.go b/lib/dispatchcloud/worker/pool_test.go
index 7b5634605..7f3a1531e 100644
--- a/lib/dispatchcloud/worker/pool_test.go
+++ b/lib/dispatchcloud/worker/pool_test.go
@@ -266,6 +266,7 @@ func (suite *PoolSuite) TestCreateUnallocShutdown(c *check.C) {
type2.Name: type2,
type3.Name: type3,
},
+ instanceInitCommand: "echo 'instance init command goes here'",
}
notify := pool.Subscribe()
defer pool.Unsubscribe(notify)
@@ -294,6 +295,9 @@ func (suite *PoolSuite) TestCreateUnallocShutdown(c *check.C) {
return len(pool.workers) == 4
})
+ vms := instanceSet.(*test.StubInstanceSet).StubVMs()
+ c.Check(string(vms[0].InitCommand), check.Matches, `umask 0177 && echo -n "[0-9a-f]+" >/var/run/arvados-instance-secret\necho 'instance init command goes here'`)
+
// Place type3 node on admin-hold
ivs := suite.instancesByType(pool, type3)
c.Assert(ivs, check.HasLen, 1)
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list