Added a test

This commit is contained in:
Diptanu Choudhury 2016-07-27 13:44:30 -07:00
parent 3c64fa562b
commit 4000a5864d

View file

@ -6,6 +6,7 @@ import (
"sort" "sort"
"strings" "strings"
"testing" "testing"
"time"
"github.com/hashicorp/nomad/testutil" "github.com/hashicorp/nomad/testutil"
) )
@ -79,6 +80,7 @@ func TestNodes_PrefixList(t *testing.T) {
} }
func TestNodes_Info(t *testing.T) { func TestNodes_Info(t *testing.T) {
startTime := time.Now().Unix()
c, s := makeClient(t, nil, func(c *testutil.TestServerConfig) { c, s := makeClient(t, nil, func(c *testutil.TestServerConfig) {
c.DevMode = true c.DevMode = true
}) })
@ -121,6 +123,11 @@ func TestNodes_Info(t *testing.T) {
nodeID, dc, nodeID, dc,
result.ID, result.Datacenter) result.ID, result.Datacenter)
} }
// Check that the StatusUpdatedAt field is being populated correctly
if result.StatusUpdatedAt < startTime {
t.Fatalf("start time: %v, status updated: %v", startTime, result.StatusUpdatedAt)
}
} }
func TestNodes_ToggleDrain(t *testing.T) { func TestNodes_ToggleDrain(t *testing.T) {