|
21 | 21 | import org.junit.Before;
|
22 | 22 | import org.junit.Test;
|
23 | 23 |
|
| 24 | +import static com.meterware.simplestub.Stub.createStrictStub; |
24 | 25 | import static java.util.function.Function.identity;
|
25 | 26 | import static oracle.kubernetes.operator.DomainProcessorTestSetup.NS;
|
26 | 27 | import static org.hamcrest.Matchers.not;
|
@@ -48,7 +49,7 @@ public void setUp() throws Exception {
|
48 | 49 | mementos.add(StaticStubSupport.preserve(Main.class, "namespaceStatuses"));
|
49 | 50 | mementos.add(StaticStubSupport.preserve(Main.class, "isNamespaceStopping"));
|
50 | 51 | mementos.add(StaticStubSupport.install(Main.class, "getHelmVariable", getTestHelmValue));
|
51 |
| - |
| 52 | + mementos.add(TuningParametersStub.install(120)); |
52 | 53 | AtomicBoolean stopping = new AtomicBoolean(true);
|
53 | 54 | JobWatcher.defineFactory(r -> createDaemonThread(), tuning, ns -> stopping);
|
54 | 55 | }
|
@@ -103,4 +104,23 @@ private Map<String, AtomicBoolean> createNamespaceFlags() {
|
103 | 104 | return currentNamespaces.stream()
|
104 | 105 | .collect(Collectors.toMap(identity(), a -> new AtomicBoolean()));
|
105 | 106 | }
|
| 107 | + |
| 108 | + abstract static class TuningParametersStub implements TuningParameters { |
| 109 | + |
| 110 | + int domainPresenceRecheckIntervalSeconds; |
| 111 | + |
| 112 | + public static Memento install(int newValue) throws NoSuchFieldException { |
| 113 | + return StaticStubSupport.install( |
| 114 | + TuningParametersImpl.class, "INSTANCE", createStrictStub(TuningParametersStub.class, newValue)); |
| 115 | + } |
| 116 | + |
| 117 | + TuningParametersStub(int domainPresenceRecheckIntervalSeconds) { |
| 118 | + this.domainPresenceRecheckIntervalSeconds = domainPresenceRecheckIntervalSeconds; |
| 119 | + } |
| 120 | + |
| 121 | + @Override |
| 122 | + public MainTuning getMainTuning() { |
| 123 | + return new MainTuning(2, 2, domainPresenceRecheckIntervalSeconds, 2, 2, 2, 2L, 2L); |
| 124 | + } |
| 125 | + } |
106 | 126 | }
|
0 commit comments