olvid-io / olvid-android

Olvid for Android
GNU Affero General Public License v3.0
149 stars 14 forks source link

Fail to run unit tests with "./gradlew test" on v0.13.0 #13

Open kumy opened 1 year ago

kumy commented 1 year ago

Is it just me? I'm unable to pass the tests

The tests are failing with some java.io.FileNotFoundException

https://github.com/kumy/olvid-android/actions/runs/3348245044/jobs/5547103193#step:4:241

> Task :java-websocket:test

org.java_websocket_olvid.AllTests > org.java_websocket_olvid.issues.Issue764Test.testIssue FAILED
    java.io.FileNotFoundException at Issue764Test.java:73

org.java_websocket_olvid.AllTests > org.java_websocket_olvid.issues.Issue825Test.testIssue FAILED
    java.io.FileNotFoundException at Issue825Test.java:75

org.java_websocket_olvid.issues.AllIssueTests > org.java_websocket_olvid.issues.Issue256Test.runReconnectSocketClose[0] FAILED
    java.lang.AssertionError at Assert.java:88

org.java_websocket_olvid.issues.AllIssueTests > org.java_websocket_olvid.issues.Issue764Test.testIssue FAILED
    java.io.FileNotFoundException at Issue764Test.java:73

org.java_websocket_olvid.issues.AllIssueTests > org.java_websocket_olvid.issues.Issue825Test.testIssue FAILED
    java.io.FileNotFoundException at Issue825Test.java:75

org.java_websocket_olvid.issues.Issue1142Test > testWithSSLSession FAILED
    java.io.FileNotFoundException at Issue1142Test.java:112
[...]
finiasz commented 1 year ago

We had to modify the Java-Websocket library to get access to the output buffer size (for some optimizations in the web client). Then, there was a "collision" with the namespace of the unmodified Java-Websocket library used in the engine, so we changed the namespace of our modified version. This is probably what causes the tests to fail. For now, you should probably just disable the tests on this library.

Anyway, in our next release of the app we will probably switch from Java-Websocket to the builtin websocket implementation of okHttp which is able to work through an HTTP proxy (the Java-Websocket lib requires a SOCKS proxy).

kumy commented 1 year ago

Thanks

For now, you should probably just disable the tests on this library.

Could you please explain what need to be changed? :pray:


FTR, the error stack trace. It seems the same on all failing tests

java.io.FileNotFoundException: src/test/java/org/java_websocket/keystore.jks (No such file or directory)
    at java.base/java.io.FileInputStream.open0(Native Method)
    at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
    at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
    at org.java_websocket_olvid.util.SSLContextUtil.getContext(SSLContextUtil.java:49)
    at org.java_websocket_olvid.issues.Issue764Test.testIssue(Issue764Test.java:73)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298)
    at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.lang.Thread.run(Thread.java:829)
finiasz commented 1 year ago

I tried running the tests and there are just 3 minor changes to make following our modification. The following patch file can be applied to fix these: git apply patch.txt

patch.txt

kumy commented 1 year ago

Thanks, I already fix those one, exactly the same way, but it's not sufficient...

org.java_websocket_olvid.issues.Issue997Test > test_localServer_ServerLocalhost_ClientLocalhost_CheckDefault FAILED
    java.lang.AssertionError at Issue997Test.java:103

org.java_websocket_olvid.issues.Issue997Test > test_localServer_ServerLocalhost_ClientLocalhost_CheckInactive FAILED
    java.lang.AssertionError at Issue997Test.java:94

org.java_websocket_olvid.issues.Issue997Test > test_localServer_ServerLocalhost_ClientLocalhost_CheckActive FAILED
    java.lang.AssertionError at Issue997Test.java:85

org.java_websocket_olvid.AllTests > org.java_websocket_olvid.issues.Issue256Test.runReconnectSocketClose[0] FAILED
    java.lang.AssertionError at Assert.java:88

org.java_websocket_olvid.AllTests > org.java_websocket_olvid.issues.Issue764Test.testIssue FAILED
    org.junit.runners.model.TestTimedOutException at Issue764Test.java:79

org.java_websocket_olvid.issues.AllIssueTests > org.java_websocket_olvid.issues.Issue256Test.runReconnectSocketClose[0] FAILED
    java.lang.AssertionError at Assert.java:88

org.java_websocket_olvid.issues.AllIssueTests > org.java_websocket_olvid.issues.Issue764Test.testIssue FAILED
    org.junit.runners.model.TestTimedOutException at Issue764Test.java:79

org.java_websocket_olvid.issues.AllIssueTests > org.java_websocket_olvid.issues.Issue834Test.testNoNewThreads FAILED
    java.lang.AssertionError at Issue834Test.java:64

org.java_websocket_olvid.issues.Issue1142Test > testWithSSLSession FAILED
    org.junit.runners.model.TestTimedOutException at Issue1142Test.java:118

Then I've tested with that patch2-kumy.txt

And now sardine is complaining :thinking:

> Task :sardine-android:testDebugUnitTest

com.thegrizzlylabs.sardineandroid.AuthenticationTest > testBasicAuth FAILED
    com.thegrizzlylabs.sardineandroid.impl.SardineException at AuthenticationTest.java:36

com.thegrizzlylabs.sardineandroid.FunctionalSardineTest > testDavPrincipals FAILED
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:65
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:70

com.thegrizzlylabs.sardineandroid.FunctionalSardineTest > testDavOwner FAILED
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:65
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:70

com.thegrizzlylabs.sardineandroid.FunctionalSardineTest > testReadEmptyFile FAILED
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:65
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:70

com.thegrizzlylabs.sardineandroid.FunctionalSardineTest > testPut FAILED
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:65
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:70

com.thegrizzlylabs.sardineandroid.FunctionalSardineTest > testDepth FAILED
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:65
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:70

com.thegrizzlylabs.sardineandroid.FunctionalSardineTest > testMove FAILED
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:65
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:70

com.thegrizzlylabs.sardineandroid.FunctionalSardineTest > testPath FAILED
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:65
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:70

com.thegrizzlylabs.sardineandroid.FunctionalSardineTest > testRead FAILED
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:65
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:70

com.thegrizzlylabs.sardineandroid.FunctionalSardineTest > testGetTimestamps FAILED
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:65
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:70

com.thegrizzlylabs.sardineandroid.FunctionalSardineTest > testMoveOverwriting FAILED
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:65
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:70

com.thegrizzlylabs.sardineandroid.FunctionalSardineTest > testDirectoryContentType FAILED
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:65
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:70

com.thegrizzlylabs.sardineandroid.FunctionalSardineTest > testPutExpectContinue FAILED
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:65
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:70

com.thegrizzlylabs.sardineandroid.FunctionalSardineTest > testMoveToFolderIncludeBlank FAILED
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:65
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:70

com.thegrizzlylabs.sardineandroid.FunctionalSardineTest > testGetLength FAILED
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:65
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:70

com.thegrizzlylabs.sardineandroid.FunctionalSardineTest > testDelete FAILED
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:65
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:70

com.thegrizzlylabs.sardineandroid.FunctionalSardineTest > testExists FAILED
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:65
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:70

com.thegrizzlylabs.sardineandroid.FunctionalSardineTest > testFileContentType FAILED
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:65
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:70

com.thegrizzlylabs.sardineandroid.FunctionalSardineTest > testCreateDirectory FAILED
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:65
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:70

com.thegrizzlylabs.sardineandroid.FunctionalSardineTest > testGetFileNotFound FAILED
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:65
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:70

com.thegrizzlylabs.sardineandroid.FunctionalSardineTest > testMoveFailOnExisting FAILED
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:65
    com.thegrizzlylabs.sardineandroid.impl.SardineException at FunctionalSardineTest.java:70

com.thegrizzlylabs.sardineandroid.LockTest > lockRefreshUnlock FAILED
    com.thegrizzlylabs.sardineandroid.impl.SardineException at LockTest.java:76

com.thegrizzlylabs.sardineandroid.LockTest > testLockUnlock FAILED
    com.thegrizzlylabs.sardineandroid.impl.SardineException at LockTest.java:45

com.thegrizzlylabs.sardineandroid.ProppatchTest > testRemovePropertyCustomNamespace FAILED
    com.thegrizzlylabs.sardineandroid.impl.SardineException at ProppatchTest.java:167

com.thegrizzlylabs.sardineandroid.ProppatchTest > testAddPropertyCustomNamespace FAILED
    com.thegrizzlylabs.sardineandroid.impl.SardineException at ProppatchTest.java:85

com.thegrizzlylabs.sardineandroid.ProppatchTest > testModifyProtectedProperty FAILED
    com.thegrizzlylabs.sardineandroid.impl.SardineException at ProppatchTest.java:59

com.thegrizzlylabs.sardineandroid.ProppatchTest > testAddCustomComplexProperties FAILED
    com.thegrizzlylabs.sardineandroid.impl.SardineException at ProppatchTest.java:117
kumy commented 1 year ago

Started again, with just your patch in case I missed something, some erros are gone, but some are still present. Here are my tests results as HTML index.html.txt

finiasz commented 1 year ago

I had some issues with some tests too (the issue 997 test I remember). But then I only ran the "AllTests" test and it ran fine.

For sardine, the "test/test" credential they use for the tests don't work on owncloud, so it's normal tests fail...

My two cents : just remove the test step from your workflow by commenting out these lines:

      - name: Run Tests
        run: cd obv_messenger/ && ./gradlew test --stacktrace
kumy commented 1 year ago

My two cents : just remove the test step from your workflow by commenting out these lines:

I was thinking about the same... Will do now. Thanks

kumy commented 1 year ago

Let's see how the build goes... https://github.com/kumy/olvid-android/actions/runs/3348630939

(I forgot to link this issue in the related commit)

kumy commented 1 year ago

As expected my Workflow goes well. Thanks.

I hope you'll have time soon to switch to "the builtin websocket implementation of okHttp" :crossed_fingers:

My own build of v1.13.0 has been published https://github.com/kumy/olvid-android/releases

finiasz commented 1 year ago

Yes, we're already testing okHttp internally and everything seems to work fine. Had to implement a custom ping mechanism as okHttp does not give low level access to ping frames, and still a bit of fine tuning to do on the web client, but otherwise it seems to work very well.