51
51
import java .util .ArrayList ;
52
52
import java .util .Collections ;
53
53
import java .util .List ;
54
+ import java .util .concurrent .TimeUnit ;
54
55
import java .util .logging .*;
55
56
56
57
public class HealthCheckHelperTest {
@@ -66,6 +67,9 @@ public class HealthCheckHelperTest {
66
67
private List <Handler > savedHandlers = new ArrayList <>();
67
68
68
69
private UserProjects userProjects ;
70
+
71
+ private ApiClient apiClient ;
72
+ private CoreV1Api core ;
69
73
70
74
@ Before
71
75
public void setUp () throws Exception {
@@ -83,6 +87,13 @@ public void setUp() throws Exception {
83
87
unitHealthCheckHelper = new HealthCheckHelper (UNIT_NAMESPACE , Collections .singleton (UNIT_NAMESPACE ));
84
88
85
89
userProjects = UserProjects .createUserProjectsDirectory ();
90
+
91
+ apiClient = Config .defaultClient ();
92
+ core = new CoreV1Api (apiClient );
93
+
94
+ // Ensure that client doesn't time out before call or watch
95
+ apiClient .getHttpClient ().setReadTimeout (5 , TimeUnit .MINUTES );
96
+
86
97
}
87
98
88
99
@ After
@@ -101,8 +112,6 @@ public void testAccountNoPrivs() throws Exception {
101
112
Assume .assumeTrue (TestUtils .isKubernetesAvailable ());
102
113
103
114
// Create service account
104
- ApiClient apiClient = Config .defaultClient ();
105
- CoreV1Api core = new CoreV1Api (apiClient );
106
115
V1ServiceAccount alice = new V1ServiceAccount ();
107
116
alice .setMetadata (new V1ObjectMeta ().name ("alice" ));
108
117
try {
@@ -158,8 +167,6 @@ public void testAccountPrivs() throws Exception {
158
167
Assume .assumeTrue (TestUtils .isKubernetesAvailable ());
159
168
160
169
// Create service account
161
- ApiClient apiClient = Config .defaultClient ();
162
- CoreV1Api core = new CoreV1Api (apiClient );
163
170
V1ServiceAccount theo = new V1ServiceAccount ();
164
171
theo .setMetadata (new V1ObjectMeta ().name ("theo" ));
165
172
try {
0 commit comments