Log the start and finish of tests within ShardableTestCase

Kokoro's logs do not identify which test is allocated to which shard, so explicitly log the test names at start and finish.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=140594581
This commit is contained in:
ctingue 2016-11-30 05:38:54 -08:00 committed by Ben McIlwain
parent 5f32d1bbeb
commit e51e220a98
2 changed files with 21 additions and 10 deletions

View file

@ -14,16 +14,36 @@
package google.registry.testing;
import google.registry.util.FormattingLogger;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
/**
* Test case with 3 empty methods.
*
* The sharding test runner fails if it produces an empty shard, and we shard 4 ways. This makes
* <p>The sharding test runner fails if it produces an empty shard, and we shard 4 ways. This makes
* sure that we never produces empty shards.
*/
public abstract class ShardableTestCase {
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
@Rule
public final TestName testName = new TestName();
@Before
public void beforeShardable() {
logger.infofmt("Starting test %s", testName.getMethodName());
}
@After
public void afterShardable() {
logger.infofmt("Finishing test %s", testName.getMethodName());
}
@Test
public void testNothing1() {}