Skip to content

Increased Runtime of ApprovalTests because of 3s network timeout #615

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

Closed
stefanhh0 opened this issue Feb 15, 2025 · 4 comments
Closed

Increased Runtime of ApprovalTests because of 3s network timeout #615

stefanhh0 opened this issue Feb 15, 2025 · 4 comments

Comments

@stefanhh0
Copy link

Hello All,

I've observed the the Approval Tests have a long runtime when using version 24.16.0:

09:12:18,212 [INFO] Running xxx.FreemarkerHtmlApprovalIT
09:12:40,214 [INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 22.00 s -- in  xxx..FreemarkerHtmlApprovalIT

Before that we have used the Tests with 24.14.2, resulting in following runtime:

09:18:28,757 [INFO] Running xxx.FreemarkerHtmlApprovalIT
09:18:30,148 [INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.381 s -- in xxx.FreemarkerHtmlApprovalIT

When I tried running the Tests with: 24.15.0 I got following download error:

Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.Error: java.net.ConnectException: Verbindungsaufbau abgelehnt [in thread "main"]
	at com.spun.util.ObjectUtils.throwAsError(ObjectUtils.java:109)
	at com.spun.util.io.NetUtils.loadWebPage(NetUtils.java:42)
	at org.approvaltests.internal.logs.LoggingUtils.downloadScriptIfMissing(LoggingUtils.java:22)
	at org.approvaltests.internal.logs.ApprovedFileLog.lambda$static$0(ApprovedFileLog.java:13)
	at org.lambda.utils.Once.run(Once.java:17)
	at org.approvaltests.internal.logs.ApprovedFileLog.<clinit>(ApprovedFileLog.java:13)
	at org.approvaltests.approvers.FileApprover.approve(FileApprover.java:51)
	at org.approvaltests.Approvals.verify(Approvals.java:230)
	at org.approvaltests.Approvals.verify(Approvals.java:188)
	at org.approvaltests.Approvals.verify(Approvals.java:196)
	at org.approvaltests.Approvals.verify(Approvals.java:55)
	at org.approvaltests.Approvals.verify(Approvals.java:51)
	at xxx.FreemarkerHtmlApprovalIT.shouldHaveSubcontractorsAsList(FreemarkerHtmlApprovalIT.java:75)
	... 3 more

Running the tests with the latest version (24.16.1) improves the situation: compared to 24.16.0:

09:09:55,060 [INFO] Running xxx.FreemarkerHtmlApprovalIT
09:09:59,194 [INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.112 s -- in xxx.FreemarkerHtmlApprovalIT

Still, the runtime is significantly longer than with 24.14.2. I had a look into LoggingUtils#downloadScriptIfMissing there is now a timeout of 3s. The tests run without proper proxy settings, that is why the download time-outs.

I think it would be good if the scripts could be moved as resources into the jar. Then it could be extracted from the jar using Classpath#getResourceAsStream().

@stefanhh0 stefanhh0 changed the title Invreased Runtime of ApprovalTests because of 3s network timeout Increased Runtime of ApprovalTests because of 3s network timeout Feb 15, 2025
@LarsEckart
Copy link
Contributor

Thanks for the feedback!

@isidore given all the feedback, basically echoing what my concerns where when we added it, I think we should discuss on Monday if there are other ways, like splitting it out into separate jar, or turn it off by default...

@LarsEckart
Copy link
Contributor

hello Stefan,

we're still considering to move this functionality elsewhere, for now, the scripts are changing quite quickly for us and we don't want to compound the issue.

@stefanhh0
Copy link
Author

Hello All,

thanks for providing the fix so quickly. It solved our runtime problems.

Kindest regards,
Stefan

@stefanhh0
Copy link
Author

fixed with commit: 7266c0b

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

2 participants