Allow opts to flow to the backend snapshotter during snapshot creation.

Signed-off-by: Eric Hotinger <ehotinger@gmail.com>
This commit is contained in:
Eric Hotinger
2019-02-28 11:37:03 -08:00
parent 3e7c6f6a6b
commit 75f183887a
3 changed files with 75 additions and 7 deletions

View File

@@ -20,6 +20,7 @@ import (
"context"
"os"
"path/filepath"
"reflect"
"runtime"
"testing"
@@ -63,3 +64,41 @@ func TestMetadata(t *testing.T) {
testutil.RequiresRoot(t)
testsuite.SnapshotterSuite(t, "Metadata", newTestSnapshotter)
}
func TestFilterInheritedLabels(t *testing.T) {
tests := []struct {
labels map[string]string
expected map[string]string
}{
{
nil,
nil,
},
{
map[string]string{},
map[string]string{},
},
{
map[string]string{"": ""},
map[string]string{},
},
{
map[string]string{"foo": "bar"},
map[string]string{},
},
{
map[string]string{inheritedLabelsPrefix + "foo": "bar"},
map[string]string{inheritedLabelsPrefix + "foo": "bar"},
},
{
map[string]string{inheritedLabelsPrefix + "foo": "bar", "qux": "qaz"},
map[string]string{inheritedLabelsPrefix + "foo": "bar"},
},
}
for _, test := range tests {
if actual := filterInheritedLabels(test.labels); !reflect.DeepEqual(actual, test.expected) {
t.Fatalf("expected %v but got %v", test.expected, actual)
}
}
}