@@ -36,7 +36,7 @@ class LeaderElectionE2E {
36
36
37
37
public static final String TEST_RESOURCE_NAME = "test1" ;
38
38
public static final int MINIMAL_SECONDS_FOR_RENEWAL = 3 ;
39
- public static final int MAX_WAIT_SECONDS = 10 ;
39
+ public static final int MAX_WAIT_SECONDS = 30 ;
40
40
41
41
private static final String OPERATOR_1_POD_NAME = "leader-election-operator-1" ;
42
42
private static final String OPERATOR_2_POD_NAME = "leader-election-operator-2" ;
@@ -55,7 +55,7 @@ void otherInstancesTakesOverWhenSteppingDown() {
55
55
await ().pollDelay (Duration .ofSeconds (MINIMAL_SECONDS_FOR_RENEWAL ))
56
56
.atMost (Duration .ofSeconds (MAX_WAIT_SECONDS ))
57
57
.untilAsserted (() -> {
58
- var actualStatus = client .resources (LeaderElectionTest .class )
58
+ var actualStatus = client .resources (LeaderElectionTestCustomResource .class )
59
59
.inNamespace (namespace ).withName (TEST_RESOURCE_NAME ).get ().getStatus ();
60
60
61
61
assertThat (actualStatus ).isNotNull ();
@@ -64,22 +64,23 @@ void otherInstancesTakesOverWhenSteppingDown() {
64
64
65
65
client .pods ().inNamespace (namespace ).withName (OPERATOR_1_POD_NAME ).delete ();
66
66
67
- var actualListSize = client .resources (LeaderElectionTest .class )
67
+ var actualListSize = client .resources (LeaderElectionTestCustomResource .class )
68
68
.inNamespace (namespace ).withName (TEST_RESOURCE_NAME ).get ().getStatus ().getReconciledBy ()
69
69
.size ();
70
70
71
71
await ().pollDelay (Duration .ofSeconds (MINIMAL_SECONDS_FOR_RENEWAL ))
72
72
.atMost (Duration .ofSeconds (240 ))
73
73
.untilAsserted (() -> {
74
- var actualStatus = client .resources (LeaderElectionTest .class )
74
+ var actualStatus = client .resources (LeaderElectionTestCustomResource .class )
75
75
.inNamespace (namespace ).withName (TEST_RESOURCE_NAME ).get ().getStatus ();
76
76
77
77
assertThat (actualStatus ).isNotNull ();
78
78
assertThat (actualStatus .getReconciledBy ()).hasSizeGreaterThan (actualListSize + 2 );
79
79
});
80
80
81
- assertReconciliations (client .resources (LeaderElectionTest .class ).inNamespace (namespace )
82
- .withName (TEST_RESOURCE_NAME ).get ().getStatus ().getReconciledBy ());
81
+ assertReconciliations (
82
+ client .resources (LeaderElectionTestCustomResource .class ).inNamespace (namespace )
83
+ .withName (TEST_RESOURCE_NAME ).get ().getStatus ().getReconciledBy ());
83
84
}
84
85
85
86
private void assertReconciliations (List <String > reconciledBy ) {
@@ -95,7 +96,7 @@ private void assertReconciliations(List<String> reconciledBy) {
95
96
}
96
97
97
98
private void applyCustomResource () {
98
- var res = new LeaderElectionTest ();
99
+ var res = new LeaderElectionTestCustomResource ();
99
100
res .setMetadata (new ObjectMetaBuilder ()
100
101
.withName (TEST_RESOURCE_NAME )
101
102
.withNamespace (namespace )
@@ -119,7 +120,7 @@ void tearDown() {
119
120
client .namespaces ().resource (new NamespaceBuilder ().withNewMetadata ().withName (namespace )
120
121
.endMetadata ().build ()).delete ();
121
122
await ()
122
- .atMost (Duration .ofSeconds (15 ))
123
+ .atMost (Duration .ofSeconds (60 ))
123
124
.untilAsserted (() -> assertThat (client .namespaces ().withName (namespace ).get ()).isNull ());
124
125
}
125
126
@@ -139,7 +140,7 @@ private void deployOperatorsInOrder() {
139
140
140
141
void applyCRD () {
141
142
String path =
142
- "./target/classes/META-INF/fabric8/leaderelectiontests .sample.javaoperatorsdk-v1.yml" ;
143
+ "./target/classes/META-INF/fabric8/leaderelectiontestcustomresources .sample.javaoperatorsdk-v1.yml" ;
143
144
try (InputStream is = new FileInputStream (path )) {
144
145
final var crd = client .load (is );
145
146
crd .createOrReplace ();
0 commit comments