...
1
16
17 package unittests_test
18
19 import (
20 "reflect"
21 "testing"
22 "time"
23
24 "github.com/stretchr/testify/assert"
25
26 "k8s.io/kubernetes/test/e2e/framework"
27 )
28
29 func TestNewFrameworkWithCustomTimeouts(t *testing.T) {
30 defaultF := framework.NewDefaultFramework("test")
31 customTimeouts := &framework.TimeoutContext{
32 PodStart: 5 * time.Second,
33 PodDelete: time.Second,
34 }
35 customF := framework.NewFrameworkWithCustomTimeouts("test", customTimeouts)
36
37 defaultF.Timeouts.PodStart = customTimeouts.PodStart
38 defaultF.Timeouts.PodDelete = customTimeouts.PodDelete
39 assert.Equal(t, customF.Timeouts, defaultF.Timeouts)
40 }
41
42 func TestNewFramework(t *testing.T) {
43 f := framework.NewDefaultFramework("test")
44
45 timeouts := reflect.ValueOf(f.Timeouts).Elem()
46 for i := 0; i < timeouts.NumField(); i++ {
47 value := timeouts.Field(i)
48 if value.IsZero() {
49 t.Errorf("%s in Framework.Timeouts was not set.", reflect.TypeOf(*f.Timeouts).Field(i).Name)
50 }
51 }
52 }
53
View as plain text