From 22dd584e75b7df2f03bc49a1174309a7965e8073 Mon Sep 17 00:00:00 2001 From: Diptanu Choudhury Date: Wed, 27 Jul 2016 13:44:30 -0700 Subject: [PATCH] Added a test --- api/nodes_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/api/nodes_test.go b/api/nodes_test.go index d546dd435..aa74c7510 100644 --- a/api/nodes_test.go +++ b/api/nodes_test.go @@ -6,6 +6,7 @@ import ( "sort" "strings" "testing" + "time" "github.com/hashicorp/nomad/testutil" ) @@ -79,6 +80,7 @@ func TestNodes_PrefixList(t *testing.T) { } func TestNodes_Info(t *testing.T) { + startTime := time.Now().Unix() c, s := makeClient(t, nil, func(c *testutil.TestServerConfig) { c.DevMode = true }) @@ -121,6 +123,11 @@ func TestNodes_Info(t *testing.T) { nodeID, dc, 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) {