Skip to content

Commit e7a80ee

Browse files
committed
no builder in e2e test
1 parent df6f2ef commit e7a80ee

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/LeaderElectionConfiguration.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ public class LeaderElectionConfiguration {
1717
private final Duration renewDeadline;
1818
private final Duration retryPeriod;
1919

20+
public LeaderElectionConfiguration(String leaseName, String leaseNamespace, String identity) {
21+
this(
22+
leaseName,
23+
leaseNamespace,
24+
LEASE_DURATION_DEFAULT_VALUE,
25+
RENEW_DEADLINE_DEFAULT_VALUE,
26+
RETRY_PERIOD_DEFAULT_VALUE, identity);
27+
}
28+
2029
public LeaderElectionConfiguration(String leaseName, String leaseNamespace) {
2130
this(
2231
leaseName,

sample-operators/leader-election/src/main/java/io/javaoperatorsdk/operator/sample/LeaderElectionTestOperator.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import io.fabric8.kubernetes.client.ConfigBuilder;
77
import io.fabric8.kubernetes.client.KubernetesClientBuilder;
88
import io.javaoperatorsdk.operator.Operator;
9-
import io.javaoperatorsdk.operator.api.config.LeaderElectionConfigurationBuilder;
9+
import io.javaoperatorsdk.operator.api.config.LeaderElectionConfiguration;
1010

1111
public class LeaderElectionTestOperator {
1212

@@ -23,11 +23,9 @@ public static void main(String[] args) {
2323
.build()).build();
2424

2525
Operator operator = new Operator(client,
26-
c -> c.withLeaderElectionConfiguration(new LeaderElectionConfigurationBuilder()
27-
.withLeaseName("leader-election-test")
28-
.withLeaseNamespace(namespace)
29-
.withIdentity(identity)
30-
.build()));
26+
c -> c.withLeaderElectionConfiguration(
27+
new LeaderElectionConfiguration("leader-election-test", namespace, identity)));
28+
3129
operator.register(new LeaderElectionTestReconciler(identity));
3230
operator.installShutdownHook();
3331
operator.start();

sample-operators/leader-election/src/test/java/io/javaoperatorsdk/operator/sample/LeaderElectionE2E.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import org.junit.jupiter.api.AfterEach;
1515
import org.junit.jupiter.api.BeforeEach;
1616
import org.junit.jupiter.api.Test;
17-
import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
1817
import org.slf4j.Logger;
1918
import org.slf4j.LoggerFactory;
2019

@@ -47,7 +46,7 @@ class LeaderElectionE2E {
4746

4847
@Test
4948
// not for local mode by design
50-
// @EnabledIfSystemProperty(named = "test.deployment", matches = "remote")
49+
// @EnabledIfSystemProperty(named = "test.deployment", matches = "remote")
5150
void otherInstancesTakesOverWhenSteppingDown() {
5251
log.info("Deploying operator");
5352
deployOperatorsInOrder();

0 commit comments

Comments
 (0)