Skip to content

Commit

Permalink
Fix access list enterprise tests. (#30925)
Browse files Browse the repository at this point in the history
The access list enterprise tests were broken by changing the custom JSON
marshaling of the access list audit from `map[string]interface{}` to
`map[string]string`. This change restores the old behavior.
  • Loading branch information
mdwn authored Aug 23, 2023
1 parent 2bcb29a commit c0a459b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions api/types/accesslist/accesslist.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package accesslist

import (
"encoding/json"
"fmt"
"time"

"github.com/gravitational/trace"
Expand Down Expand Up @@ -235,17 +236,17 @@ func (a *AccessList) MatchSearch(values []string) bool {
}

func (a *Audit) UnmarshalJSON(data []byte) error {
var audit map[string]string
var audit map[string]interface{}
if err := json.Unmarshal(data, &audit); err != nil {
return trace.Wrap(err)
}

var err error
a.Frequency, err = time.ParseDuration(audit["frequency"])
a.Frequency, err = time.ParseDuration(fmt.Sprintf("%v", audit["frequency"]))
if err != nil {
return trace.Wrap(err)
}
a.NextAuditDate, err = time.Parse(time.RFC3339Nano, audit["next_audit_date"])
a.NextAuditDate, err = time.Parse(time.RFC3339Nano, fmt.Sprintf("%v", audit["next_audit_date"]))
if err != nil {
return trace.Wrap(err)
}
Expand Down

0 comments on commit c0a459b

Please sign in to comment.