summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAshwin <avarma@msystechnologies.com>2021-09-07 17:07:46 +0530
committerAshwin <avarma@msystechnologies.com>2021-09-07 17:07:46 +0530
commit1f082d4a01ca08758781c5e36aa1cf12fd0a104d (patch)
tree567b3e2b7ebc3814c2bacc6dacbaa088332928bb
parentb91d99f16947b82d09217079f5423b5c7cd0962c (diff)
downloadchef-1f082d4a01ca08758781c5e36aa1cf12fd0a104d.tar.gz
Fixing sensitive property.
- Sensitive property was not working on user_ulimit. - Added required specs. Signed-off-by: Ashwin <avarma@msystechnologies.com>
-rw-r--r--lib/chef/resource/user_ulimit.rb1
-rw-r--r--spec/unit/resource/user_ulimit_spec.rb14
2 files changed, 15 insertions, 0 deletions
diff --git a/lib/chef/resource/user_ulimit.rb b/lib/chef/resource/user_ulimit.rb
index 55331dfc1c..594b585dbf 100644
--- a/lib/chef/resource/user_ulimit.rb
+++ b/lib/chef/resource/user_ulimit.rb
@@ -83,6 +83,7 @@ class Chef
source ::File.expand_path("support/ulimit.erb", __dir__)
local true
mode "0644"
+ sensitive new_resource.sensitive
variables(
ulimit_user: new_resource.username,
filehandle_limit: new_resource.filehandle_limit,
diff --git a/spec/unit/resource/user_ulimit_spec.rb b/spec/unit/resource/user_ulimit_spec.rb
index f451870ac1..e9a675b89e 100644
--- a/spec/unit/resource/user_ulimit_spec.rb
+++ b/spec/unit/resource/user_ulimit_spec.rb
@@ -50,4 +50,18 @@ describe Chef::Resource::UserUlimit do
expect { resource.action :create }.not_to raise_error
expect { resource.action :delete }.not_to raise_error
end
+
+ describe "sensitive attribute" do
+ context "should be insensitive by default" do
+ it { expect(resource.sensitive).to(be_falsey) }
+ end
+
+ context "when set" do
+ before { resource.sensitive(true) }
+
+ it "should be set on the resource" do
+ expect(resource.sensitive).to(be_truthy)
+ end
+ end
+ end
end