feat: add unit tests and fmt

This commit is contained in:
Adrien Raffin-Caboisse
2022-04-16 13:15:04 +02:00
parent db1528bc73
commit 89a1a56328
2 changed files with 124 additions and 2 deletions

View File

@@ -662,13 +662,17 @@ func (machine *Machine) toProto() *v1.Machine {
}
// getTags will return the tags of the current machine
func getTags(aclPolicy ACLPolicy, machine Machine, stripEmailDomain bool) (validTags []string, invalidTags []string) {
func getTags(
aclPolicy ACLPolicy,
machine Machine,
stripEmailDomain bool,
) (validTags []string, invalidTags []string) {
validTagMap := make(map[string]bool)
invalidTagMap := make(map[string]bool)
for _, tag := range machine.HostInfo.RequestTags {
owners, err := expandTagOwners(aclPolicy, tag, stripEmailDomain)
if errors.Is(err, errInvalidTag) {
invalidTags = append(invalidTags, tag)
invalidTagMap[tag] = true
}
var found bool
for _, owner := range owners {