@@ -116,7 +116,7 @@ public Watchable<V1Pod> watch(CallGeneratorParams params) throws ApiException {
116
116
}
117
117
118
118
@ Test
119
- public void testReflectorRunnableCaptureListException () throws ApiException {
119
+ public void testReflectorRunnableCaptureListRuntimeException () throws ApiException {
120
120
RuntimeException expectedException = new RuntimeException ("noxu" );
121
121
AtomicReference <Throwable > actualException = new AtomicReference <>();
122
122
when (listerWatcher .list (any ())).thenThrow (expectedException );
@@ -141,6 +141,61 @@ public void testReflectorRunnableCaptureListException() throws ApiException {
141
141
}
142
142
}
143
143
144
+ @ Test
145
+ public void testReflectorRunnableShouldPardonList410ApiException () throws ApiException {
146
+ ApiException expectedException = new ApiException (410 , "noxu" );
147
+ AtomicReference <Throwable > actualException = new AtomicReference <>();
148
+ when (listerWatcher .list (any ())).thenThrow (expectedException );
149
+ ReflectorRunnable <V1Pod , V1PodList > reflectorRunnable =
150
+ new ReflectorRunnable <>(
151
+ V1Pod .class ,
152
+ listerWatcher ,
153
+ deltaFIFO ,
154
+ (apiType , t ) -> {
155
+ actualException .set (t );
156
+ });
157
+ try {
158
+ Thread thread = new Thread (reflectorRunnable ::run );
159
+ thread .setDaemon (true );
160
+ thread .start ();
161
+ Awaitility .await ()
162
+ .atMost (Duration .ofSeconds (1 ))
163
+ .pollInterval (Duration .ofMillis (100 ))
164
+ .until (
165
+ () -> {
166
+ return reflectorRunnable .isLastSyncResourceVersionUnavailable ();
167
+ });
168
+ } finally {
169
+ reflectorRunnable .stop ();
170
+ }
171
+ }
172
+
173
+ @ Test
174
+ public void testReflectorRunnableShouldCaptureListNon410ApiException () throws ApiException {
175
+ ApiException expectedException = new ApiException (403 , "noxu" );
176
+ AtomicReference <Throwable > actualException = new AtomicReference <>();
177
+ when (listerWatcher .list (any ())).thenThrow (expectedException );
178
+ ReflectorRunnable <V1Pod , V1PodList > reflectorRunnable =
179
+ new ReflectorRunnable <>(
180
+ V1Pod .class ,
181
+ listerWatcher ,
182
+ deltaFIFO ,
183
+ (apiType , t ) -> {
184
+ actualException .set (t );
185
+ });
186
+ try {
187
+ Thread thread = new Thread (reflectorRunnable ::run );
188
+ thread .setDaemon (true );
189
+ thread .start ();
190
+ Awaitility .await ()
191
+ .atMost (Duration .ofSeconds (1 ))
192
+ .pollInterval (Duration .ofMillis (100 ))
193
+ .untilAtomic (actualException , new IsEqual <>(expectedException ));
194
+ } finally {
195
+ reflectorRunnable .stop ();
196
+ }
197
+ }
198
+
144
199
@ Test
145
200
public void testReflectorRunnableCaptureWatchException () throws ApiException {
146
201
RuntimeException expectedException = new RuntimeException ("noxu" );
0 commit comments