mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 10:25:42 +03:00
Fixed compilation issues with driver tests
This commit is contained in:
committed by
Alex Dadgar
parent
87f49c4f7f
commit
0d69778873
@@ -94,7 +94,7 @@ func TestDockerDriver_StartOpen_Wait(t *testing.T) {
|
||||
|
||||
task := &structs.Task{
|
||||
Name: "redis-demo",
|
||||
Config: map[string]string{
|
||||
Config: map[string]interface{}{
|
||||
"image": "redis",
|
||||
},
|
||||
Resources: basicResources,
|
||||
@@ -131,7 +131,7 @@ func TestDockerDriver_Start_Wait(t *testing.T) {
|
||||
|
||||
task := &structs.Task{
|
||||
Name: "redis-demo",
|
||||
Config: map[string]string{
|
||||
Config: map[string]interface{}{
|
||||
"image": "redis",
|
||||
"command": "redis-server",
|
||||
"args": "-v",
|
||||
@@ -184,7 +184,7 @@ func TestDockerDriver_Start_Wait_AllocDir(t *testing.T) {
|
||||
file := "output.txt"
|
||||
task := &structs.Task{
|
||||
Name: "redis-demo",
|
||||
Config: map[string]string{
|
||||
Config: map[string]interface{}{
|
||||
"image": "redis",
|
||||
"command": "/bin/bash",
|
||||
"args": fmt.Sprintf(`-c "sleep 1; echo -n %s > $%s/%s"`, string(exp), environment.AllocDir, file),
|
||||
@@ -237,7 +237,7 @@ func TestDockerDriver_Start_Kill_Wait(t *testing.T) {
|
||||
|
||||
task := &structs.Task{
|
||||
Name: "redis-demo",
|
||||
Config: map[string]string{
|
||||
Config: map[string]interface{}{
|
||||
"image": "redis",
|
||||
"command": "/bin/sleep",
|
||||
"args": "10",
|
||||
@@ -280,7 +280,7 @@ func TestDockerDriver_Start_Kill_Wait(t *testing.T) {
|
||||
func taskTemplate() *structs.Task {
|
||||
return &structs.Task{
|
||||
Name: "redis-demo",
|
||||
Config: map[string]string{
|
||||
Config: map[string]interface{}{
|
||||
"image": "redis",
|
||||
},
|
||||
Resources: &structs.Resources{
|
||||
@@ -289,8 +289,8 @@ func taskTemplate() *structs.Task {
|
||||
Networks: []*structs.NetworkResource{
|
||||
&structs.NetworkResource{
|
||||
IP: "127.0.0.1",
|
||||
ReservedPorts: []int{11110},
|
||||
DynamicPorts: []string{"REDIS"},
|
||||
ReservedPorts: []structs.Port{{"main", 11110}},
|
||||
DynamicPorts: []structs.Port{{"REDIS", 0}},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -303,13 +303,13 @@ func TestDocker_StartN(t *testing.T) {
|
||||
}
|
||||
|
||||
task1 := taskTemplate()
|
||||
task1.Resources.Networks[0].ReservedPorts[0] = 11111
|
||||
task1.Resources.Networks[0].ReservedPorts[0] = structs.Port{"main", 11110}
|
||||
|
||||
task2 := taskTemplate()
|
||||
task2.Resources.Networks[0].ReservedPorts[0] = 22222
|
||||
task2.Resources.Networks[0].ReservedPorts[0] = structs.Port{"main", 22222}
|
||||
|
||||
task3 := taskTemplate()
|
||||
task3.Resources.Networks[0].ReservedPorts[0] = 33333
|
||||
task3.Resources.Networks[0].ReservedPorts[0] = structs.Port{"main", 33333}
|
||||
|
||||
taskList := []*structs.Task{task1, task2, task3}
|
||||
|
||||
@@ -355,15 +355,15 @@ func TestDocker_StartNVersions(t *testing.T) {
|
||||
|
||||
task1 := taskTemplate()
|
||||
task1.Config["image"] = "redis"
|
||||
task1.Resources.Networks[0].ReservedPorts[0] = 11111
|
||||
task1.Resources.Networks[0].ReservedPorts[0] = structs.Port{"main", 11110}
|
||||
|
||||
task2 := taskTemplate()
|
||||
task2.Config["image"] = "redis:latest"
|
||||
task2.Resources.Networks[0].ReservedPorts[0] = 22222
|
||||
task2.Resources.Networks[0].ReservedPorts[0] = structs.Port{"main", 22222}
|
||||
|
||||
task3 := taskTemplate()
|
||||
task3.Config["image"] = "redis:3.0"
|
||||
task3.Resources.Networks[0].ReservedPorts[0] = 33333
|
||||
task3.Resources.Networks[0].ReservedPorts[0] = structs.Port{"main", 33333}
|
||||
|
||||
taskList := []*structs.Task{task1, task2, task3}
|
||||
|
||||
@@ -409,7 +409,7 @@ func TestDockerHostNet(t *testing.T) {
|
||||
|
||||
task := &structs.Task{
|
||||
Name: "redis-demo",
|
||||
Config: map[string]string{
|
||||
Config: map[string]interface{}{
|
||||
"image": "redis",
|
||||
"network_mode": "host",
|
||||
},
|
||||
|
||||
@@ -18,8 +18,8 @@ var basicResources = &structs.Resources{
|
||||
Networks: []*structs.NetworkResource{
|
||||
&structs.NetworkResource{
|
||||
IP: "0.0.0.0",
|
||||
ReservedPorts: []int{12345},
|
||||
DynamicPorts: []string{"HTTP"},
|
||||
ReservedPorts: []structs.Port{{"main", 12345}},
|
||||
DynamicPorts: []structs.Port{{"HTTP", 0}},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -60,8 +60,8 @@ func TestDriver_TaskEnvironmentVariables(t *testing.T) {
|
||||
Networks: []*structs.NetworkResource{
|
||||
&structs.NetworkResource{
|
||||
IP: "1.2.3.4",
|
||||
ReservedPorts: []int{80, 443, 8080, 12345},
|
||||
DynamicPorts: []string{"admin", "5000"},
|
||||
ReservedPorts: []structs.Port{{"one", 80}, {"two", 443}, {"three", 8080}, {"four", 12345}},
|
||||
DynamicPorts: []structs.Port{{"admin", 8081}, {"web", 8086}},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -37,7 +37,7 @@ func TestExecDriver_StartOpen_Wait(t *testing.T) {
|
||||
ctestutils.ExecCompatible(t)
|
||||
task := &structs.Task{
|
||||
Name: "sleep",
|
||||
Config: map[string]string{
|
||||
Config: map[string]interface{}{
|
||||
"command": "/bin/sleep",
|
||||
"args": "5",
|
||||
},
|
||||
@@ -71,7 +71,7 @@ func TestExecDriver_Start_Wait(t *testing.T) {
|
||||
ctestutils.ExecCompatible(t)
|
||||
task := &structs.Task{
|
||||
Name: "sleep",
|
||||
Config: map[string]string{
|
||||
Config: map[string]interface{}{
|
||||
"command": "/bin/sleep",
|
||||
"args": "2",
|
||||
},
|
||||
@@ -115,7 +115,7 @@ func TestExecDriver_Start_Artifact_basic(t *testing.T) {
|
||||
|
||||
task := &structs.Task{
|
||||
Name: "sleep",
|
||||
Config: map[string]string{
|
||||
Config: map[string]interface{}{
|
||||
"artifact_source": fmt.Sprintf("https://dl.dropboxusercontent.com/u/47675/jar_thing/%s?checksum=%s", file, checksum),
|
||||
"command": filepath.Join("$NOMAD_TASK_DIR", file),
|
||||
},
|
||||
@@ -158,7 +158,7 @@ func TestExecDriver_Start_Artifact_expanded(t *testing.T) {
|
||||
|
||||
task := &structs.Task{
|
||||
Name: "sleep",
|
||||
Config: map[string]string{
|
||||
Config: map[string]interface{}{
|
||||
"artifact_source": fmt.Sprintf("https://dl.dropboxusercontent.com/u/47675/jar_thing/%s", file),
|
||||
"command": "/bin/bash",
|
||||
"args": fmt.Sprintf("-c '/bin/sleep 1 && %s'", filepath.Join("$NOMAD_TASK_DIR", file)),
|
||||
@@ -202,7 +202,7 @@ func TestExecDriver_Start_Wait_AllocDir(t *testing.T) {
|
||||
file := "output.txt"
|
||||
task := &structs.Task{
|
||||
Name: "sleep",
|
||||
Config: map[string]string{
|
||||
Config: map[string]interface{}{
|
||||
"command": "/bin/bash",
|
||||
"args": fmt.Sprintf("-c \"sleep 1; echo -n %s > $%s/%s\"", string(exp), environment.AllocDir, file),
|
||||
},
|
||||
@@ -248,7 +248,7 @@ func TestExecDriver_Start_Kill_Wait(t *testing.T) {
|
||||
ctestutils.ExecCompatible(t)
|
||||
task := &structs.Task{
|
||||
Name: "sleep",
|
||||
Config: map[string]string{
|
||||
Config: map[string]interface{}{
|
||||
"command": "/bin/sleep",
|
||||
"args": "1",
|
||||
},
|
||||
|
||||
@@ -49,7 +49,7 @@ func TestJavaDriver_StartOpen_Wait(t *testing.T) {
|
||||
ctestutils.JavaCompatible(t)
|
||||
task := &structs.Task{
|
||||
Name: "demo-app",
|
||||
Config: map[string]string{
|
||||
Config: map[string]interface{}{
|
||||
"artifact_source": "https://dl.dropboxusercontent.com/u/47675/jar_thing/demoapp.jar",
|
||||
"jvm_options": "-Xmx2048m -Xms256m",
|
||||
"checksum": "sha256:58d6e8130308d32e197c5108edd4f56ddf1417408f743097c2e662df0f0b17c8",
|
||||
@@ -95,7 +95,7 @@ func TestJavaDriver_Start_Wait(t *testing.T) {
|
||||
ctestutils.JavaCompatible(t)
|
||||
task := &structs.Task{
|
||||
Name: "demo-app",
|
||||
Config: map[string]string{
|
||||
Config: map[string]interface{}{
|
||||
"artifact_source": "https://dl.dropboxusercontent.com/u/47675/jar_thing/demoapp.jar",
|
||||
"jvm_options": "-Xmx2048m -Xms256m",
|
||||
"checksum": "sha256:58d6e8130308d32e197c5108edd4f56ddf1417408f743097c2e662df0f0b17c8",
|
||||
@@ -142,7 +142,7 @@ func TestJavaDriver_Start_Kill_Wait(t *testing.T) {
|
||||
ctestutils.JavaCompatible(t)
|
||||
task := &structs.Task{
|
||||
Name: "demo-app",
|
||||
Config: map[string]string{
|
||||
Config: map[string]interface{}{
|
||||
"artifact_source": "https://dl.dropboxusercontent.com/u/47675/jar_thing/demoapp.jar",
|
||||
},
|
||||
Resources: basicResources,
|
||||
|
||||
@@ -37,7 +37,7 @@ func TestQemuDriver_StartOpen_Wait(t *testing.T) {
|
||||
// TODO: use test server to load from a fixture
|
||||
task := &structs.Task{
|
||||
Name: "linux",
|
||||
Config: map[string]string{
|
||||
Config: map[string]interface{}{
|
||||
"artifact_source": "https://dl.dropboxusercontent.com/u/47675/jar_thing/linux-0.2.img",
|
||||
"checksum": "sha256:a5e836985934c3392cbbd9b26db55a7d35a8d7ae1deb7ca559dd9c0159572544",
|
||||
"accelerator": "tcg",
|
||||
@@ -48,7 +48,7 @@ func TestQemuDriver_StartOpen_Wait(t *testing.T) {
|
||||
MemoryMB: 512,
|
||||
Networks: []*structs.NetworkResource{
|
||||
&structs.NetworkResource{
|
||||
ReservedPorts: []int{22000, 80},
|
||||
ReservedPorts: []structs.Port{{"main", 22000}, {"web", 80}},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -87,7 +87,7 @@ func TestQemuDriver_RequiresMemory(t *testing.T) {
|
||||
// TODO: use test server to load from a fixture
|
||||
task := &structs.Task{
|
||||
Name: "linux",
|
||||
Config: map[string]string{
|
||||
Config: map[string]interface{}{
|
||||
"artifact_source": "https://dl.dropboxusercontent.com/u/47675/jar_thing/linux-0.2.img",
|
||||
"accelerator": "tcg",
|
||||
"host_port": "8080",
|
||||
|
||||
@@ -51,7 +51,7 @@ func TestRawExecDriver_Fingerprint(t *testing.T) {
|
||||
func TestRawExecDriver_StartOpen_Wait(t *testing.T) {
|
||||
task := &structs.Task{
|
||||
Name: "sleep",
|
||||
Config: map[string]string{
|
||||
Config: map[string]interface{}{
|
||||
"command": "/bin/sleep",
|
||||
"args": "1",
|
||||
},
|
||||
@@ -100,7 +100,7 @@ func TestRawExecDriver_Start_Artifact_basic(t *testing.T) {
|
||||
|
||||
task := &structs.Task{
|
||||
Name: "sleep",
|
||||
Config: map[string]string{
|
||||
Config: map[string]interface{}{
|
||||
"artifact_source": fmt.Sprintf("https://dl.dropboxusercontent.com/u/47675/jar_thing/%s", file),
|
||||
"command": filepath.Join("$NOMAD_TASK_DIR", file),
|
||||
"checksum": checksum,
|
||||
@@ -148,7 +148,7 @@ func TestRawExecDriver_Start_Artifact_expanded(t *testing.T) {
|
||||
|
||||
task := &structs.Task{
|
||||
Name: "sleep",
|
||||
Config: map[string]string{
|
||||
Config: map[string]interface{}{
|
||||
"artifact_source": fmt.Sprintf("https://dl.dropboxusercontent.com/u/47675/jar_thing/%s", file),
|
||||
"command": "/bin/bash",
|
||||
"args": fmt.Sprintf("-c '/bin/sleep 1 && %s'", filepath.Join("$NOMAD_TASK_DIR", file)),
|
||||
@@ -188,7 +188,7 @@ func TestRawExecDriver_Start_Artifact_expanded(t *testing.T) {
|
||||
func TestRawExecDriver_Start_Wait(t *testing.T) {
|
||||
task := &structs.Task{
|
||||
Name: "sleep",
|
||||
Config: map[string]string{
|
||||
Config: map[string]interface{}{
|
||||
"command": "/bin/sleep",
|
||||
"args": "1",
|
||||
},
|
||||
@@ -230,7 +230,7 @@ func TestRawExecDriver_Start_Wait_AllocDir(t *testing.T) {
|
||||
file := "output.txt"
|
||||
task := &structs.Task{
|
||||
Name: "sleep",
|
||||
Config: map[string]string{
|
||||
Config: map[string]interface{}{
|
||||
"command": "/bin/bash",
|
||||
"args": fmt.Sprintf(`-c "sleep 1; echo -n %s > $%s/%s"`, string(exp), environment.AllocDir, file),
|
||||
},
|
||||
@@ -275,7 +275,7 @@ func TestRawExecDriver_Start_Wait_AllocDir(t *testing.T) {
|
||||
func TestRawExecDriver_Start_Kill_Wait(t *testing.T) {
|
||||
task := &structs.Task{
|
||||
Name: "sleep",
|
||||
Config: map[string]string{
|
||||
Config: map[string]interface{}{
|
||||
"command": "/bin/sleep",
|
||||
"args": "1",
|
||||
},
|
||||
|
||||
@@ -75,7 +75,7 @@ func TestRktDriver_Start(t *testing.T) {
|
||||
// TODO: use test server to load from a fixture
|
||||
task := &structs.Task{
|
||||
Name: "etcd",
|
||||
Config: map[string]string{
|
||||
Config: map[string]interface{}{
|
||||
"trust_prefix": "coreos.com/etcd",
|
||||
"image": "coreos.com/etcd:v2.0.4",
|
||||
"command": "/etcd",
|
||||
@@ -114,7 +114,7 @@ func TestRktDriver_Start_Wait(t *testing.T) {
|
||||
ctestutils.RktCompatible(t)
|
||||
task := &structs.Task{
|
||||
Name: "etcd",
|
||||
Config: map[string]string{
|
||||
Config: map[string]interface{}{
|
||||
"trust_prefix": "coreos.com/etcd",
|
||||
"image": "coreos.com/etcd:v2.0.4",
|
||||
"command": "/etcd",
|
||||
@@ -156,7 +156,7 @@ func TestRktDriver_Start_Wait_Skip_Trust(t *testing.T) {
|
||||
ctestutils.RktCompatible(t)
|
||||
task := &structs.Task{
|
||||
Name: "etcd",
|
||||
Config: map[string]string{
|
||||
Config: map[string]interface{}{
|
||||
"image": "coreos.com/etcd:v2.0.4",
|
||||
"command": "/etcd",
|
||||
"args": "--version",
|
||||
@@ -197,7 +197,7 @@ func TestRktDriver_Start_Wait_Logs(t *testing.T) {
|
||||
ctestutils.RktCompatible(t)
|
||||
task := &structs.Task{
|
||||
Name: "etcd",
|
||||
Config: map[string]string{
|
||||
Config: map[string]interface{}{
|
||||
"trust_prefix": "coreos.com/etcd",
|
||||
"image": "coreos.com/etcd:v2.0.4",
|
||||
"command": "/etcd",
|
||||
|
||||
Reference in New Issue
Block a user