Merge qemu test

This commit is contained in:
Alex Dadgar
2015-09-25 16:49:14 -07:00
parent 9caa7ac077
commit 8a5e65e27a
23 changed files with 510 additions and 153 deletions

View File

@@ -1,16 +1,18 @@
package driver
import (
"os"
"testing"
"time"
"github.com/hashicorp/nomad/client/config"
"github.com/hashicorp/nomad/nomad/structs"
ctestutils "github.com/hashicorp/nomad/client/testutil"
)
func TestJavaDriver_Fingerprint(t *testing.T) {
d := NewJavaDriver(testDriverContext())
ctestutils.ExecCompatible(t)
d := NewJavaDriver(testDriverContext(""))
node := &structs.Node{
Attributes: make(map[string]string),
}
@@ -31,18 +33,27 @@ func TestJavaDriver_Fingerprint(t *testing.T) {
}
}
func TestJavaDriver_StartOpen_Wait(t *testing.T) {
ctx := NewExecContext()
ctx.AllocDir = os.TempDir()
d := NewJavaDriver(testDriverContext())
/*
TODO: This test is disabled til a follow-up api changes the restore state interface.
The driver/executor interface will be changed from Open to Cleanup, in which
clean-up tears down previous allocs.
func TestJavaDriver_StartOpen_Wait(t *testing.T) {
ctestutils.ExecCompatible(t)
task := &structs.Task{
Name: "demo-app",
Config: map[string]string{
"jar_source": "https://dl.dropboxusercontent.com/u/47675/jar_thing/demoapp.jar",
// "jar_source": "https://s3-us-west-2.amazonaws.com/java-jar-thing/demoapp.jar",
// "args": "-d64",
},
}
driverCtx := testDriverContext(task.Name)
ctx := testDriverExecContext(task, driverCtx)
defer ctx.AllocDir.Destroy()
d := NewJavaDriver(driverCtx)
handle, err := d.Start(ctx, task)
if err != nil {
t.Fatalf("err: %v", err)
@@ -67,19 +78,24 @@ func TestJavaDriver_StartOpen_Wait(t *testing.T) {
t.Fatalf("Error: %s", err)
}
}
*/
func TestJavaDriver_Start_Wait(t *testing.T) {
ctx := NewExecContext()
ctx.AllocDir = os.TempDir()
d := NewJavaDriver(testDriverContext())
ctestutils.ExecCompatible(t)
task := &structs.Task{
Name: "demo-app",
Config: map[string]string{
"jar_source": "https://dl.dropboxusercontent.com/u/47675/jar_thing/demoapp.jar",
// "jar_source": "https://s3-us-west-2.amazonaws.com/java-jar-thing/demoapp.jar",
// "args": "-d64",
},
}
driverCtx := testDriverContext(task.Name)
ctx := testDriverExecContext(task, driverCtx)
defer ctx.AllocDir.Destroy()
d := NewJavaDriver(driverCtx)
handle, err := d.Start(ctx, task)
if err != nil {
t.Fatalf("err: %v", err)
@@ -107,17 +123,21 @@ func TestJavaDriver_Start_Wait(t *testing.T) {
}
func TestJavaDriver_Start_Kill_Wait(t *testing.T) {
ctx := NewExecContext()
ctx.AllocDir = os.TempDir()
d := NewJavaDriver(testDriverContext())
ctestutils.ExecCompatible(t)
task := &structs.Task{
Name: "demo-app",
Config: map[string]string{
"jar_source": "https://dl.dropboxusercontent.com/u/47675/jar_thing/demoapp.jar",
// "jar_source": "https://s3-us-west-2.amazonaws.com/java-jar-thing/demoapp.jar",
// "args": "-d64",
},
}
driverCtx := testDriverContext(task.Name)
ctx := testDriverExecContext(task, driverCtx)
defer ctx.AllocDir.Destroy()
d := NewJavaDriver(driverCtx)
handle, err := d.Start(ctx, task)
if err != nil {
t.Fatalf("err: %v", err)
@@ -150,7 +170,3 @@ func TestJavaDriver_Start_Kill_Wait(t *testing.T) {
t.Fatalf("Error: %s", err)
}
}
func cleanupFile(path string) error {
return nil
}