Migrate RMI test to Java.#3525
Conversation
…nstrumentation into rmi-java
| .isInstanceOf(String.class); | ||
| }); | ||
| }) | ||
| .hasAttributesSatisfying( |
There was a problem hiding this comment.
open-telemetry/opentelemetry-java#3378 can improve a lot /cc @jkwatson
mateuszrzeszutek
left a comment
There was a problem hiding this comment.
The old Groovy trace assertions were more readable...
WDYT about writing our instrumentation tests in kotlin? I could try making a kotlin wrapper over otel-testing to make them look nicer
Well I don't think it's clear-cut :) They're definitely less text, but I think one of the intentiona. points of assertj is to make the assertions closer to English - I guess I'm fairly used to our groovy assertions by now but even so, but even when I read these Java ones, I feel like it's much easier to just skim through since the English is so easy to parse compared to the programming DSL. Writability would be terrible if having to write all that English out, but auto completion made it actually easier for me. This is only one example though and I don't want to overgeneralize yet.
But of course this could be a good option too. Downsides are
So tradeoff vs potential readability improvements - I think it would mostly be less indents and periods. Of course, if this is the only way to get rid of Groovy it is still a good way :P |
They are closer to English, I definitely agree with that, but I'm not that sure whether it's a good thing - what I liked more about the "old" groovy assertions that they were less visually cluttered, you almost didn't even have to read them, the structure of the code (e.g. indentation for trace/span/attributes...) told you a bit before you even started reading what's inside. Although maybe this gets a bit better if we work on the SDK assertions - lots of indentation and nesting comes from those
That's true, Kotlin is a pretty different language... I'm fairly comfortable with it myself, but I can understand if we do not want to introduce it to this project. Anyway, that's just an idea, something to keep in the back of mind - maybe it's worth trying out, maybe it's not really worth the effort of learning a significantly different language.
Yep, I thought mostly of our use case to be honest - I'm not sure if anybody else will want to use them. |
anuraaga
left a comment
There was a problem hiding this comment.
So - just confirming it's ok to merge this? :-)
|
Sure! Go ahead - we can't fix those Java assertions in this single PR, that needs some separate effort. |
|
Just for the record: I don't like java assertions :) |
I wanted to send out a test migration to Java just to compare with what we have. RMI is a good one to try since I had noticed randomly that we don't actually support compiling the tests when JAVA_HOME is 16 because Groovy doesn't support it and we have to disable the toolchain that would normally lower the Java version. So there is some tangible, not just stylistic, benefit from this I guess.
It definitely has a lot more indents and is more verbose, but I don't know if it's terrible (if googlejavaformat could give us a longer line length there'd be a huge improvement...). It was very easy to write thanks to quick code completion and syntax checking with red lines. There are definitely gaps because sdk-testing does not test semantic conventions (similar to otel api does not model semantic conventions, hence instrumentation-api), one major effect is the error event assertion but that could be improved.