-
-
Save jerryaldrichiii/e23f33db5878a4e1649419e28271d272 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Many thanks to Steven Danna (@ssd) for making this 100x more awesome. | |
FAKE_STDOUT = <<-EOX | |
Client Version: v1.10.9 | |
Server Version: v1.10.10 | |
EOX | |
control 'kube-1.0' do | |
title 'CVE-2018-1002105' | |
impact 1.0 | |
cmd_stdout = FAKE_STDOUT # Should be `command('kubectl version --short').stdout` | |
version = cmd_stdout.match(/Server Version: v(.*)/)[1] | |
expected_version = case version | |
when /1.[0-9]\./ | |
'1.10.10' | |
when /1\.10/ | |
'1.10.10' | |
when /1\.11/ | |
'1.11.4' | |
when /1\.12/ | |
'1.12.2' | |
else | |
'1.12.2' | |
end | |
describe "Kube version: #{version}" do | |
it "should be greater than #{expected_version}" do | |
expect(version).to cmp > expected_version | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example output: