Adjust test expectations for compilation differences with 1.21

- Requires some production code changes, to use pointers to function variables instead of pointers to functions
This commit is contained in:
Joshua Casey
2023-09-06 14:52:01 -05:00
parent 3908097c54
commit 8fd55a1d81
4 changed files with 71 additions and 54 deletions
@@ -387,7 +387,8 @@ func (c *activeDirectoryWatcherController) updateStatus(ctx context.Context, ups
}
}
func microsoftUUIDFromBinaryAttr(attributeName string) func(entry *ldap.Entry) (string, error) {
//nolint:gochecknoglobals // this needs to be a global variable so that tests can check pointer equality
var microsoftUUIDFromBinaryAttr = func(attributeName string) func(*ldap.Entry) (string, error) {
// validation has already been done so we can just get the attribute...
return func(entry *ldap.Entry) (string, error) {
binaryUUID := entry.GetRawAttributeValue(attributeName)
@@ -442,7 +443,8 @@ func getDomainFromDistinguishedName(distinguishedName string) (string, error) {
return strings.Join(domainComponents[1:], "."), nil
}
func validUserAccountControl(entry *ldap.Entry, _ provider.RefreshAttributes) error {
//nolint:gochecknoglobals // this needs to be a global variable so that tests can check pointer equality
var validUserAccountControl = func(entry *ldap.Entry, _ provider.RefreshAttributes) error {
userAccountControl, err := strconv.Atoi(entry.GetAttributeValue(userAccountControlAttribute))
if err != nil {
return err
@@ -455,7 +457,8 @@ func validUserAccountControl(entry *ldap.Entry, _ provider.RefreshAttributes) er
return nil
}
func validComputedUserAccountControl(entry *ldap.Entry, _ provider.RefreshAttributes) error {
//nolint:gochecknoglobals // this needs to be a global variable so that tests can check pointer equality
var validComputedUserAccountControl = func(entry *ldap.Entry, _ provider.RefreshAttributes) error {
userAccountControl, err := strconv.Atoi(entry.GetAttributeValue(userAccountControlComputedAttribute))
if err != nil {
return err