Skip to content

Commit

Permalink
migrate last acl tests away from database
Browse files Browse the repository at this point in the history
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
  • Loading branch information
kradalby committed Jun 21, 2023
1 parent e2c08db commit 155cc07
Show file tree
Hide file tree
Showing 5 changed files with 254 additions and 271 deletions.
264 changes: 0 additions & 264 deletions hscontrol/db/acls_test.go

This file was deleted.

4 changes: 2 additions & 2 deletions hscontrol/db/machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,10 @@ func (s *Suite) TestGetACLFilteredPeers(c *check.C) {
testPeers, err := db.ListPeers(testMachine)
c.Assert(err, check.IsNil)

adminRules, _, err := policy.GenerateFilterRules(aclPolicy, adminMachine, adminPeers)
adminRules, _, err := policy.GenerateFilterAndSSHRules(aclPolicy, adminMachine, adminPeers)
c.Assert(err, check.IsNil)

testRules, _, err := policy.GenerateFilterRules(aclPolicy, testMachine, testPeers)
testRules, _, err := policy.GenerateFilterAndSSHRules(aclPolicy, testMachine, testPeers)
c.Assert(err, check.IsNil)

peersOfAdminMachine := policy.FilterMachinesByACL(adminMachine, adminPeers, adminRules)
Expand Down
2 changes: 1 addition & 1 deletion hscontrol/mapper/mapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func fullMapResponse(
return nil, err
}

rules, sshPolicy, err := policy.GenerateFilterRules(
rules, sshPolicy, err := policy.GenerateFilterAndSSHRules(
pol,
machine,
peers,
Expand Down
2 changes: 1 addition & 1 deletion hscontrol/policy/acls.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func LoadACLPolicyFromBytes(acl []byte, format string) (*ACLPolicy, error) {
// TODO(kradalby): This needs to be replace with something that generates
// the rules as needed and not stores it on the global object, rules are
// per node and that should be taken into account.
func GenerateFilterRules(
func GenerateFilterAndSSHRules(
policy *ACLPolicy,
machine *types.Machine,
peers types.Machines,
Expand Down

0 comments on commit 155cc07

Please sign in to comment.