Browse code

fixed -composites errors

Steve Kuznetsov authored on 2015/08/20 03:07:23
Showing 9 changed files
... ...
@@ -17,7 +17,10 @@ func TestHandler(t *testing.T) {
17 17
 }
18 18
 
19 19
 func TestRedirectingStateValidCSRF(t *testing.T) {
20
-	fakeCSRF := &csrf.FakeCSRF{"xyz", nil}
20
+	fakeCSRF := &csrf.FakeCSRF{
21
+		Token: "xyz",
22
+		Err:   nil,
23
+	}
21 24
 	redirectingState := CSRFRedirectingState(fakeCSRF)
22 25
 
23 26
 	req, _ := http.NewRequest("GET", "http://www.example.com", nil)
... ...
@@ -38,7 +41,10 @@ func TestRedirectingStateValidCSRF(t *testing.T) {
38 38
 }
39 39
 
40 40
 func TestRedirectingStateInvalidCSRF(t *testing.T) {
41
-	fakeCSRF := &csrf.FakeCSRF{"xyz", nil}
41
+	fakeCSRF := &csrf.FakeCSRF{
42
+		Token: "xyz",
43
+		Err:   nil,
44
+	}
42 45
 	redirectingState := CSRFRedirectingState(fakeCSRF)
43 46
 
44 47
 	req, _ := http.NewRequest("GET", "http://www.example.com", nil)
... ...
@@ -65,7 +71,10 @@ func TestRedirectingStateInvalidCSRF(t *testing.T) {
65 65
 func TestRedirectingStateSuccess(t *testing.T) {
66 66
 	originalURL := "http://www.example.com"
67 67
 
68
-	fakeCSRF := &csrf.FakeCSRF{"xyz", nil}
68
+	fakeCSRF := &csrf.FakeCSRF{
69
+		Token: "xyz",
70
+		Err:   nil,
71
+	}
69 72
 	redirectingState := CSRFRedirectingState(fakeCSRF)
70 73
 
71 74
 	req, _ := http.NewRequest("GET", originalURL, nil)
... ...
@@ -94,7 +103,10 @@ func TestRedirectingStateOAuthError(t *testing.T) {
94 94
 	originalURL := "http://www.example.com"
95 95
 	expectedURL := "http://www.example.com?error=access_denied"
96 96
 
97
-	fakeCSRF := &csrf.FakeCSRF{"xyz", nil}
97
+	fakeCSRF := &csrf.FakeCSRF{
98
+		Token: "xyz",
99
+		Err:   nil,
100
+	}
98 101
 	redirectingState := CSRFRedirectingState(fakeCSRF)
99 102
 
100 103
 	req, _ := http.NewRequest("GET", originalURL, nil)
... ...
@@ -123,7 +135,10 @@ func TestRedirectingStateOAuthError(t *testing.T) {
123 123
 }
124 124
 
125 125
 func TestRedirectingStateError(t *testing.T) {
126
-	fakeCSRF := &csrf.FakeCSRF{"xyz", nil}
126
+	fakeCSRF := &csrf.FakeCSRF{
127
+		Token: "xyz",
128
+		Err:   nil,
129
+	}
127 130
 	redirectingState := CSRFRedirectingState(fakeCSRF)
128 131
 
129 132
 	req2, _ := http.NewRequest("GET", "http://www.example.com/callback", nil)
... ...
@@ -17,7 +17,12 @@ type ClusterRoleStorage struct {
17 17
 }
18 18
 
19 19
 func NewClusterRoleStorage(clusterPolicyRegistry clusterpolicyregistry.Registry) *ClusterRoleStorage {
20
-	return &ClusterRoleStorage{rolestorage.VirtualStorage{clusterpolicyregistry.NewSimulatedRegistry(clusterPolicyRegistry), roleregistry.ClusterStrategy, roleregistry.ClusterStrategy}}
20
+	return &ClusterRoleStorage{
21
+		roleStorage: rolestorage.VirtualStorage{
22
+			PolicyStorage:  clusterpolicyregistry.NewSimulatedRegistry(clusterPolicyRegistry),
23
+			CreateStrategy: roleregistry.ClusterStrategy,
24
+			UpdateStrategy: roleregistry.ClusterStrategy},
25
+	}
21 26
 }
22 27
 
23 28
 func (s *ClusterRoleStorage) New() runtime.Object {
... ...
@@ -28,7 +28,10 @@ func TestLimitedLogAndRetryFinish(t *testing.T) {
28 28
 	err := errors.New("funky error")
29 29
 
30 30
 	now := kutil.Now()
31
-	retry := controller.Retry{0, kutil.Date(now.Year(), now.Month(), now.Day(), now.Hour(), now.Minute()-31, now.Second(), now.Nanosecond(), now.Location())}
31
+	retry := controller.Retry{
32
+		Count:          0,
33
+		StartTimestamp: kutil.Date(now.Year(), now.Month(), now.Day(), now.Hour(), now.Minute()-31, now.Second(), now.Nanosecond(), now.Location()),
34
+	}
32 35
 	if limitedLogAndRetry(updater, 30*time.Minute)(&buildapi.Build{Status: buildapi.BuildStatus{Phase: buildapi.BuildPhaseNew}}, err, retry) {
33 36
 		t.Error("Expected no more retries after reaching timeout!")
34 37
 	}
... ...
@@ -51,7 +54,10 @@ func TestLimitedLogAndRetryProcessing(t *testing.T) {
51 51
 	err := errors.New("funky error")
52 52
 
53 53
 	now := kutil.Now()
54
-	retry := controller.Retry{0, kutil.Date(now.Year(), now.Month(), now.Day(), now.Hour(), now.Minute()-10, now.Second(), now.Nanosecond(), now.Location())}
54
+	retry := controller.Retry{
55
+		Count:          0,
56
+		StartTimestamp: kutil.Date(now.Year(), now.Month(), now.Day(), now.Hour(), now.Minute()-10, now.Second(), now.Nanosecond(), now.Location()),
57
+	}
55 58
 	if !limitedLogAndRetry(updater, 30*time.Minute)(&buildapi.Build{Status: buildapi.BuildStatus{Phase: buildapi.BuildPhaseNew}}, err, retry) {
56 59
 		t.Error("Expected more retries!")
57 60
 	}
... ...
@@ -124,7 +124,7 @@ func RunImportImage(f *clientcmd.Factory, out io.Writer, cmd *cobra.Command, arg
124 124
 
125 125
 	fmt.Fprint(cmd.Out(), "The import completed successfully.", "\n\n")
126 126
 
127
-	d := describe.ImageStreamDescriber{osClient}
127
+	d := describe.ImageStreamDescriber{Interface: osClient}
128 128
 	info, err := d.Describe(stream.Namespace, stream.Name)
129 129
 	if err != nil {
130 130
 		return err
... ...
@@ -68,7 +68,7 @@ func RunStatus(f *clientcmd.Factory, out io.Writer) error {
68 68
 		return err
69 69
 	}
70 70
 
71
-	describer := &describe.ProjectStatusDescriber{kclient, client}
71
+	describer := &describe.ProjectStatusDescriber{K: kclient, C: client}
72 72
 	s, err := describer.Describe(namespace, "")
73 73
 	if err != nil {
74 74
 		return err
... ...
@@ -90,7 +90,7 @@ func RunGraph(f *clientcmd.Factory, out io.Writer) error {
90 90
 		return err
91 91
 	}
92 92
 
93
-	describer := &describe.ProjectStatusDescriber{kclient, client}
93
+	describer := &describe.ProjectStatusDescriber{K: kclient, C: client}
94 94
 	g, _, err := describer.MakeGraph(namespace)
95 95
 	if err != nil {
96 96
 		return err
... ...
@@ -513,7 +513,7 @@ func (c *MasterConfig) GetServiceAccountClients(name string) (*osclient.Client,
513 513
 	}
514 514
 	return serviceaccounts.Clients(
515 515
 		c.PrivilegedLoopbackClientConfig,
516
-		&serviceaccounts.ClientLookupTokenRetriever{c.PrivilegedLoopbackKubernetesClient},
516
+		&serviceaccounts.ClientLookupTokenRetriever{Client: c.PrivilegedLoopbackKubernetesClient},
517 517
 		c.Options.PolicyConfig.OpenShiftInfrastructureNamespace,
518 518
 		name,
519 519
 	)
... ...
@@ -35,7 +35,7 @@ func TestAllocate(t *testing.T) {
35 35
 		t.Fatal(err)
36 36
 	}
37 37
 
38
-	released := uid.Block{2, 3}
38
+	released := uid.Block{Start: 2, End: 3}
39 39
 	if err := r.Release(released); err != nil {
40 40
 		t.Fatal(err)
41 41
 	}
... ...
@@ -53,10 +53,10 @@ func TestAllocate(t *testing.T) {
53 53
 	if err := r.Release(released); err != nil {
54 54
 		t.Fatal(err)
55 55
 	}
56
-	if err := r.Allocate(uid.Block{11, 11}); err != ErrNotInRange {
56
+	if err := r.Allocate(uid.Block{Start: 11, End: 11}); err != ErrNotInRange {
57 57
 		t.Fatal(err)
58 58
 	}
59
-	if err := r.Allocate(uid.Block{8, 11}); err != ErrNotInRange {
59
+	if err := r.Allocate(uid.Block{Start: 8, End: 11}); err != ErrNotInRange {
60 60
 		t.Fatal(err)
61 61
 	}
62 62
 	if f := r.Free(); f != 1 {
... ...
@@ -179,7 +179,7 @@ func TestSimpleAllocationPluginViaController(t *testing.T) {
179 179
 	}
180 180
 
181 181
 	plugin, _ := NewSimpleAllocationPlugin("www.example.org")
182
-	fac := &rac.RouteAllocationControllerFactory{nil, nil}
182
+	fac := &rac.RouteAllocationControllerFactory{OSClient: nil, KubeClient: nil}
183 183
 	sac := fac.Create(plugin)
184 184
 
185 185
 	for _, tc := range tests {
... ...
@@ -101,7 +101,7 @@ func TestLogin(t *testing.T) {
101 101
 	// 	t.Fatalf("unexpected error: %v", err)
102 102
 	// }
103 103
 
104
-	userWhoamiOptions := cmd.WhoAmIOptions{oClient.Users(), ioutil.Discard}
104
+	userWhoamiOptions := cmd.WhoAmIOptions{UserInterface: oClient.Users(), Out: ioutil.Discard}
105 105
 	retrievedUser, err := userWhoamiOptions.WhoAmI()
106 106
 	if err != nil {
107 107
 		t.Errorf("unexpected error: %v", err)
... ...
@@ -110,7 +110,7 @@ func TestLogin(t *testing.T) {
110 110
 		t.Errorf("expected %v, got %v", retrievedUser.Name, username)
111 111
 	}
112 112
 
113
-	adminWhoamiOptions := cmd.WhoAmIOptions{clusterAdminClient.Users(), ioutil.Discard}
113
+	adminWhoamiOptions := cmd.WhoAmIOptions{UserInterface: clusterAdminClient.Users(), Out: ioutil.Discard}
114 114
 	retrievedAdmin, err := adminWhoamiOptions.WhoAmI()
115 115
 	if err != nil {
116 116
 		t.Errorf("unexpected error: %v", err)