Skip to content

Commit d6c1a97

Browse files
committed
test
Signed-off-by: Attila Mészáros <[email protected]>
1 parent f862506 commit d6c1a97

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerEventSource.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ public void onDelete(R resource, boolean b) {
160160
@Override
161161
public synchronized void start() {
162162
super.start();
163+
// this makes sure that on first reconciliation all resources are
164+
// present on the index
163165
manager().list().forEach(primaryToSecondaryIndex::onAddOrUpdate);
164166
}
165167

operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/source/informer/InformerEventSourceTest.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import java.util.Set;
55

66
import org.junit.jupiter.api.BeforeEach;
7-
import org.junit.jupiter.api.Disabled;
87
import org.junit.jupiter.api.Test;
98

109
import io.fabric8.kubernetes.api.model.ObjectMeta;
@@ -36,7 +35,6 @@
3635
import static org.mockito.Mockito.when;
3736

3837
@SuppressWarnings({"rawtypes", "unchecked"})
39-
@Disabled
4038
class InformerEventSourceTest {
4139

4240
private static final String PREV_RESOURCE_VERSION = "0";
@@ -59,7 +57,12 @@ void setup() {
5957
.thenReturn(mock(SecondaryToPrimaryMapper.class));
6058
when(informerEventSourceConfiguration.getResourceClass()).thenReturn(Deployment.class);
6159

62-
informerEventSource = new InformerEventSource<>(informerEventSourceConfiguration, clientMock);
60+
informerEventSource =
61+
new InformerEventSource<>(informerEventSourceConfiguration, clientMock) {
62+
// mocking start
63+
@Override
64+
public synchronized void start() {}
65+
};
6366

6467
var mockControllerConfig = mock(ControllerConfiguration.class);
6568
when(mockControllerConfig.getConfigurationService()).thenReturn(new BaseConfigurationService());

0 commit comments

Comments
 (0)