Esempio n. 1
0
func checkListDir(ctx context.Context, t *testing.T, ts topo.Impl, cell string, dirPath string, expected []string) {
	entries, err := ts.ListDir(ctx, cell, dirPath)
	switch err {
	case topo.ErrNoNode:
		if len(expected) != 0 {
			t.Errorf("ListDir(%v) returned ErrNoNode but was expecting %v", dirPath, expected)
		}
	case nil:
		if !reflect.DeepEqual(entries, expected) {
			t.Errorf("ListDir(%v) returned %v but was expecting %v", dirPath, entries, expected)
		}
	default:
		t.Errorf("ListDir(%v) returned unexpected error: %v", dirPath, err)
	}
}