[arvados] updated: 2.1.0-2784-g711d8642c

git repository hosting git at public.arvados.org
Mon Jul 25 18:05:19 UTC 2022


Summary of changes:
 lib/crunchrun/executor_test.go | 17 +++++++++++++++++
 lib/diagnostics/cmd.go         |  8 ++++----
 2 files changed, 21 insertions(+), 4 deletions(-)

       via  711d8642c478c29ffd4c9bc6facbf3bd4d168763 (commit)
      from  32b402114038bc6761c04c370afad786dbbb3125 (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 711d8642c478c29ffd4c9bc6facbf3bd4d168763
Author: Tom Clegg <tom at curii.com>
Date:   Mon Jul 25 14:04:21 2022 -0400

    19281: Test embedded hello-world image with docker and singularity.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/lib/crunchrun/executor_test.go b/lib/crunchrun/executor_test.go
index ea6e610d8..e757f579f 100644
--- a/lib/crunchrun/executor_test.go
+++ b/lib/crunchrun/executor_test.go
@@ -8,12 +8,14 @@ import (
 	"bytes"
 	"fmt"
 	"io"
+	"io/ioutil"
 	"net"
 	"net/http"
 	"os"
 	"strings"
 	"time"
 
+	"git.arvados.org/arvados.git/lib/diagnostics"
 	"git.arvados.org/arvados.git/sdk/go/arvados"
 	"git.arvados.org/arvados.git/sdk/go/arvadostest"
 	"golang.org/x/net/context"
@@ -63,6 +65,21 @@ func (s *executorSuite) TestExecTrivialContainer(c *C) {
 	c.Check(s.stderr.String(), Equals, "")
 }
 
+func (s *executorSuite) TestDiagnosticsImage(c *C) {
+	s.newExecutor(c)
+	imagefile := c.MkDir() + "/hello-world.tar"
+	err := ioutil.WriteFile(imagefile, diagnostics.HelloWorldDockerImage, 0777)
+	c.Assert(err, IsNil)
+	err = s.executor.LoadImage("", imagefile, arvados.Container{}, "", nil)
+	c.Assert(err, IsNil)
+
+	c.Logf("Using container runtime: %s", s.executor.Runtime())
+	s.spec.Image = "hello-world"
+	s.spec.Command = []string{"/hello"}
+	s.checkRun(c, 0)
+	c.Check(s.stdout.String(), Matches, `(?ms)\nHello from Docker!\n.*`)
+}
+
 func (s *executorSuite) TestExitStatus(c *C) {
 	s.spec.Command = []string{"false"}
 	s.checkRun(c, 1)
diff --git a/lib/diagnostics/cmd.go b/lib/diagnostics/cmd.go
index b381a3c8c..86adc325d 100644
--- a/lib/diagnostics/cmd.go
+++ b/lib/diagnostics/cmd.go
@@ -59,7 +59,7 @@ func (Command) RunCommand(prog string, args []string, stdin io.Reader, stdout, s
 
 // docker save hello-world > hello-world.tar
 //go:embed hello-world.tar
-var helloWorldDockerImage []byte
+var HelloWorldDockerImage []byte
 
 type diagnoser struct {
 	stdout        io.Writer
@@ -378,7 +378,7 @@ func (diag *diagnoser) runtests() {
 	// as "sha256:{...}.tar"
 	var imageSHA2 string
 	{
-		tr := tar.NewReader(bytes.NewReader(helloWorldDockerImage))
+		tr := tar.NewReader(bytes.NewReader(HelloWorldDockerImage))
 		for {
 			hdr, err := tr.Next()
 			if err == io.EOF {
@@ -404,7 +404,7 @@ func (diag *diagnoser) runtests() {
 		if collection.UUID == "" {
 			return fmt.Errorf("skipping, no test collection")
 		}
-		req, err := http.NewRequestWithContext(ctx, "PUT", cluster.Services.WebDAVDownload.ExternalURL.String()+"c="+collection.UUID+"/sha256:"+imageSHA2+".tar", bytes.NewReader(helloWorldDockerImage))
+		req, err := http.NewRequestWithContext(ctx, "PUT", cluster.Services.WebDAVDownload.ExternalURL.String()+"c="+collection.UUID+"/sha256:"+imageSHA2+".tar", bytes.NewReader(HelloWorldDockerImage))
 		if err != nil {
 			return fmt.Errorf("BUG? http.NewRequest: %s", err)
 		}
@@ -478,7 +478,7 @@ func (diag *diagnoser) runtests() {
 			if resp.StatusCode != trial.status {
 				return fmt.Errorf("unexpected response status: %s", resp.Status)
 			}
-			if trial.status == http.StatusOK && !bytes.Equal(body, helloWorldDockerImage) {
+			if trial.status == http.StatusOK && !bytes.Equal(body, HelloWorldDockerImage) {
 				excerpt := body
 				if len(excerpt) > 128 {
 					excerpt = append([]byte(nil), body[:128]...)

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list