summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorSamantha Sample <samsample@google.com>2019-08-05 16:09:58 -0700
committergVisor bot <gvisor-bot@google.com>2019-08-05 16:11:18 -0700
commit23e740433d6a92c06068923ab58232a19c7a5acb (patch)
treeb3fbf9b493fe0f8d9fe2e93fa4209978c536a5be /test
parent960a5e5536d5d961028ef60123e3b00ff3c04a56 (diff)
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
Diffstat (limited to 'test')
-rw-r--r--test/runtimes/runtimes_test.go34
1 files changed, 31 insertions, 3 deletions
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")
+}