Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions numbers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ func TestNumbers_RoundTripLosslessly(t *testing.T) {
}
}
})
t.Run("policy revision attributes", func(t *testing.T) {
var p PolicyRevision
if err := json.Unmarshal([]byte(`{"name":"p","default_attributes":{"n":`+bigInt+`},"override_attributes":{"n":`+bigInt+`}}`), &p); err != nil {
t.Fatal(err)
}
if p.DefaultAttributes["n"] != json.Number(bigInt) || p.OverrideAttributes["n"] != json.Number(bigInt) {
t.Errorf("attributes = %#v / %#v, want json.Number", p.DefaultAttributes["n"], p.OverrideAttributes["n"])
}
})
t.Run("data bag item", func(t *testing.T) {
var item DataBagItem
if err := json.Unmarshal([]byte(`{"id":"x","n":`+bigInt+`,"list":[`+bigInt+`]}`), &item); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions policies.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ type PolicyRevision struct {
RunList []string `json:"run_list"`
NamedRunLists map[string][]string `json:"named_run_lists,omitempty"`
CookbookLocks map[string]CookbookLock `json:"cookbook_locks"`
DefaultAttributes map[string]any `json:"default_attributes,omitempty"`
OverrideAttributes map[string]any `json:"override_attributes,omitempty"`
DefaultAttributes Attributes `json:"default_attributes,omitempty"`
OverrideAttributes Attributes `json:"override_attributes,omitempty"`
SolutionDependencies json.RawMessage `json:"solution_dependencies,omitempty"`
IncludedPolicyLocks []json.RawMessage `json:"included_policy_locks,omitempty"`
}
Expand Down
2 changes: 1 addition & 1 deletion policies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func TestPolicies_GetRevision(t *testing.T) {
if lock.Version != "1.0.0" || lock.Identifier != "deadbeef" {
t.Errorf("lock = %+v", lock)
}
if rev.DefaultAttributes["port"] != float64(8080) {
if rev.DefaultAttributes["port"] != json.Number("8080") {
t.Errorf("default_attributes = %v", rev.DefaultAttributes)
}
}
Expand Down