summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-06-27 20:58:04 -0700
committerBryan McLellan <btm@loftninjas.org>2018-07-09 13:23:12 -0400
commit451c4706cb4b38cdd98a380c8798462810ef3b6b (patch)
tree01c6dbb7995e2e79f8d79203ff0bcfa8ef19145c
parentcc6bc8b9bf892f3818d802887075b053c7d05d43 (diff)
downloadohai-451c4706cb4b38cdd98a380c8798462810ef3b6b.tar.gz
Add tests for Amazon Linux 2 detection
Past and current string tests Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--spec/unit/plugins/linux/platform_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/unit/plugins/linux/platform_spec.rb b/spec/unit/plugins/linux/platform_spec.rb
index efe2884e..e3cdcdf0 100644
--- a/spec/unit/plugins/linux/platform_spec.rb
+++ b/spec/unit/plugins/linux/platform_spec.rb
@@ -458,6 +458,22 @@ OS_RELEASE
expect(@plugin[:platform_version].to_f).to eq(7.3)
end
+ it "should read the platform as amazon and version as 2 on the RC release" do
+ expect(File).to receive(:read).with("/etc/redhat-release").and_return("Amazon Linux release 2 (2017.12) LTS Release Candidate")
+ @plugin.run
+ expect(@plugin[:platform]).to eq("amazon")
+ expect(@plugin[:platform_family]).to eq("amazon")
+ expect(@plugin[:platform_version].to_f).to eq(2)
+ end
+
+ it "should read the platform as amazon and version as 2 on the final release" do
+ expect(File).to receive(:read).with("/etc/redhat-release").and_return("Amazon Linux 2")
+ @plugin.run
+ expect(@plugin[:platform]).to eq("amazon")
+ expect(@plugin[:platform_family]).to eq("amazon")
+ expect(@plugin[:platform_version].to_f).to eq(2)
+ end
+
# https://github.com/chef/ohai/issues/560
# Issue is seen on EL7, so that's what we're testing.
context "on versions that have /etc/os-release" do