Modify ↓
#16637 closed defect (fixed)
Rework unit tests to not depend on external website
Reported by: | Don-vip | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | 20.11 |
Component: | Unit tests | Version: | |
Keywords: | Cc: | ris |
Description (last modified by )
We still have some unit tests making real network connections, failing when the website is slow or unreachable:
- ✔ org.openstreetmap.josm.gui.oauth.OsmOAuthAuthorizationClientTest.testCookieHandlingMock
- org.openstreetmap.josm.gui.oauth.OsmOAuthAuthorizationClientTest.testCookieHandlingCookieManager
- ✔ org.openstreetmap.josm.gui.preferences.server.ApiUrlTestTaskTest.testNominalUrl
- ✔ org.openstreetmap.josm.gui.preferences.server.ApiUrlTestTaskTest.testAlertInvalidServerResult
- ✔ org.openstreetmap.josm.io.OsmServerHistoryReaderTest.testWay
- ✔ org.openstreetmap.josm.io.OsmServerHistoryReaderTest.testNode
- ✔ org.openstreetmap.josm.tools.HttpClientTest.testOpenUrlBzip
- ✔ org.openstreetmap.josm.tools.HttpClientTest.testOpenUrlGzip
- ✔ org.openstreetmap.josm.tools.HttpClientTest.testTicket9660
Attachments (0)
Change History (19)
comment:1 by , 7 years ago
comment:7 by , 4 years ago
Milestone: | → 20.10 |
---|
comment:12 by , 4 years ago
Description: | modified (diff) |
---|
comment:14 by , 4 years ago
Description: | modified (diff) |
---|
comment:15 by , 4 years ago
Replying to simon04:
In 17197/josm:
This broke some other test.
Are failing tests a reason for not building the ubuntu package?
comment:17 by , 4 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:19 by , 4 years ago
Two tests seem to still use the API directly, which is currently down:
org.openstreetmap.josm.actions.downloadtasks.DownloadNotesTaskTest.testDownloadExternalFile org.openstreetmap.josm.data.oauth.SignpostAdaptersTest.testHttpResponseGetReasonPhrase
They failed with "connect time out" error.
java.lang.Exception: Test timed out after 10 000ms at org.openstreetmap.josm.testutils.JOSMTestRules$FailOnTimeoutStatement.evaluate(JOSMTestRules.java:778) at org.openstreetmap.josm.testutils.JOSMTestRules$CreateJosmEnvironment.evaluate(JOSMTestRules.java:733) at com.github.tomakehurst.wiremock.junit.WireMockRule$1.evaluate(WireMockRule.java:79) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63) at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.ParentRunner.run(ParentRunner.java:413) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at org.junit.runner.JUnitCore.run(JUnitCore.java:115) at org.junit.vintage.engine.execution.RunnerExecutor.execute(RunnerExecutor.java:43) at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133) at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497) at org.junit.vintage.engine.VintageTestEngine.executeAllChildren(VintageTestEngine.java:82) at org.junit.vintage.engine.VintageTestEngine.execute(VintageTestEngine.java:73) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:108) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:96) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:75) at org.apache.tools.ant.taskdefs.optional.junitlauncher.LauncherSupport.launch(LauncherSupport.java:144) at org.apache.tools.ant.taskdefs.optional.junitlauncher.StandaloneLauncher.main(StandaloneLauncher.java:114)
java.net.SocketTimeoutException: connect timed out ... at java.base/java.net.Socket.connect(Socket.java:609) at org.openstreetmap.josm.tools.Http1Client.performConnection(Http1Client.java:78) at org.openstreetmap.josm.tools.HttpClient.connect(HttpClient.java:148) at org.openstreetmap.josm.tools.HttpClient.connect(HttpClient.java:124) at org.openstreetmap.josm.data.oauth.SignpostAdaptersTest.testHttpResponseGetReasonPhrase(SignpostAdaptersTest.java:97)
Note:
See TracTickets
for help on using tickets.
There also those that unintentionally make network requests, e.g. fetching the "start page" from the wiki.