mirror of https://github.com/status-im/consul.git
agent: use UTC time for intention times, move empty list check to
agent/consul
This commit is contained in:
parent
370b2599a1
commit
80d068aaa4
|
@ -67,7 +67,7 @@ func (s *Intention) Apply(
|
|||
}
|
||||
|
||||
// Set the created at
|
||||
args.Intention.CreatedAt = time.Now()
|
||||
args.Intention.CreatedAt = time.Now().UTC()
|
||||
}
|
||||
*reply = args.Intention.ID
|
||||
|
||||
|
@ -84,7 +84,7 @@ func (s *Intention) Apply(
|
|||
}
|
||||
|
||||
// We always update the updatedat field. This has no effect for deletion.
|
||||
args.Intention.UpdatedAt = time.Now()
|
||||
args.Intention.UpdatedAt = time.Now().UTC()
|
||||
|
||||
// Default source type
|
||||
if args.Intention.SourceType == "" {
|
||||
|
@ -169,6 +169,10 @@ func (s *Intention) List(
|
|||
}
|
||||
|
||||
reply.Index, reply.Intentions = index, ixns
|
||||
if reply.Intentions == nil {
|
||||
reply.Intentions = make(structs.Intentions, 0)
|
||||
}
|
||||
|
||||
// filterACL
|
||||
return nil
|
||||
},
|
||||
|
|
|
@ -384,6 +384,9 @@ func TestIntentionList(t *testing.T) {
|
|||
if err := msgpackrpc.CallWithCodec(codec, "Intention.List", req, &resp); err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
if resp.Intentions == nil {
|
||||
t.Fatal("should not be nil")
|
||||
}
|
||||
|
||||
if len(resp.Intentions) != 0 {
|
||||
t.Fatalf("bad: %v", resp)
|
||||
|
|
|
@ -37,10 +37,6 @@ func (s *HTTPServer) IntentionList(resp http.ResponseWriter, req *http.Request)
|
|||
return nil, err
|
||||
}
|
||||
|
||||
// Use empty list instead of nil.
|
||||
if reply.Intentions == nil {
|
||||
reply.Intentions = make(structs.Intentions, 0)
|
||||
}
|
||||
return reply.Intentions, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue