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
This commit is contained in:
parent
960a5e5536
commit
23e740433d
|
@ -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")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue