From 23e740433d6a92c06068923ab58232a19c7a5acb Mon Sep 17 00:00:00 2001 From: Samantha Sample Date: Mon, 5 Aug 2019 16:09:58 -0700 Subject: Expand runtimes test suite to include Go, Java, PHP, and Python. This change adds functionality for running more languages using the runtimes test suite. It divides the languages into separate test functions, which each call the helper testLang function in the runtimes_test.go file. This allows them to be run individually or as a group. PiperOrigin-RevId: 261791935 --- test/runtimes/runtimes_test.go | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/runtimes/runtimes_test.go b/test/runtimes/runtimes_test.go index 6bf954e78..43dd6f5b7 100644 --- a/test/runtimes/runtimes_test.go +++ b/test/runtimes/runtimes_test.go @@ -22,8 +22,16 @@ import ( "gvisor.dev/gvisor/runsc/test/testutil" ) -func TestNodeJS(t *testing.T) { - const img = "gcr.io/gvisor-proctor/nodejs" +// Wait time for each test to run. +const timeout = 180 * time.Second + +// Helper function to execute the docker container associated with the +// language passed. Captures the output of the list function and executes +// each test individually, supplying any errors recieved. +func testLang(t *testing.T, lang string) { + t.Helper() + + img := "gcr.io/gvisor-presubmit/" + lang if err := testutil.Pull(img); err != nil { t.Fatalf("docker pull failed: %v", err) } @@ -49,7 +57,7 @@ func TestNodeJS(t *testing.T) { } defer d.CleanUp() - status, err := d.Wait(60 * time.Second) + status, err := d.Wait(timeout) if err != nil { t.Fatalf("docker test %q failed to wait: %v", tc, err) } @@ -65,3 +73,23 @@ func TestNodeJS(t *testing.T) { }) } } + +func TestGo(t *testing.T) { + testLang(t, "go") +} + +func TestJava(t *testing.T) { + testLang(t, "java") +} + +func TestNodejs(t *testing.T) { + testLang(t, "nodejs") +} + +func TestPhp(t *testing.T) { + testLang(t, "php") +} + +func TestPython(t *testing.T) { + testLang(t, "python") +} -- cgit v1.2.3