Skip to content

Commit

Permalink
Fix context test
Browse files Browse the repository at this point in the history
  • Loading branch information
baptistedonaux committed Feb 23, 2016
1 parent 73bbe7b commit d8aa021
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions context.go
Expand Up @@ -157,10 +157,11 @@ type Docker struct {
func GetCurrentContainerID() string {
file, err := os.Open("/proc/self/cgroup")

if os.IsNotExist(err) {
return ""
} else if err != nil {
log.Printf("Fail to open /proc/self/cgroup: %s\n", err)
if err != nil {
if os.IsExist(err) {
log.Printf("Fail to open /proc/self/cgroup: %s\n", err)
}

return ""
}

Expand Down
2 changes: 1 addition & 1 deletion context_test.go
Expand Up @@ -7,7 +7,7 @@ import (
func TestGetCurrentContainerID(t *testing.T) {
currentContainerID := GetCurrentContainerID()

if len(currentContainerID) != 64 {
if len(currentContainerID) != 0 && len(currentContainerID) != 64 {
t.Fail()
}
}

0 comments on commit d8aa021

Please sign in to comment.