mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
HookState adhears to OCI
Signed-off-by: George Lestaris <glestaris@pivotal.io> Signed-off-by: Ed King <eking@pivotal.io>
This commit is contained in:
@@ -23,3 +23,24 @@ func TestGenerateName(t *testing.T) {
|
||||
t.Fatalf("expected name to be %d chars but received %d", expected, len(name))
|
||||
}
|
||||
}
|
||||
|
||||
var labelTest = []struct {
|
||||
labels []string
|
||||
query string
|
||||
expectedValue string
|
||||
}{
|
||||
{[]string{"bundle=/path/to/bundle"}, "bundle", "/path/to/bundle"},
|
||||
{[]string{"test=a", "test=b"}, "bundle", ""},
|
||||
{[]string{"bundle=a", "test=b", "bundle=c"}, "bundle", "a"},
|
||||
{[]string{"", "test=a", "bundle=b"}, "bundle", "b"},
|
||||
{[]string{"test", "bundle=a"}, "bundle", "a"},
|
||||
{[]string{"test=a", "bundle="}, "bundle", ""},
|
||||
}
|
||||
|
||||
func TestSearchLabels(t *testing.T) {
|
||||
for _, tt := range labelTest {
|
||||
if v := SearchLabels(tt.labels, tt.query); v != tt.expectedValue {
|
||||
t.Errorf("expected value '%s' for query '%s'; got '%s'", tt.expectedValue, tt.query, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user