diff options
Diffstat (limited to 'test/e2e/libpod_suite_test.go')
-rw-r--r-- | test/e2e/libpod_suite_test.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go index afe91134e..c479a6cef 100644 --- a/test/e2e/libpod_suite_test.go +++ b/test/e2e/libpod_suite_test.go @@ -460,3 +460,23 @@ func (p *PodmanTest) BuildImage(dockerfile, imageName string) { session.Wait(120) Expect(session.ExitCode()).To(Equal(0)) } + +//GetHostDistribution returns the dist in string format. If the +//distribution cannot be determined, an empty string will be returned. +func (p *PodmanTest) GetHostDistribution() string { + content, err := ioutil.ReadFile("/etc/os-release") + if err != nil { + return "" + } + for _, line := range content { + if strings.HasPrefix(fmt.Sprintf("%s", line), "ID") { + fields := strings.Split(fmt.Sprintf("%s", line), "=") + if len(fields) < 2 { + return "" + } + return strings.Trim(fields[1], "\"") + + } + } + return "" +} |