Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions image/storage/storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ func TestMain(m *testing.M) {
if debug {
logrus.SetLevel(logrus.DebugLevel)
}

// Make the tests independent of storage.conf in /usr or /etc.
// This must be done early, not in an individual test,
// because the config file is read inside a sync.Once.
os.Setenv("CONTAINERS_STORAGE_CONF", "/dev/null")

os.Exit(m.Run())
}

Expand Down
21 changes: 11 additions & 10 deletions image/storage/storage_transport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,19 @@ func TestTransportParseReference(t *testing.T) {
store := newStore(t)
driver := store.GraphDriverName()
root := store.GraphRoot()
runRoot := store.RunRoot()

for _, c := range []struct{ prefix, expectedDriver, expectedRoot, expectedRunRoot string }{
{"", driver, root, ""}, // Implicit store location prefix
{"[unterminated", "", "", ""}, // Unterminated store specifier
{"[]", "", "", ""}, // Empty store specifier
{"[relative/path]", "", "", ""}, // Non-absolute graph root path
{"[" + driver + "@relative/path]", "", "", ""}, // Non-absolute graph root path
{"[@" + root + "suffix2]", "", "", ""}, // Empty graph driver
{"[" + driver + "@]", "", "", ""}, // Empty root path
{"[thisisunknown@" + root + "suffix2]", "", "", ""}, // Unknown graph driver
{"[" + root + "suffix1]", "", "", ""}, // A valid root path, but no run dir
{"[" + driver + "@" + root + "suffix3+relative/path]", "", "", ""}, // Non-absolute run dir
{"", driver, root, runRoot}, // Implicit store location prefix
{"[unterminated", "", "", ""}, // Unterminated store specifier
{"[]", "", "", ""}, // Empty store specifier
{"[relative/path]", "", "", ""}, // Non-absolute graph root path
{"[" + driver + "@relative/path]", "", "", ""}, // Non-absolute graph root path
{"[@" + root + "suffix2]", "", "", ""}, // Empty graph driver
{"[" + driver + "@]", "", "", ""}, // Empty root path
{"[thisisunknown@" + root + "suffix2]", "", "", ""}, // Unknown graph driver
{"[" + driver + "@" + root + "suffix1]", driver, root + "suffix1", ""}, // A valid root path; no run dir = uses c/storage defaults
{"[" + driver + "@" + root + "suffix3+relative/path]", "", "", ""}, // Non-absolute run dir
{
"[" + driver + "@" + root + "suffix3+" + root + "suffix4]",
driver,
Expand Down
Loading