clean up context on build completion & add test

Docker-DCO-1.1-Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com> (github: unclejack)
Upstream-commit: 18587469789594f7ca26fc942c6d23b971a14dd3
Component: engine
This commit is contained in:
unclejack
2014-09-02 17:35:25 +03:00
parent b4bc0df7c1
commit 9046d6de2c
3 changed files with 48 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"io"
"os"
"os/exec"
"reflect"
"strings"
@ -175,3 +176,20 @@ func waitRun(contId string) error {
return nil
}
func compareDirectoryEntries(e1 []os.FileInfo, e2 []os.FileInfo) error {
var (
e1Entries = make(map[string]struct{})
e2Entries = make(map[string]struct{})
)
for _, e := range e1 {
e1Entries[e.Name()] = struct{}{}
}
for _, e := range e2 {
e2Entries[e.Name()] = struct{}{}
}
if !reflect.DeepEqual(e1Entries, e2Entries) {
return fmt.Errorf("entries differ")
}
return nil
}