Skip to content

Commit

Permalink
server(filesystem): fix archive test
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewpi committed Mar 7, 2023
1 parent 5424c67 commit 74b1c46
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions server/filesystem/archive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
iofs "io/fs"
"os"
"path/filepath"
"sort"
"strings"
"testing"

Expand Down Expand Up @@ -59,7 +60,7 @@ func TestArchive_Stream(t *testing.T) {
},
}

// Create the archive
// Create the archive.
archivePath := filepath.Join(rfs.root, "archive.tar.gz")
g.Assert(a.Create(context.Background(), archivePath)).IsNil()

Expand All @@ -80,10 +81,17 @@ func TestArchive_Stream(t *testing.T) {
g.Assert(err).IsNil()

// Ensure the files in the archive match what we are expecting.
g.Assert(files).Equal([]string{
expected := []string{
"test_file.txt",
"test/file.txt",
})
}

// Sort the slices to ensure the comparison never fails if the
// contents are sorted differently.
sort.Strings(expected)
sort.Strings(files)

g.Assert(files).Equal(expected)
})
})
}
Expand Down

0 comments on commit 74b1c46

Please sign in to comment.