okapi-connector-google failing, needs mocking
okapi-connector-google does not get tested because there are no keys.
It fails with "Error 403 - User limit exceeded for query query"
And the error is in net.sf.okapi.connectors.google.GoogleMTv2Connector. So it is not detected in test, it is just left to go through.
I think what DeepL does better:
- The "normal" tests detect the key is missing, log, and don't run
- DeepLv1ConnectorMockitoTests mocks, very nice.
Comments (10)
-
reporter -
reporter - changed title to okapi-connector-google failing, needs mocking
- edited description
-
Which tests?
TestGoogleMTv2Connector
is using a mock already. -
reporter Running mvn install I get this:
[main] ERROR net.sf.okapi.connectors.google.GoogleMTv2Connector - Error 403 - User limit exceeded for query query [main] INFO net.sf.okapi.connectors.google.GoogleMTv2Connector - _batchQuery - retry 1 (waiting 0 ms
11 times, in
net.sf.okapi.connectors.google.TestGoogleMTv2Connector
-
That's a result of the mocking, which simulates periodic failure to test the retry code:
-
reporter Oh... Apologies.
Maybe I should learn to read the code before complaining.
Thanks a lot, have a nice week-end :-) Mihai
-
reporter - changed status to resolved
-
reporter - changed status to invalid
-
I'm happy to clean up the logs, though!
-
reporter Not sure how can you clean the logs though... I have 3 ideas. 1 & 2 easy, 3 not so easy, but maybe nicer.
1. You can disable logging for the
GoogleMTv2Connector
class inokapi\deployment\logbind-logback\src\main\resources\logback.xml
:<logger name="net.sf.okapi.connectors.google.GoogleMTv2Connector" level="OFF"/>
But the logging is a good indication that the connector does what is supposed to do: detect the timeout and report it.
2. An option would be to keep it enabled, and add logging in the unit test saying something like
"Logging about timeout errors from GoogleMTv2Connector are expected, don't worry, be happy :-)"
That prevent people like me from getting scared :-)
3. But if the unit test checks that the connector detects timeouts, then it should do that automatically. So would need something like expect certain logging, and assert if it is not received. That might be tricky to setup. But once setup, it might be nice to use in other situations too...
Not sure how to do that cleanly though... The way would be to write a log appender. But that should be for logback, which we use for development and testing. And we don't see it directly, because is "hidden behind slf4j" I'll think about it.
- Log in to comment
My bad: okapi-connector-deepl already has mocking. I've replaced print with logging.