resources: Ensure same dirinfos sort order in TestImageOperationsGolden
authorAnthony Fok <foka@debian.org>
Thu, 3 Oct 2019 05:40:22 +0000 (23:40 -0600)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Thu, 3 Oct 2019 14:48:22 +0000 (16:48 +0200)
Fix filename mismatch errors on Debian auto-building machines
possibly due to different directory order on ext4 vs tmpfs file systems.

resources/image_test.go

index 5fa5021c9568d511fce23d4e4ac692f0e57464a3..169f19522e48092547e340c97d59f273d6f44f54 100644 (file)
@@ -15,6 +15,7 @@ package resources
 
 import (
        "fmt"
+       "io/ioutil"
        "math/big"
        "math/rand"
        "os"
@@ -567,15 +568,9 @@ func TestImageOperationsGolden(t *testing.T) {
        dir2 := filepath.FromSlash("testdata/golden")
 
        // The two dirs above should now be the same.
-       d1, err := os.Open(dir1)
+       dirinfos1, err := ioutil.ReadDir(dir1)
        c.Assert(err, qt.IsNil)
-       d2, err := os.Open(dir2)
-       c.Assert(err, qt.IsNil)
-
-       dirinfos1, err := d1.Readdir(-1)
-       c.Assert(err, qt.IsNil)
-       dirinfos2, err := d2.Readdir(-1)
-
+       dirinfos2, err := ioutil.ReadDir(dir2)
        c.Assert(err, qt.IsNil)
        c.Assert(len(dirinfos1), qt.Equals, len(dirinfos2))