2015-08-20 23:50:28 +00:00
|
|
|
package driver
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"os"
|
|
|
|
"testing"
|
2015-08-20 23:53:43 +00:00
|
|
|
|
2015-08-25 23:21:29 +00:00
|
|
|
"github.com/hashicorp/nomad/client/config"
|
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),
|
|
|
|
}
|
2015-08-25 23:21:29 +00:00
|
|
|
apply, err := d.Fingerprint(&config.Config{}, 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
|
|
|
}
|