Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CssHandler test case failure on Windows #223

Open
davewichers opened this issue Aug 22, 2022 · 5 comments
Open

CssHandler test case failure on Windows #223

davewichers opened this issue Aug 22, 2022 · 5 comments
Assignees

Comments

@davewichers
Copy link
Collaborator

davewichers commented Aug 22, 2022

@spassarop - I'm seeing the following - do you have access to a windows box/VM to confirm this failure? And can you then fix it? Hopefully its just a platform specific issue with the test case and not an actual bug. I only get this 1 error on Windows and none on my Mac.

UPDATE: This isn't always repeatable. I reran the test cases and they passed. And then again, and this one failed. It fails 'almost every other time' on Windows, and I'm running: 'mvn test' repeatedly, not 'mvn clean 'test' if that matters. Hopefully you can replicate this and fix it.

[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.owasp.validator.css.CssHandlerTest
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.047 s - in org.owasp.validator.css.CssHandlerTest
[INFO] Running org.owasp.validator.css.CssScannerTest
[ERROR] Tests run: 3, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.359 s <<< FAILURE! - in org.owasp.validator.css.CssScannerTest
[ERROR] org.owasp.validator.css.CssScannerTest.testImportLimiting  Time elapsed: 1.281 s  <<< FAILURE!
java.lang.AssertionError:

Expected: is <2>
     but: was <102>
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:6)
        at org.owasp.validator.css.CssScannerTest.testImportLimiting(CssScannerTest.java:123)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
        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.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:377)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:284)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:248)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:167)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:456)
        at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:169)
        at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:595)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:581)

[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR]   CssScannerTest.testImportLimiting:123
      Expected: is <2>
      but: was <102>
[INFO]
[ERROR] Tests run: 104, Failures: 1, Errors: 0, Skipped: 0
@davewichers davewichers changed the title Test case failure on Windows CssHandler test case failure on Windows Aug 22, 2022
@davewichers davewichers removed their assignment Aug 22, 2022
@davewichers
Copy link
Collaborator Author

It's possible this isn't a Windows specific error. Here's a run on GitHub with this same failure: https://github.com/nahsra/antisamy/actions/runs/3498387502/jobs/5858682120 with: but: was <1>, rather than: but: was <102>. Maybe this is a threading problem?

@kwwall
Copy link
Contributor

kwwall commented Nov 18, 2022

@davewichers - I just ran it 5 times, back-to-back on Linux Mint and had zero failures there. Have you tried it under MacOS? Or on Windows, but under WSL?

@davewichers
Copy link
Collaborator Author

WSL? What is that? I have no failures on my Mac. This error is definitely not repeatable. It just shows up, sometimes ...

@kwwall
Copy link
Contributor

kwwall commented Nov 18, 2022

WSL ==> Windows Subsystem for Linux. It allows you to run a Linux kernel (at least with WSL2) under Windows. When I have to use Windows (which is almost never now! :)) I use it in preference to 'git bash' or Cygwin or whatever.

@spassarop
Copy link
Collaborator

You never know when will that happen, it's more likely on Windows. I think we had some emails were I did my investigation and could not find any way to make the low test timeout to work properly.

Anyway, the thing was I commented the test or marked it as "ignore" but someone told me it was best to leave it like that until the feature is removed. Because that feature is the one that downloads CSS on @import rules. It's a matter of time until it gets deleted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants