Add before and after logging for unit tests

Currently we have these logs for integration tests only.

This adds the following log at the start:
```
logger.info("[{}]: before test", getTestName());
```

and this is logged at the end, but before any clean up done in sub classes

```
 logger.info("[{}]: after test", getTestName());
```

Original commit: elastic/x-pack-elasticsearch@2ca7296665
This commit is contained in:
Boaz Leskes 2016-12-01 12:56:38 +01:00
parent 0701f7bb18
commit a4cec2316b
4 changed files with 9 additions and 9 deletions

View File

@ -69,7 +69,7 @@ public abstract class AbstractLicenseServiceTestCase extends ESTestCase {
}
@After
public void after() {
public void tearDown() {
licenseService.stop();
}
}

View File

@ -62,7 +62,7 @@ public class HttpClientTests extends ESTestCase {
}
@After
public void after() throws Exception {
public void tearDown() throws Exception {
webServer.shutdown();
}

View File

@ -44,7 +44,7 @@ public class DocumentSubsetReaderTests extends ESTestCase {
private BitsetFilterCache bitsetFilterCache;
@Before
public void before() {
public void setUpDirectory() {
directory = newDirectory();
IndexSettings settings = IndexSettingsModule.newIndexSettings("_index", Settings.EMPTY);
bitsetFilterCache = new BitsetFilterCache(settings, new BitsetFilterCache.Listener() {
@ -61,7 +61,7 @@ public class DocumentSubsetReaderTests extends ESTestCase {
}
@After
public void after() throws Exception {
public void cleanDirectory() throws Exception {
if (directoryReader != null) {
directoryReader.close();
}

View File

@ -69,18 +69,18 @@ import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.index.similarity.SimilarityService;
import org.elasticsearch.indices.IndicesModule;
import org.elasticsearch.indices.TermsLookup;
import org.elasticsearch.license.XPackLicenseState;
import org.elasticsearch.script.ExecutableScript;
import org.elasticsearch.script.Script;
import org.elasticsearch.script.ScriptContext;
import org.elasticsearch.script.ScriptService;
import org.elasticsearch.script.ScriptType;
import org.elasticsearch.search.aggregations.LeafBucketCollector;
import org.elasticsearch.xpack.security.authz.accesscontrol.DocumentSubsetReader.DocumentSubsetDirectoryReader;
import org.elasticsearch.license.XPackLicenseState;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.IndexSettingsModule;
import org.elasticsearch.xpack.security.user.User;
import org.elasticsearch.xpack.security.authz.accesscontrol.DocumentSubsetReader.DocumentSubsetDirectoryReader;
import org.elasticsearch.xpack.security.authz.permission.FieldPermissions;
import org.elasticsearch.xpack.security.user.User;
import org.junit.After;
import org.junit.Before;
import org.mockito.ArgumentCaptor;
@ -122,7 +122,7 @@ public class SecurityIndexSearcherWrapperUnitTests extends ESTestCase {
private IndexSettings indexSettings;
@Before
public void before() throws Exception {
public void setup() throws Exception {
Index index = new Index("_index", "testUUID");
scriptService = mock(ScriptService.class);
indexSettings = IndexSettingsModule.newIndexSettings(index, Settings.EMPTY);
@ -149,7 +149,7 @@ public class SecurityIndexSearcherWrapperUnitTests extends ESTestCase {
}
@After
public void after() throws Exception {
public void tearDown() throws Exception {
esIn.close();
}