Buildship Development - Failing Unit Tests In Master

Hi there, I’m looking at working on an issue in the GitHub tracker for Buildship. I’ve followed the setup guide, and noticed that with my current setup/target, some unit tests (but no UI tests) are failing in the master branch. Is this an acceptable state for master or these tests to be in, or is this something to do with my environment? And as a contributor wanting to work on a completely unrelated issue, am I expected to do something about these failing tests?

My environment is:
Windows 10 Pro 64 bit
Oracle Java 9.0.4+11
Eclipse 2019-06 (4.12.0, build id 20190614-1200)
Target is Eclipse Oxygen

The failing unit tests are:

1. org.eclipse.buildship.core.internal.workspace.GradleClasspathContainerUpdaterTest."Folders are valid external dependencies"
2. org.eclipse.buildship.core.internal.workspace.LinkedResourcesUpdaterTest."Can define a linked resource"
3. "                                                                      "."Can define a linked resource even if the resource does not exist"
4. "                                                                      "."A linked resource is deleted if no longer part of the Gradle model"
5. org.eclipse.buildship.core.internal.configuration.RunConfigurationTest."load default settings"
6. org.eclipse.buildship.core.internal.util.string.PatternUtilsTest."Matching web urls"
7. ??? The JUnit plugin runner says 7 are failing, but I only find 6 failed tests.

All but the "Matching web urls" are to do with file paths, and of those, all but one are because the expected paths abbreviate my user directory with a ~1, and assume my surname, which is placed after a ., is a file extension, and shortens it to three letters.

No, the expectation is that all tests should succeed from the IDE. One thing to mention is that the tests should not be executed on the UI thread, but that’s all.

My guess is that this is an error in the test fixtures that only surfaced on your side. Can you post one stacktrace with the test failure?

Ah, I saw that was the case for UI tests, but didn’t realise it applied to the core unit tests as well. I re-ran them not executing on the UI thread, but got the same results.

Here’s a stack trace example for the pathing errors (changed my username to firstnam.lastname to obscure, but use same number of chars and same formatting):

Condition not satisfied:

resolvedClasspath[0].path.toFile() == dir("foo")
|                |   |    |        |  |
|                |   |    |        |  C:\Users\FIRSTN~1.LAS\AppData\Local\Temp\junit339468326223232060\external\foo
|                |   |    |        false
|                |   |    C:\Users\firstnam.lastname\AppData\Local\Temp\junit339468326223232060\external\foo
|                |   C:/Users/firstnam.lastname/AppData/Local/Temp/junit339468326223232060/external/foo
|                C:/Users/firstnam.lastname/AppData/Local/Temp/junit339468326223232060/external/foo[CPE_LIBRARY][K_BINARY][isExported:false]

	at org.eclipse.buildship.core.internal.workspace.GradleClasspathContainerUpdaterTest.Folders are valid external dependencies(GradleClasspathContainerUpdaterTest.groovy:65)

Other pathing error, unlike the first 4:

Condition not satisfied:

runConfig.projectConfiguration.buildConfiguration.rootProjectDirectory.path == new File('').canonicalPath
|         |                    |                  |                    |    |  |            |
|         |                    |                  |                    |    |  |            C:\Users\firstnam.lastname\buildship\git\buildship\org.eclipse.buildship.core.test
|         |                    |                  |                    |    |
|         |                    |                  |                    |    false
|         |                    |                  |                    |    5 differences (93% similarity)
|         |                    |                  |                    |    C:\\Users\\firstnam.lastname\\buildship\\git\\buildship\\org.eclipse.buildship.core(-----)
|         |                    |                  |                    |    C:\\Users\\firstnam.lastname\\buildship\\git\\buildship\\org.eclipse.buildship.core(.test)
|         |                    |                  |                    C:\Users\firstnam.lastname\buildship\git\buildship\org.eclipse.buildship.core
|         |                    |                  C:\Users\firstnam.lastname\buildship\git\buildship\org.eclipse.buildship.core
|         |                    org.eclipse.buildship.core.internal.configuration.DefaultBuildConfiguration@6a7bfb7b
|         org.eclipse.buildship.core.internal.configuration.DefaultProjectConfiguration@277b31e9

	at org.eclipse.buildship.core.internal.configuration.RunConfigurationTest.load default settings(RunConfigurationTest.groovy:107)

Matching web urls stack trace:

Condition not satisfied:

|       |
|       false
java.util.regex.Matcher[pattern=(((?:(?i:http|https):\/\/(?:(?:[a-zA-Z0-9\$\-\_\.\+\!\*\'\(\)\,\;\?\&\=]|(?:\%[a-fA-F0-9]{2})){1,64}(?:\:(?:[a-zA-Z0-9\$\-\_\.\+\!\*\'\(\)\,\;\?\&\=]|(?:\%[a-fA-F0-9]{2})){1,25})?\@)?)(?:(([a-zA-Z0-9[ -퟿豈-﷏ﷰ-￯𐀀-🿽𠀀-𯿽𰀀-𿿽񀀀-񏿽񐀀-񟿽񠀀-񯿽񰀀-񿿽򀀀-򏿽򐀀-򟿽򠀀-򯿽򰀀-򿿽󀀀-󏿽󐀀-󟿽󡀀-󯿽&&[^ [ - ]    ]]](?:[a-zA-Z0-9[ -퟿豈-﷏ﷰ-￯𐀀-🿽𠀀-𯿽𰀀-𿿽񀀀-񏿽񐀀-񟿽񠀀-񯿽񰀀-񿿽򀀀-򏿽򐀀-򟿽򠀀-򯿽򰀀-򿿽󀀀-󏿽󐀀-󟿽󡀀-󯿽&&[^ [ - ]    ]]\-]{0,61}[a-zA-Z0-9[ -퟿豈-﷏ﷰ-￯𐀀-🿽𠀀-𯿽𰀀-𿿽񀀀-񏿽񐀀-񟿽񠀀-񯿽񰀀-񿿽򀀀-򏿽򐀀-򟿽򠀀-򯿽򰀀-򿿽󀀀-󏿽󐀀-󟿽󡀀-󯿽&&[^ [ - ]    ]]]){0,1}\.)+(xn\-\-[\w\-]{0,58}\w|[a-zA-Z[ -퟿豈-﷏ﷰ-￯𐀀-🿽𠀀-𯿽𰀀-𿿽񀀀-񏿽񐀀-񟿽񠀀-񯿽񰀀-񿿽򀀀-򏿽򐀀-򟿽򠀀-򯿽򰀀-򿿽󀀀-󏿽󐀀-󟿽󡀀-󯿽&&[^ [ - ]    ]]]{2,63})|((25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[0-9]))))(?:\:\d{1,5})?)(\/(?:(?:[a-zA-Z0-9[ -퟿豈-﷏ﷰ-￯𐀀-🿽𠀀-𯿽𰀀-𿿽񀀀-񏿽񐀀-񟿽񠀀-񯿽񰀀-񿿽򀀀-򏿽򐀀-򟿽򠀀-򯿽򰀀-򿿽󀀀-󏿽󐀀-󟿽󡀀-󯿽&&[^ [ - ]    ]]\;\/\?\:\@\&\=\#\~\-\.\+\!\*\'\(\)\,\_])|(?:\%[a-fA-F0-9]{2}))*)?(?:\b|$|^)/?) region=0,20 lastmatch=]

	at org.eclipse.buildship.core.internal.util.string.PatternUtilsTest.Matching web urls(PatternUtilsTest.groovy:14)

Just a small heads-up: I’ll be on vacation for the rest of the week, so I might be able to investigate further on Monday.

Re: Matching web urls: Out of curiosity, what encoding is set in your Eclipse workspace? Maybe it doesn’t match with the test file’s encoding.

Well, enjoy your vacation then. :slight_smile:

As for the encoding, your hunch was correct. I changed it from the default, cp1252, to utf-8 and now the Matching web urls test passes.

I’ve found out what’s wrong with RunConfigurationTest. It accidentally reads the configuration from the org.eclipse.buildship.core.test. I’ll push the fix soon. Regarding the other ones, could you please try changing the dir("foo") statements to use canonical paths: dir("foo").canonicalPath.

Cool, that did it! Just changed the failing assertions to compare canonical paths instead of the File objects, and they pass now. :slight_smile:

Could you please create a pull request with the changes?