Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(misc) Improve test for actionpolicy #2168

Merged
merged 1 commit into from
Apr 23, 2024
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
| 2024/03/14 | 2139 | Send `alive` events every 30 minutes instead of every 1 hour |
| 2024/03/14 | 2137 | Use correct private inboxes for `scout watch` to support protocol v2 deployments |
| 2024/03/11 | 2133 | Redesign the gossip service discovery for upcoming NATS 2.11 due June 2024 |
| 2024/03/09 | 2131 | Ensure the duplicate window alins with the kv TTL when creating buckets |
| 2024/03/09 | 2131 | Ensure the duplicate window aligns with the kv TTL when creating buckets |
| 2024/03/07 | 2129 | Adds `skip_trigger_on_reenter` to the `scheduler` watcher to avoid some duplicate triggers |
| 2024/03/07 | 2127 | Support for Debian Bookworm |
| 2024/02/26 | 2120 | Adds `choria tool sha256` to compute recursive checksums compatible with `archive` and `plugins` |
Expand Down
10 changes: 10 additions & 0 deletions providers/agent/mcorpc/authz_actionpolicy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,16 @@ var _ = Describe("Policy", func() {
matched, err = pol.MatchesFacts(cfg, logger)
Expect(err).ToNot(HaveOccurred())
Expect(matched).To(BeTrue())

pol.facts = "nested.facts=~/^al/"
matched, err = pol.MatchesFacts(cfg, logger)
Expect(err).ToNot(HaveOccurred())
Expect(matched).To(BeFalse())

pol.facts = "nested.facts=~/^val/"
matched, err = pol.MatchesFacts(cfg, logger)
Expect(err).ToNot(HaveOccurred())
Expect(matched).To(BeTrue())
})
})

Expand Down
5 changes: 4 additions & 1 deletion providers/agent/mcorpc/testdata/facts.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"two": "two two",
"three": "three three three",
"digit": 1,
"boolean": false
"boolean": false,
"nested": {
"facts": "value"
}
}
Loading