Allow opts to flow to the backend snapshotter during snapshot creation.
Signed-off-by: Eric Hotinger <ehotinger@gmail.com>
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user