From 34a5457d326be28e342c954b183affc03239e2b2 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Wed, 11 Dec 2024 09:16:14 -0800 Subject: [PATCH] Rename instrumenter tests (#118462) (#118479) The "sythetic" tests are the only unit tests for the instrumenter. This commit renames the test suite to be more clear it is the place to put instrumenter tests. --- ...rumenterTests.java => InstrumenterTests.java} | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) rename libs/entitlement/asm-provider/src/test/java/org/elasticsearch/entitlement/instrumentation/impl/{SyntheticInstrumenterTests.java => InstrumenterTests.java} (96%) diff --git a/libs/entitlement/asm-provider/src/test/java/org/elasticsearch/entitlement/instrumentation/impl/SyntheticInstrumenterTests.java b/libs/entitlement/asm-provider/src/test/java/org/elasticsearch/entitlement/instrumentation/impl/InstrumenterTests.java similarity index 96% rename from libs/entitlement/asm-provider/src/test/java/org/elasticsearch/entitlement/instrumentation/impl/SyntheticInstrumenterTests.java rename to libs/entitlement/asm-provider/src/test/java/org/elasticsearch/entitlement/instrumentation/impl/InstrumenterTests.java index 8e0409971ba61..75102b0bf260d 100644 --- a/libs/entitlement/asm-provider/src/test/java/org/elasticsearch/entitlement/instrumentation/impl/SyntheticInstrumenterTests.java +++ b/libs/entitlement/asm-provider/src/test/java/org/elasticsearch/entitlement/instrumentation/impl/InstrumenterTests.java @@ -34,8 +34,8 @@ * some ad-hoc test cases (e.g. overloaded methods, overloaded targets, multiple instrumentation, etc.) */ @ESTestCase.WithoutSecurityManager -public class SyntheticInstrumenterTests extends ESTestCase { - private static final Logger logger = LogManager.getLogger(SyntheticInstrumenterTests.class); +public class InstrumenterTests extends ESTestCase { + private static final Logger logger = LogManager.getLogger(InstrumenterTests.class); /** * Contains all the virtual methods from {@link TestClassToInstrument}, @@ -137,10 +137,10 @@ public void checkSomeStaticMethod(Class callerClass, int arg, String anotherA @Override public void checkSomeInstanceMethod(Class callerClass, Testable that, int arg, String anotherArg) { checkSomeInstanceMethodCallCount++; - assertSame(SyntheticInstrumenterTests.class, callerClass); + assertSame(InstrumenterTests.class, callerClass); assertThat( that.getClass().getName(), - startsWith("org.elasticsearch.entitlement.instrumentation.impl.SyntheticInstrumenterTests$TestClassToInstrument") + startsWith("org.elasticsearch.entitlement.instrumentation.impl.InstrumenterTests$TestClassToInstrument") ); assertEquals(123, arg); assertEquals("def", anotherArg); @@ -150,14 +150,14 @@ public void checkSomeInstanceMethod(Class callerClass, Testable that, int arg @Override public void checkCtor(Class callerClass) { checkCtorCallCount++; - assertSame(SyntheticInstrumenterTests.class, callerClass); + assertSame(InstrumenterTests.class, callerClass); throwIfActive(); } @Override public void checkCtor(Class callerClass, int arg) { checkCtorIntCallCount++; - assertSame(SyntheticInstrumenterTests.class, callerClass); + assertSame(InstrumenterTests.class, callerClass); assertEquals(123, arg); throwIfActive(); } @@ -374,8 +374,8 @@ public void testInstrumenterWorksWithConstructors() throws Exception { * Testable) which is not what would happen when it's run by the agent. */ private InstrumenterImpl createInstrumenter(Map checkMethods) { - String checkerClass = Type.getInternalName(SyntheticInstrumenterTests.MockEntitlementChecker.class); - String handleClass = Type.getInternalName(SyntheticInstrumenterTests.TestEntitlementCheckerHolder.class); + String checkerClass = Type.getInternalName(InstrumenterTests.MockEntitlementChecker.class); + String handleClass = Type.getInternalName(InstrumenterTests.TestEntitlementCheckerHolder.class); String getCheckerClassMethodDescriptor = Type.getMethodDescriptor(Type.getObjectType(checkerClass)); return new InstrumenterImpl(handleClass, getCheckerClassMethodDescriptor, "_NEW", checkMethods);