()
| 84 | private CompactionQueue compactionq; |
| 85 | |
| 86 | @Before |
| 87 | public void before() throws Exception { |
| 88 | // Inject the attributes we need into the "tsdb" object. |
| 89 | Whitebox.setInternalState(tsdb, "metrics", mock(UniqueId.class)); |
| 90 | Whitebox.setInternalState(tsdb, "table", TABLE); |
| 91 | Whitebox.setInternalState(config, "enable_compactions", true); |
| 92 | Whitebox.setInternalState(config, "fix_duplicates", true); |
| 93 | Whitebox.setInternalState(tsdb, "config", config); |
| 94 | when(tsdb.getConfig()).thenReturn(config); |
| 95 | // Stub out the compaction thread, so it doesn't even start. |
| 96 | PowerMockito.whenNew(CompactionQueue.Thrd.class).withNoArguments() |
| 97 | .thenReturn(mock(CompactionQueue.Thrd.class)); |
| 98 | PowerMockito.when(config.enable_compactions()).thenReturn(true); |
| 99 | PowerMockito.when(config.fix_duplicates()).thenReturn(true); |
| 100 | compactionq = new CompactionQueue(tsdb); |
| 101 | |
| 102 | when(tsdb.put(anyBytes(), anyBytes(), anyBytes(), anyLong())) |
| 103 | .thenAnswer(newDeferred()); |
| 104 | when(tsdb.delete(anyBytes(), any(byte[][].class))) |
| 105 | .thenAnswer(newDeferred()); |
| 106 | } |
| 107 | |
| 108 | @Test |
| 109 | public void useMaxTsWhileCompacting() throws Exception { |
nothing calls this directly
no test coverage detected