Skip to content

Commit

Permalink
add an unit test for parsing the "/etc/os-release" of CentOS
Browse files Browse the repository at this point in the history
 add a newline character at the end
  • Loading branch information
CuZn13 committed Nov 1, 2019
1 parent 9b9f18a commit d5cb446
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/util/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ func TestGetOSVersion(t *testing.T) {
expectedOSVersion: "ubuntu 16.04.6 LTS (Xenial Xerus)",
expectErr: false,
},
{
name: "centos",
fakeOSReleasePath: "testdata/os-release-centos",
expectedOSVersion: "centos 7 (Core)",
expectErr: false,
},
{
name: "Unknown",
fakeOSReleasePath: "testdata/os-release-unknown",
Expand Down
15 changes: 15 additions & 0 deletions pkg/util/testdata/os-release-centos
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

0 comments on commit d5cb446

Please sign in to comment.