vendor: bump CNI to 1.0.0-pre @ 62e54113
go get github.com/containernetworking/cni@62e54113f44a762923fd2ef3115cda92a2111ca2 go mod vendor go mod tidy Signed-off-by: Dan Williams <dcbw@redhat.com>
This commit is contained in:
56
vendor/github.com/onsi/ginkgo/extensions/table/table.go
generated
vendored
56
vendor/github.com/onsi/ginkgo/extensions/table/table.go
generated
vendored
@ -12,7 +12,9 @@ import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"github.com/onsi/ginkgo"
|
||||
"github.com/onsi/ginkgo/internal/codelocation"
|
||||
"github.com/onsi/ginkgo/internal/global"
|
||||
"github.com/onsi/ginkgo/types"
|
||||
)
|
||||
|
||||
/*
|
||||
@ -40,9 +42,28 @@ Under the hood, `DescribeTable` simply generates a new Ginkgo `Describe`. Each
|
||||
It's important to understand that the `Describe`s and `It`s are generated at evaluation time (i.e. when Ginkgo constructs the tree of tests and before the tests run).
|
||||
|
||||
Individual Entries can be focused (with FEntry) or marked pending (with PEntry or XEntry). In addition, the entire table can be focused or marked pending with FDescribeTable and PDescribeTable/XDescribeTable.
|
||||
|
||||
A description function can be passed to Entry in place of the description. The function is then fed with the entry parameters to generate the description of the It corresponding to that particular Entry.
|
||||
|
||||
For example:
|
||||
|
||||
describe := func(desc string) func(int, int, bool) string {
|
||||
return func(x, y int, expected bool) string {
|
||||
return fmt.Sprintf("%s x=%d y=%d expected:%t", desc, x, y, expected)
|
||||
}
|
||||
}
|
||||
|
||||
DescribeTable("a simple table",
|
||||
func(x int, y int, expected bool) {
|
||||
Ω(x > y).Should(Equal(expected))
|
||||
},
|
||||
Entry(describe("x > y"), 1, 0, true),
|
||||
Entry(describe("x == y"), 0, 0, false),
|
||||
Entry(describe("x < y"), 0, 1, false),
|
||||
)
|
||||
*/
|
||||
func DescribeTable(description string, itBody interface{}, entries ...TableEntry) bool {
|
||||
describeTable(description, itBody, entries, false, false)
|
||||
describeTable(description, itBody, entries, types.FlagTypeNone)
|
||||
return true
|
||||
}
|
||||
|
||||
@ -50,7 +71,7 @@ func DescribeTable(description string, itBody interface{}, entries ...TableEntry
|
||||
You can focus a table with `FDescribeTable`. This is equivalent to `FDescribe`.
|
||||
*/
|
||||
func FDescribeTable(description string, itBody interface{}, entries ...TableEntry) bool {
|
||||
describeTable(description, itBody, entries, false, true)
|
||||
describeTable(description, itBody, entries, types.FlagTypeFocused)
|
||||
return true
|
||||
}
|
||||
|
||||
@ -58,7 +79,7 @@ func FDescribeTable(description string, itBody interface{}, entries ...TableEntr
|
||||
You can mark a table as pending with `PDescribeTable`. This is equivalent to `PDescribe`.
|
||||
*/
|
||||
func PDescribeTable(description string, itBody interface{}, entries ...TableEntry) bool {
|
||||
describeTable(description, itBody, entries, true, false)
|
||||
describeTable(description, itBody, entries, types.FlagTypePending)
|
||||
return true
|
||||
}
|
||||
|
||||
@ -66,33 +87,24 @@ func PDescribeTable(description string, itBody interface{}, entries ...TableEntr
|
||||
You can mark a table as pending with `XDescribeTable`. This is equivalent to `XDescribe`.
|
||||
*/
|
||||
func XDescribeTable(description string, itBody interface{}, entries ...TableEntry) bool {
|
||||
describeTable(description, itBody, entries, true, false)
|
||||
describeTable(description, itBody, entries, types.FlagTypePending)
|
||||
return true
|
||||
}
|
||||
|
||||
func describeTable(description string, itBody interface{}, entries []TableEntry, pending bool, focused bool) {
|
||||
func describeTable(description string, itBody interface{}, entries []TableEntry, flag types.FlagType) {
|
||||
itBodyValue := reflect.ValueOf(itBody)
|
||||
if itBodyValue.Kind() != reflect.Func {
|
||||
panic(fmt.Sprintf("DescribeTable expects a function, got %#v", itBody))
|
||||
}
|
||||
|
||||
if pending {
|
||||
ginkgo.PDescribe(description, func() {
|
||||
global.Suite.PushContainerNode(
|
||||
description,
|
||||
func() {
|
||||
for _, entry := range entries {
|
||||
entry.generateIt(itBodyValue)
|
||||
}
|
||||
})
|
||||
} else if focused {
|
||||
ginkgo.FDescribe(description, func() {
|
||||
for _, entry := range entries {
|
||||
entry.generateIt(itBodyValue)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
ginkgo.Describe(description, func() {
|
||||
for _, entry := range entries {
|
||||
entry.generateIt(itBodyValue)
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
flag,
|
||||
codelocation.New(2),
|
||||
)
|
||||
}
|
||||
|
111
vendor/github.com/onsi/ginkgo/extensions/table/table_entry.go
generated
vendored
111
vendor/github.com/onsi/ginkgo/extensions/table/table_entry.go
generated
vendored
@ -1,49 +1,82 @@
|
||||
package table
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"github.com/onsi/ginkgo"
|
||||
"github.com/onsi/ginkgo/internal/codelocation"
|
||||
"github.com/onsi/ginkgo/internal/global"
|
||||
"github.com/onsi/ginkgo/types"
|
||||
)
|
||||
|
||||
/*
|
||||
TableEntry represents an entry in a table test. You generally use the `Entry` constructor.
|
||||
*/
|
||||
type TableEntry struct {
|
||||
Description string
|
||||
Parameters []interface{}
|
||||
Pending bool
|
||||
Focused bool
|
||||
Description interface{}
|
||||
Parameters []interface{}
|
||||
Pending bool
|
||||
Focused bool
|
||||
codeLocation types.CodeLocation
|
||||
}
|
||||
|
||||
func (t TableEntry) generateIt(itBody reflect.Value) {
|
||||
if t.codeLocation == (types.CodeLocation{}) {
|
||||
// The user created the TableEntry struct directly instead of having used the (F/P/X)Entry constructors.
|
||||
// Therefore default to the code location of the surrounding DescribeTable.
|
||||
t.codeLocation = codelocation.New(5)
|
||||
}
|
||||
|
||||
var description string
|
||||
descriptionValue := reflect.ValueOf(t.Description)
|
||||
switch descriptionValue.Kind() {
|
||||
case reflect.String:
|
||||
description = descriptionValue.String()
|
||||
case reflect.Func:
|
||||
values := castParameters(descriptionValue, t.Parameters)
|
||||
res := descriptionValue.Call(values)
|
||||
if len(res) != 1 {
|
||||
panic(fmt.Sprintf("The describe function should return only a value, returned %d", len(res)))
|
||||
}
|
||||
if res[0].Kind() != reflect.String {
|
||||
panic(fmt.Sprintf("The describe function should return a string, returned %#v", res[0]))
|
||||
}
|
||||
description = res[0].String()
|
||||
default:
|
||||
panic(fmt.Sprintf("Description can either be a string or a function, got %#v", descriptionValue))
|
||||
}
|
||||
|
||||
if t.Pending {
|
||||
ginkgo.PIt(t.Description)
|
||||
global.Suite.PushItNode(description, func() {}, types.FlagTypePending, t.codeLocation, 0)
|
||||
return
|
||||
}
|
||||
|
||||
values := make([]reflect.Value, len(t.Parameters))
|
||||
iBodyType := itBody.Type()
|
||||
for i, param := range t.Parameters {
|
||||
if param == nil {
|
||||
inType := iBodyType.In(i)
|
||||
values[i] = reflect.Zero(inType)
|
||||
} else {
|
||||
values[i] = reflect.ValueOf(param)
|
||||
}
|
||||
}
|
||||
|
||||
values := castParameters(itBody, t.Parameters)
|
||||
body := func() {
|
||||
itBody.Call(values)
|
||||
}
|
||||
|
||||
if t.Focused {
|
||||
ginkgo.FIt(t.Description, body)
|
||||
global.Suite.PushItNode(description, body, types.FlagTypeFocused, t.codeLocation, global.DefaultTimeout)
|
||||
} else {
|
||||
ginkgo.It(t.Description, body)
|
||||
global.Suite.PushItNode(description, body, types.FlagTypeNone, t.codeLocation, global.DefaultTimeout)
|
||||
}
|
||||
}
|
||||
|
||||
func castParameters(function reflect.Value, parameters []interface{}) []reflect.Value {
|
||||
res := make([]reflect.Value, len(parameters))
|
||||
funcType := function.Type()
|
||||
for i, param := range parameters {
|
||||
if param == nil {
|
||||
inType := funcType.In(i)
|
||||
res[i] = reflect.Zero(inType)
|
||||
} else {
|
||||
res[i] = reflect.ValueOf(param)
|
||||
}
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
/*
|
||||
Entry constructs a TableEntry.
|
||||
|
||||
@ -52,27 +85,51 @@ Subsequent parameters are saved off and sent to the callback passed in to `Descr
|
||||
|
||||
Each Entry ends up generating an individual Ginkgo It.
|
||||
*/
|
||||
func Entry(description string, parameters ...interface{}) TableEntry {
|
||||
return TableEntry{description, parameters, false, false}
|
||||
func Entry(description interface{}, parameters ...interface{}) TableEntry {
|
||||
return TableEntry{
|
||||
Description: description,
|
||||
Parameters: parameters,
|
||||
Pending: false,
|
||||
Focused: false,
|
||||
codeLocation: codelocation.New(1),
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
You can focus a particular entry with FEntry. This is equivalent to FIt.
|
||||
*/
|
||||
func FEntry(description string, parameters ...interface{}) TableEntry {
|
||||
return TableEntry{description, parameters, false, true}
|
||||
func FEntry(description interface{}, parameters ...interface{}) TableEntry {
|
||||
return TableEntry{
|
||||
Description: description,
|
||||
Parameters: parameters,
|
||||
Pending: false,
|
||||
Focused: true,
|
||||
codeLocation: codelocation.New(1),
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
You can mark a particular entry as pending with PEntry. This is equivalent to PIt.
|
||||
*/
|
||||
func PEntry(description string, parameters ...interface{}) TableEntry {
|
||||
return TableEntry{description, parameters, true, false}
|
||||
func PEntry(description interface{}, parameters ...interface{}) TableEntry {
|
||||
return TableEntry{
|
||||
Description: description,
|
||||
Parameters: parameters,
|
||||
Pending: true,
|
||||
Focused: false,
|
||||
codeLocation: codelocation.New(1),
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
You can mark a particular entry as pending with XEntry. This is equivalent to XIt.
|
||||
*/
|
||||
func XEntry(description string, parameters ...interface{}) TableEntry {
|
||||
return TableEntry{description, parameters, true, false}
|
||||
func XEntry(description interface{}, parameters ...interface{}) TableEntry {
|
||||
return TableEntry{
|
||||
Description: description,
|
||||
Parameters: parameters,
|
||||
Pending: true,
|
||||
Focused: false,
|
||||
codeLocation: codelocation.New(1),
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user