diff options
author | Tim Smith <tsmith@chef.io> | 2018-03-20 07:58:49 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-20 07:58:49 -0700 |
commit | 5cd2228ddab8050f7c6dc30b9740db7a3897952f (patch) | |
tree | b49c5bd05493d4a8b7f891f39844a8dcc31135c9 /spec/unit | |
parent | 33956ecdae17871baea05de18f0439d8279c8dac (diff) | |
parent | aadb71878889f615c3b014bb32afecd043a0a678 (diff) | |
download | chef-5cd2228ddab8050f7c6dc30b9740db7a3897952f.tar.gz |
Merge pull request #7000 from chef/repo_filenames
Fail with a warning if users specify apt/yum/zypper repos with slashes
Diffstat (limited to 'spec/unit')
-rw-r--r-- | spec/unit/resource/apt_repository_spec.rb | 4 | ||||
-rw-r--r-- | spec/unit/resource/yum_repository_spec.rb | 4 | ||||
-rw-r--r-- | spec/unit/resource/zypper_repository_spec.rb | 4 |
3 files changed, 12 insertions, 0 deletions
diff --git a/spec/unit/resource/apt_repository_spec.rb b/spec/unit/resource/apt_repository_spec.rb index fecf3be582..296bb89455 100644 --- a/spec/unit/resource/apt_repository_spec.rb +++ b/spec/unit/resource/apt_repository_spec.rb @@ -28,6 +28,10 @@ describe Chef::Resource::AptRepository do expect(resource.keyserver).to eql("keyserver.ubuntu.com") end + it "fails if the user provides a repo_name with a forward slash" do + expect { resource.repo_name "foo/bar" }.to raise_error(ArgumentError) + end + it "resolves to a Noop class when on non-linux OS" do node.automatic[:os] = "windows" node.automatic[:platform_family] = "windows" diff --git a/spec/unit/resource/yum_repository_spec.rb b/spec/unit/resource/yum_repository_spec.rb index 3ff9b85f88..353ff7ce23 100644 --- a/spec/unit/resource/yum_repository_spec.rb +++ b/spec/unit/resource/yum_repository_spec.rb @@ -32,6 +32,10 @@ describe Chef::Resource::YumRepository do expect(resource.repositoryid).to eq("multiverse") end + it "fails if the user provides a repositoryid with a forward slash" do + expect { resource.repositoryid "foo/bar" }.to raise_error(ArgumentError) + end + it "the timeout property expects numeric Strings" do expect { resource.timeout "123" }.not_to raise_error(ArgumentError) expect { resource.timeout "123foo" }.to raise_error(ArgumentError) diff --git a/spec/unit/resource/zypper_repository_spec.rb b/spec/unit/resource/zypper_repository_spec.rb index 889a1e1e9a..8f93aecd8e 100644 --- a/spec/unit/resource/zypper_repository_spec.rb +++ b/spec/unit/resource/zypper_repository_spec.rb @@ -32,6 +32,10 @@ describe Chef::Resource::ZypperRepository do expect(resource.repo_name).to eql("repo-source") end + it "fails if the user provides a repo_name with a forward slash" do + expect { resource.repo_name "foo/bar" }.to raise_error(ArgumentError) + end + it "has a default action of create" do expect(resource.action).to eql([:create]) end |