Open sgbeal opened 8 years ago
Hi @sgbeal,
Can you please tell us which commit you are using? I have tested the latest commit with my Windows (I am sorry, but I don't have Linux right now). Here is the output:
MINGW64 /c/Work/workspace/git/FakeSMTP (master)
$ mvn install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Fake SMTP 2.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ fakesmtp ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 13 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ fakesmtp ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 45 source files to C:\Work\workspace\git\FakeSMTP\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ fakesmtp ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Work\workspace\git\FakeSMTP\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) @ fakesmtp ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 7 source files to C:\Work\workspace\git\FakeSMTP\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ fakesmtp ---
[INFO] Surefire report directory: C:\Work\workspace\git\FakeSMTP\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.nilhcem.fakesmtp.core.ConfigurationTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.101 sec
Running com.nilhcem.fakesmtp.core.I18nTest
10 ?? 2015 10:41:16 ERROR com.nilhcem.fakesmtp.core.I18n - Can't find resource for bundle java.util.PropertyResourceBundle, key this.key.doesnt.exist
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.269 sec
Running com.nilhcem.fakesmtp.core.server.MailServerTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.028 sec
Running com.nilhcem.fakesmtp.core.server.SMTPServerHandlerTest
10 ?? 2015 10:41:16 INFO org.subethamail.smtp.server.SMTPServer - SMTP server *:9999999 starting
10 ?? 2015 10:41:16 ERROR com.nilhcem.fakesmtp.server.SMTPServerHandler - Port 9999999 out of range.
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.024 sec
Running com.nilhcem.fakesmtp.model.UIModelTest
10 ?? 2015 10:41:16 INFO org.subethamail.smtp.server.SMTPServer - SMTP server *:2626 starting
10 ?? 2015 10:41:16 INFO org.subethamail.smtp.server.ServerThread - SMTP server *:2626 started
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.1 sec
Can you please check whether Maven downloaded all libraries correctly?
mvn package -Dmaven.test.skip
Thanks.
[stephan@host:~/cvs/FakeSMTP]$ git log -1
commit 1b21ad3bfb880bd64e8205f45d05fc9e66265a4e
Author: Gautier Nilhcem <nilhcem@gmail.com>
Date: Sun Aug 30 16:33:46 2015 +0200
Slight review
it builds fine with -Dmaven.test.skip, and i was able to use the generated jar without problems.
My instinct after cloning was to type 'mvn install', which produces the reported error:
Tests in error:
testOutOfRangePort(com.nilhcem.fakesmtp.core.server.SMTPServerHandlerTest): Unexpected exception, expected<com.nilhcem.fakesmtp.core.exception.OutOfRangePortException> but was<java.lang.IllegalStateException>
@sgbeal, I think I know what is happening, but I don't understand why. IllegalStateException is thrown when the server is already started (at least this is what I found: SMTPServer.start source). Integration test expects a different exception that is thrown on my machine. It seems that somehow you have an instance of the SMTP server.
@Nilhcem, do you have any idea?
@Vest - Same issue on my linux environments.
I've done a little bit more exploration around behaviour.
Steps to reproduce
This appears to be consistent on my Jenkins CI environment which I currently have running on the release tag v2.0 as well as my local environment running on master
Another interesting note is that if I run all tests from my IDE then it passes.
I've also confirmed your previous not that the exception is definitely when stated is unexpectedly true in the start method. I did this by remote debugging the tests during the build.
I'm going to explore a little more about what is going on and I'll let you know if I discover anything else.
[stephan@host:~/cvs/FakeSMTP]$ mvn install Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0 [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Building Fake SMTP [INFO] task-segment: [install] [INFO] ------------------------------------------------------------------------
...
Running com.nilhcem.fakesmtp.core.server.SMTPServerHandlerTest 09 Sep 2015 12:50:31 INFO org.subethamail.smtp.server.SMTPServer - SMTP server :9999999 starting 09 Sep 2015 12:50:31 ERROR com.nilhcem.fakesmtp.server.SMTPServerHandler - java.lang.IllegalStateException: SMTPServer can only be started once at org.subethamail.smtp.server.SMTPServer.start(SMTPServer.java:281) ~[subethasmtp-3.1.7.jar:June 16 2012] at com.nilhcem.fakesmtp.server.SMTPServerHandler.startServer(SMTPServerHandler.java:43) ~[classes/:na] at com.nilhcem.fakesmtp.core.server.SMTPServerHandlerTest.testOutOfRangePort(SMTPServerHandlerTest.java:19) [test-classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_45] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_45] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_45] at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_45] at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) [junit-4.12.jar:4.12] at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.12.jar:4.12] at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) [junit-4.12.jar:4.12] at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) [junit-4.12.jar:4.12] at org.junit.internal.runners.statements.ExpectException.evaluate(ExpectException.java:19) [junit-4.12.jar:4.12] at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) [junit-4.12.jar:4.12] at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) [junit-4.12.jar:4.12] at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) [junit-4.12.jar:4.12] at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) [junit-4.12.jar:4.12] at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) [junit-4.12.jar:4.12] at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) [junit-4.12.jar:4.12] at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) [junit-4.12.jar:4.12] at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) [junit-4.12.jar:4.12] at org.junit.runners.ParentRunner.run(ParentRunner.java:363) [junit-4.12.jar:4.12] at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53) [surefire-junit4-2.10.jar:2.10] at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123) [surefire-junit4-2.10.jar:2.10] at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104) [surefire-junit4-2.10.jar:2.10] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_45] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_45] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_45] at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_45] at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164) [surefire-api-2.10.jar:2.10] at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110) [surefire-booter-2.10.jar:2.10] at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175) [surefire-booter-2.10.jar:2.10] at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107) [surefire-booter-2.10.jar:2.10] at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68) [surefire-booter-2.10.jar:2.10] 09 Sep 2015 12:50:31 INFO org.subethamail.smtp.server.SMTPServer - SMTP server :9999999 stopping 09 Sep 2015 12:50:31 INFO org.subethamail.smtp.server.ServerThread - SMTP server *:9999999 stopped Tests run: 3, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.007 sec <<< FAILURE! Running com.nilhcem.fakesmtp.core.server.MailServerTest Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.022 sec
Results :
Tests in error: testOutOfRangePort(com.nilhcem.fakesmtp.core.server.SMTPServerHandlerTest): Unexpected exception, expected but was
[stephan@host:~/cvs/FakeSMTP]$ java -version java version "1.8.0_45" Java(TM) SE Runtime Environment (build 1.8.0_45-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)