[arvados] updated: 2.6.0-425-gad5eb020d

git repository hosting git at public.arvados.org
Tue Aug 8 21:31:56 UTC 2023


Summary of changes:
 lib/cloud/cloudtest/tester.go | 46 +++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 44 insertions(+), 2 deletions(-)

       via  ad5eb020d76da3ef5927b3d8c364390d42493ddd (commit)
      from  6732a23110c9d1c0b4a188d98a81fad4da6705c0 (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 ad5eb020d76da3ef5927b3d8c364390d42493ddd
Author: Tom Clegg <tom at curii.com>
Date:   Tue Aug 8 17:31:24 2023 -0400

    20755: Run cloudtest suite once per configured subnet, not just 1st.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/lib/cloud/cloudtest/tester.go b/lib/cloud/cloudtest/tester.go
index d53cb017e..24a80da38 100644
--- a/lib/cloud/cloudtest/tester.go
+++ b/lib/cloud/cloudtest/tester.go
@@ -55,16 +55,58 @@ type tester struct {
 	failed bool
 }
 
+// Run the test suite once for each applicable permutation of
+// DriverParameters.  Return true if everything worked.
+//
+// Currently this means run once for each configured SubnetID.
+func (t *tester) Run() bool {
+	var dp map[string]interface{}
+	err := json.Unmarshal(t.DriverParameters, &dp)
+	if err != nil {
+		t.Logger.WithError(err).Error("error decoding configured CloudVMs.DriverParameters")
+		return false
+	}
+	subnets, ok := dp["SubnetID"].([]interface{})
+	if !ok || len(subnets) <= 1 {
+		// Easy, only one SubnetID to test.
+		return t.runWithDriverParameters(t.DriverParameters)
+	}
+
+	deferredError := false
+	for i, subnet := range subnets {
+		subnet, ok := subnet.(string)
+		if !ok {
+			t.Logger.Errorf("CloudVMs.DriverParameters.SubnetID[%d] is invalid -- must be a string", i)
+			deferredError = true
+			continue
+		}
+		dp["SubnetID"] = subnet
+		t.Logger.Infof("running tests using SubnetID[%d] %q", i, subnet)
+		dpjson, err := json.Marshal(dp)
+		if err != nil {
+			t.Logger.WithError(err).Error("error encoding driver parameters")
+			deferredError = true
+			continue
+		}
+		ok = t.runWithDriverParameters(dpjson)
+		if !ok {
+			t.Logger.Infof("failed tests using SubnetID[%d] %q", i, subnet)
+			deferredError = true
+		}
+	}
+	return !deferredError
+}
+
 // Run the test suite as specified, clean up as needed, and return
 // true (everything is OK) or false (something went wrong).
-func (t *tester) Run() bool {
+func (t *tester) runWithDriverParameters(driverParameters json.RawMessage) bool {
 	// This flag gets set when we encounter a non-fatal error, so
 	// we can continue doing more tests but remember to return
 	// false (failure) at the end.
 	deferredError := false
 
 	var err error
-	t.is, err = t.Driver.InstanceSet(t.DriverParameters, t.SetID, t.Tags, t.Logger, nil)
+	t.is, err = t.Driver.InstanceSet(driverParameters, t.SetID, t.Tags, t.Logger, nil)
 	if err != nil {
 		t.Logger.WithError(err).Info("error initializing driver")
 		return false

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list