mirror of https://github.com/knative/func.git
Template generation improvements (#949)
* Improve test error output Signed-off-by: Matej Vasek <mvasek@redhat.com> * Template ZIP generator close file after use Signed-off-by: Matej Vasek <mvasek@redhat.com>
This commit is contained in:
parent
1ee9fa163b
commit
94dd53d009
|
@ -9,13 +9,13 @@ import (
|
|||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
"github.com/go-git/go-git/v5"
|
||||
"github.com/go-git/go-git/v5/plumbing/object"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
)
|
||||
|
||||
func TestFileSystems(t *testing.T) {
|
||||
|
@ -79,11 +79,8 @@ func TestFileSystems(t *testing.T) {
|
|||
sort.Strings(embeddedFiles)
|
||||
sort.Strings(localFiles)
|
||||
|
||||
if !reflect.DeepEqual(embeddedFiles, localFiles) {
|
||||
t.Log("embedded files: ", embeddedFiles)
|
||||
t.Log("local files: ", localFiles)
|
||||
t.Error("content of embedded files doesn't match the filesystem")
|
||||
return
|
||||
if diff := cmp.Diff(localFiles, embeddedFiles); diff != "" {
|
||||
t.Error("filesystem content missmatch (-want, +got):", diff)
|
||||
}
|
||||
|
||||
err = fs.WalkDir(templatesFS, ".", func(path string, d fs.DirEntry, err error) error {
|
||||
|
|
|
@ -71,6 +71,7 @@ func main() {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
_, err = io.CopyBuffer(w, f, buff)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue