@@ -71,9 +71,9 @@ func mustBlock(t *testing.T, w <-chan Response) {
7171
7272func TestLinearInitialResources (t * testing.T ) {
7373 c := NewLinearCache (testType , map [string ]types.Resource {"a" : testResource ("a" ), "b" : testResource ("b" )})
74- w , _ := c .CreateWatch (Request {ResourceNames : []string {"a" }, TypeUrl : testType })
74+ w , _ := c .CreateWatch (& Request {ResourceNames : []string {"a" }, TypeUrl : testType })
7575 verifyResponse (t , w , "0" , 1 )
76- w , _ = c .CreateWatch (Request {TypeUrl : testType })
76+ w , _ = c .CreateWatch (& Request {TypeUrl : testType })
7777 verifyResponse (t , w , "0" , 2 )
7878}
7979
@@ -84,7 +84,7 @@ func TestLinearCornerCases(t *testing.T) {
8484 t .Error ("expected error on nil resource" )
8585 }
8686 // create an incorrect type URL request
87- w , _ := c .CreateWatch (Request {TypeUrl : "test" })
87+ w , _ := c .CreateWatch (& Request {TypeUrl : "test" })
8888 select {
8989 case _ , more := <- w :
9090 if more {
@@ -99,9 +99,9 @@ func TestLinearBasic(t *testing.T) {
9999 c := NewLinearCache (testType , nil )
100100
101101 // Create watches before a resource is ready
102- w1 , _ := c .CreateWatch (Request {ResourceNames : []string {"a" }, TypeUrl : testType , VersionInfo : "0" })
102+ w1 , _ := c .CreateWatch (& Request {ResourceNames : []string {"a" }, TypeUrl : testType , VersionInfo : "0" })
103103 mustBlock (t , w1 )
104- w , _ := c .CreateWatch (Request {TypeUrl : testType , VersionInfo : "0" })
104+ w , _ := c .CreateWatch (& Request {TypeUrl : testType , VersionInfo : "0" })
105105 mustBlock (t , w )
106106 checkWatchCount (t , c , "a" , 2 )
107107 checkWatchCount (t , c , "b" , 1 )
@@ -112,44 +112,44 @@ func TestLinearBasic(t *testing.T) {
112112 verifyResponse (t , w , "1" , 1 )
113113
114114 // Request again, should get same response
115- w , _ = c .CreateWatch (Request {ResourceNames : []string {"a" }, TypeUrl : testType , VersionInfo : "0" })
115+ w , _ = c .CreateWatch (& Request {ResourceNames : []string {"a" }, TypeUrl : testType , VersionInfo : "0" })
116116 checkWatchCount (t , c , "a" , 0 )
117117 verifyResponse (t , w , "1" , 1 )
118- w , _ = c .CreateWatch (Request {TypeUrl : testType , VersionInfo : "0" })
118+ w , _ = c .CreateWatch (& Request {TypeUrl : testType , VersionInfo : "0" })
119119 checkWatchCount (t , c , "a" , 0 )
120120 verifyResponse (t , w , "1" , 1 )
121121
122122 // Add another element and update the first, response should be different
123123 c .UpdateResource ("b" , testResource ("b" ))
124124 c .UpdateResource ("a" , testResource ("aa" ))
125- w , _ = c .CreateWatch (Request {ResourceNames : []string {"a" }, TypeUrl : testType , VersionInfo : "0" })
125+ w , _ = c .CreateWatch (& Request {ResourceNames : []string {"a" }, TypeUrl : testType , VersionInfo : "0" })
126126 verifyResponse (t , w , "3" , 1 )
127- w , _ = c .CreateWatch (Request {TypeUrl : testType , VersionInfo : "0" })
127+ w , _ = c .CreateWatch (& Request {TypeUrl : testType , VersionInfo : "0" })
128128 verifyResponse (t , w , "3" , 2 )
129129}
130130
131131func TestLinearDeletion (t * testing.T ) {
132132 c := NewLinearCache (testType , map [string ]types.Resource {"a" : testResource ("a" ), "b" : testResource ("b" )})
133- w , _ := c .CreateWatch (Request {ResourceNames : []string {"a" }, TypeUrl : testType , VersionInfo : "0" })
133+ w , _ := c .CreateWatch (& Request {ResourceNames : []string {"a" }, TypeUrl : testType , VersionInfo : "0" })
134134 mustBlock (t , w )
135135 checkWatchCount (t , c , "a" , 1 )
136136 c .DeleteResource ("a" )
137137 verifyResponse (t , w , "1" , 0 )
138138 checkWatchCount (t , c , "a" , 0 )
139- w , _ = c .CreateWatch (Request {TypeUrl : testType , VersionInfo : "0" })
139+ w , _ = c .CreateWatch (& Request {TypeUrl : testType , VersionInfo : "0" })
140140 verifyResponse (t , w , "1" , 1 )
141141 checkWatchCount (t , c , "b" , 0 )
142142 c .DeleteResource ("b" )
143- w , _ = c .CreateWatch (Request {TypeUrl : testType , VersionInfo : "1" })
143+ w , _ = c .CreateWatch (& Request {TypeUrl : testType , VersionInfo : "1" })
144144 verifyResponse (t , w , "2" , 0 )
145145 checkWatchCount (t , c , "b" , 0 )
146146}
147147
148148func TestLinearWatchTwo (t * testing.T ) {
149149 c := NewLinearCache (testType , map [string ]types.Resource {"a" : testResource ("a" ), "b" : testResource ("b" )})
150- w , _ := c .CreateWatch (Request {ResourceNames : []string {"a" , "b" }, TypeUrl : testType , VersionInfo : "0" })
150+ w , _ := c .CreateWatch (& Request {ResourceNames : []string {"a" , "b" }, TypeUrl : testType , VersionInfo : "0" })
151151 mustBlock (t , w )
152- w1 , _ := c .CreateWatch (Request {TypeUrl : testType , VersionInfo : "0" })
152+ w1 , _ := c .CreateWatch (& Request {TypeUrl : testType , VersionInfo : "0" })
153153 mustBlock (t , w1 )
154154 c .UpdateResource ("a" , testResource ("aa" ))
155155 // should only get the modified resource
@@ -162,24 +162,24 @@ func TestLinearCancel(t *testing.T) {
162162 c .UpdateResource ("a" , testResource ("a" ))
163163
164164 // cancel watch-all
165- w , cancel := c .CreateWatch (Request {TypeUrl : testType , VersionInfo : "1" })
165+ w , cancel := c .CreateWatch (& Request {TypeUrl : testType , VersionInfo : "1" })
166166 mustBlock (t , w )
167167 checkWatchCount (t , c , "a" , 1 )
168168 cancel ()
169169 checkWatchCount (t , c , "a" , 0 )
170170
171171 // cancel watch for "a"
172- w , cancel = c .CreateWatch (Request {ResourceNames : []string {"a" }, TypeUrl : testType , VersionInfo : "1" })
172+ w , cancel = c .CreateWatch (& Request {ResourceNames : []string {"a" }, TypeUrl : testType , VersionInfo : "1" })
173173 mustBlock (t , w )
174174 checkWatchCount (t , c , "a" , 1 )
175175 cancel ()
176176 checkWatchCount (t , c , "a" , 0 )
177177
178178 // open four watches for "a" and "b" and two for all, cancel one of each, make sure the second one is unaffected
179- w , cancel = c .CreateWatch (Request {ResourceNames : []string {"a" }, TypeUrl : testType , VersionInfo : "1" })
180- w2 , cancel2 := c .CreateWatch (Request {ResourceNames : []string {"b" }, TypeUrl : testType , VersionInfo : "1" })
181- w3 , cancel3 := c .CreateWatch (Request {TypeUrl : testType , VersionInfo : "1" })
182- w4 , cancel4 := c .CreateWatch (Request {TypeUrl : testType , VersionInfo : "1" })
179+ w , cancel = c .CreateWatch (& Request {ResourceNames : []string {"a" }, TypeUrl : testType , VersionInfo : "1" })
180+ w2 , cancel2 := c .CreateWatch (& Request {ResourceNames : []string {"b" }, TypeUrl : testType , VersionInfo : "1" })
181+ w3 , cancel3 := c .CreateWatch (& Request {TypeUrl : testType , VersionInfo : "1" })
182+ w4 , cancel4 := c .CreateWatch (& Request {TypeUrl : testType , VersionInfo : "1" })
183183 mustBlock (t , w )
184184 mustBlock (t , w2 )
185185 mustBlock (t , w3 )
@@ -212,7 +212,7 @@ func TestLinearConcurrentSetWatch(t *testing.T) {
212212 } else {
213213 id2 := fmt .Sprintf ("%d" , i - 1 )
214214 t .Logf ("request resources %q and %q" , id , id2 )
215- value , _ := c .CreateWatch (Request {
215+ value , _ := c .CreateWatch (& Request {
216216 // Only expect one to become stale
217217 ResourceNames : []string {id , id2 },
218218 VersionInfo : "0" ,
0 commit comments