Skip to content

Commit 34a5457

Browse files
authored
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.
1 parent fcf634c commit 34a5457

File tree

1 file changed

+8
-8
lines changed
  • libs/entitlement/asm-provider/src/test/java/org/elasticsearch/entitlement/instrumentation/impl

1 file changed

+8
-8
lines changed
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
* some ad-hoc test cases (e.g. overloaded methods, overloaded targets, multiple instrumentation, etc.)
3535
*/
3636
@ESTestCase.WithoutSecurityManager
37-
public class SyntheticInstrumenterTests extends ESTestCase {
38-
private static final Logger logger = LogManager.getLogger(SyntheticInstrumenterTests.class);
37+
public class InstrumenterTests extends ESTestCase {
38+
private static final Logger logger = LogManager.getLogger(InstrumenterTests.class);
3939

4040
/**
4141
* Contains all the virtual methods from {@link TestClassToInstrument},
@@ -137,10 +137,10 @@ public void checkSomeStaticMethod(Class<?> callerClass, int arg, String anotherA
137137
@Override
138138
public void checkSomeInstanceMethod(Class<?> callerClass, Testable that, int arg, String anotherArg) {
139139
checkSomeInstanceMethodCallCount++;
140-
assertSame(SyntheticInstrumenterTests.class, callerClass);
140+
assertSame(InstrumenterTests.class, callerClass);
141141
assertThat(
142142
that.getClass().getName(),
143-
startsWith("org.elasticsearch.entitlement.instrumentation.impl.SyntheticInstrumenterTests$TestClassToInstrument")
143+
startsWith("org.elasticsearch.entitlement.instrumentation.impl.InstrumenterTests$TestClassToInstrument")
144144
);
145145
assertEquals(123, arg);
146146
assertEquals("def", anotherArg);
@@ -150,14 +150,14 @@ public void checkSomeInstanceMethod(Class<?> callerClass, Testable that, int arg
150150
@Override
151151
public void checkCtor(Class<?> callerClass) {
152152
checkCtorCallCount++;
153-
assertSame(SyntheticInstrumenterTests.class, callerClass);
153+
assertSame(InstrumenterTests.class, callerClass);
154154
throwIfActive();
155155
}
156156

157157
@Override
158158
public void checkCtor(Class<?> callerClass, int arg) {
159159
checkCtorIntCallCount++;
160-
assertSame(SyntheticInstrumenterTests.class, callerClass);
160+
assertSame(InstrumenterTests.class, callerClass);
161161
assertEquals(123, arg);
162162
throwIfActive();
163163
}
@@ -374,8 +374,8 @@ public void testInstrumenterWorksWithConstructors() throws Exception {
374374
* Testable) which is not what would happen when it's run by the agent.
375375
*/
376376
private InstrumenterImpl createInstrumenter(Map<MethodKey, CheckMethod> checkMethods) {
377-
String checkerClass = Type.getInternalName(SyntheticInstrumenterTests.MockEntitlementChecker.class);
378-
String handleClass = Type.getInternalName(SyntheticInstrumenterTests.TestEntitlementCheckerHolder.class);
377+
String checkerClass = Type.getInternalName(InstrumenterTests.MockEntitlementChecker.class);
378+
String handleClass = Type.getInternalName(InstrumenterTests.TestEntitlementCheckerHolder.class);
379379
String getCheckerClassMethodDescriptor = Type.getMethodDescriptor(Type.getObjectType(checkerClass));
380380

381381
return new InstrumenterImpl(handleClass, getCheckerClassMethodDescriptor, "_NEW", checkMethods);

0 commit comments

Comments
 (0)