summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorNeha Pansare <neha.pansare@progress.com>2022-09-29 17:47:04 +0530
committerMarc A. Paradise <marc.paradise@gmail.com>2022-10-07 10:29:31 -0400
commit8ab9886ab28ff37db5af96ff60d598e5525dfc0c (patch)
treeaa907d4d6e1a5f78ea9bc90f961c830e0a8f27df /spec
parent9c43a97b4f2722f5e88ceb290817e82c4ef336b4 (diff)
downloadchef-8ab9886ab28ff37db5af96ff60d598e5525dfc0c.tar.gz
On AIX, add delay to ensure members added to group are visible to tests
We have found on AIX 7.x, it can be a varying amount of time before the system reflects that member(s) have been added to a group. This change increases the delay on AIX from 2 seconds to 3 after adding a user to a group. This ensures that the new group members are visible before we verify that they are added correctly. This change also removes the limitation that only applies this delay on AIX 7.2 since we have found it affects 7.3 as well. For consistency, it is now applied on all AIX platform versions. With these tests passing, it is now possible to re-enable the AIX pipeline (which has also been done in this change). Signed-off-by: Neha Pansare <neha.pansare@progress.com> Signed-off-by: John McCrae <john.mccrae@progress.com> Signed-off-by: Marc A. Paradise <marc.paradise@gmail.com>
Diffstat (limited to 'spec')
-rw-r--r--spec/functional/resource/group_spec.rb12
-rw-r--r--spec/functional/resource/link_spec.rb16
2 files changed, 16 insertions, 12 deletions
diff --git a/spec/functional/resource/group_spec.rb b/spec/functional/resource/group_spec.rb
index 9360020537..6e074a3e44 100644
--- a/spec/functional/resource/group_spec.rb
+++ b/spec/functional/resource/group_spec.rb
@@ -44,10 +44,10 @@ describe Chef::Resource::Group, :requires_root_or_running_windows do
members.shift # Get rid of GroupMembership: string
members.include?(user)
else
- # TODO For some reason our temporary AIX 7.2 system does not correctly report group membership immediately after changes have been made.
- # Adding a 2 second delay for this platform is enough to get correct results.
- # We hope to remove this delay after we get more permanent AIX 7.2 systems in our CI pipeline. reference: https://github.com/chef/release-engineering/issues/1617
- sleep 2 if aix? && (ohai[:platform_version] == "7.2")
+ # NOTE: For some reason our temporary AIX 7.x systems do not correctly report group membership immediately after changes have been made.
+ # Adding a delay for this platform is enough to get correct results.
+ # reference: https://github.com/chef/release-engineering/issues/1617
+ sleep 3 if aix?
Etc.getgrnam(group_name).mem.include?(user)
end
end
@@ -133,6 +133,10 @@ describe Chef::Resource::Group, :requires_root_or_running_windows do
temp_resource.append(true)
temp_resource.run_action(:modify)
members.each do |member|
+ # NOTE For some reason our temporary AIX 7.x systems do not correctly report group membership immediately after changes have been made.
+ # Adding a delay for this platform is enough to get correct results.
+ # reference: https://github.com/chef/release-engineering/issues/1617
+ sleep 3 if aix?
expect(user_exist_in_group?(member)).to eq(true)
end
end
diff --git a/spec/functional/resource/link_spec.rb b/spec/functional/resource/link_spec.rb
index 4637896fd7..480c2df92f 100644
--- a/spec/functional/resource/link_spec.rb
+++ b/spec/functional/resource/link_spec.rb
@@ -345,17 +345,17 @@ describe Chef::Resource::Link do
let(:test_user) { "test-link-user" }
before do
user(test_user).run_action(:create)
- # TODO For some reason our temporary AIX 7.2 system does not correctly report user existence immediately after changes have been made.
- # Adding a 2 second delay for this platform is enough to get correct results.
- # We hope to remove this delay after we get more permanent AIX 7.2 systems in our CI pipeline. reference: https://github.com/chef/release-engineering/issues/1617
- sleep 2 if aix? && (ohai[:platform_version] == "7.2")
+ # NOTE: For some reason our temporary AIX 7.x systems do not correctly report user existence immediately after changes have been made.
+ # Adding a delay for this platform is enough to get correct results.
+ # reference: https://github.com/chef/release-engineering/issues/1617
+ sleep 3 if aix?
end
after do
user(test_user).run_action(:remove)
- # TODO For some reason our temporary AIX 7.2 system does not correctly report user existence immediately after changes have been made.
- # Adding a 2 second delay for this platform is enough to get correct results.
- # We hope to remove this delay after we get more permanent AIX 7.2 systems in our CI pipeline. reference: https://github.com/chef/release-engineering/issues/1617
- sleep 2 if aix? && (ohai[:platform_version] == "7.2")
+ # TODO For some reason our temporary AIX 7.x systems do not correctly report user existence immediately after changes have been made.
+ # Adding a delay for this platform is enough to get correct results.
+ # reference: https://github.com/chef/release-engineering/issues/1617
+ sleep 3 if aix?
end
before(:each) do
resource.owner(test_user)