open-nomad/client/driver/exec_test.go

31 lines
528 B
Go
Raw Normal View History

2015-08-20 23:50:28 +00:00
package driver
import (
"log"
"os"
"testing"
2015-08-20 23:53:43 +00:00
"github.com/hashicorp/nomad/nomad/structs"
2015-08-20 23:50:28 +00:00
)
func testLogger() *log.Logger {
return log.New(os.Stderr, "", log.LstdFlags)
}
func TestExecDriver_Fingerprint(t *testing.T) {
d := NewExecDriver(testLogger())
2015-08-20 23:53:43 +00:00
node := &structs.Node{
Attributes: make(map[string]string),
}
apply, err := d.Fingerprint(node)
2015-08-20 23:50:28 +00:00
if err != nil {
t.Fatalf("err: %v", err)
}
if !apply {
t.Fatalf("should apply")
}
2015-08-20 23:53:43 +00:00
if node.Attributes["driver.exec"] == "" {
t.Fatalf("missing driver")
}
2015-08-20 23:50:28 +00:00
}