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

Add group change warning test for Active Directory #1043

Merged
merged 1 commit into from
Mar 2, 2022

Conversation

margocrawf
Copy link
Contributor

Also refactor some of the AD test helper functions into their own file for easier sharing.

This is just a test change that adds a more "real world" test of our group refresh functionality. It actually changes the groups in Active Directory, rather than editing the groups in storage in order to make the supervisor think that the groups have changed when we get different ones back upon refresh.

Signed-off-by: Margo Crawford margaretc@vmware.com

Release note:

NONE

@margocrawf margocrawf force-pushed the active-directory-group-change-warning branch from a54d3e0 to de98d0c Compare March 2, 2022 18:03
@codecov
Copy link

codecov bot commented Mar 2, 2022

Codecov Report

Merging #1043 (f6ad5d5) into main (dd4394a) will increase coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1043      +/-   ##
==========================================
+ Coverage   79.36%   79.38%   +0.02%     
==========================================
  Files         133      133              
  Lines        9992     9992              
==========================================
+ Hits         7930     7932       +2     
+ Misses       1789     1788       -1     
+ Partials      273      272       -1     
Impacted Files Coverage Δ
...onfig/oidcupstreamwatcher/oidc_upstream_watcher.go 95.80% <0.00%> (+0.76%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dd4394a...f6ad5d5. Read the comment docs.

Copy link
Contributor

@enj enj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work 😄

requireKubectlGetNamespaceOutput(t, env, string(kubectlPtyOutputBytes2))
}
// the output should include a warning that the groups have changed.
require.Contains(t, string(kubectlPtyOutputBytes2), fmt.Sprintf("User %q has been added to the following groups: %q", sAMAccountName, []string{groupName + "@" + env.SupervisorUpstreamActiveDirectory.Domain}))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
require.Contains(t, string(kubectlPtyOutputBytes2), fmt.Sprintf("User %q has been added to the following groups: %q", sAMAccountName, []string{groupName + "@" + env.SupervisorUpstreamActiveDirectory.Domain}))
require.Contains(t, string(kubectlPtyOutputBytes2), fmt.Sprintf(`%sWarning:%s User %q has been added to the following groups: %q`+"\r\n", yellowColor, resetColor, sAMAccountName, []string{groupName + "@" + env.SupervisorUpstreamActiveDirectory.Domain}))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll wait until #1042 merges, then rebase off of main so I can use the same color variables.

test/integration/supervisor_warnings_test.go Show resolved Hide resolved
@margocrawf margocrawf force-pushed the active-directory-group-change-warning branch from de98d0c to 0160045 Compare March 2, 2022 18:32
Also refactor some of the AD test helper functions

Signed-off-by: Margo Crawford <margaretc@vmware.com>
@margocrawf margocrawf force-pushed the active-directory-group-change-warning branch from 0160045 to f6ad5d5 Compare March 2, 2022 19:54
@enj enj merged commit ec74158 into main Mar 2, 2022
@enj enj deleted the active-directory-group-change-warning branch March 2, 2022 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants