Cargo start-server timeout avec Linux
Bonjour, je dois réaliser quelques tests selenium sur l’application finale
L’application contient notamment, un web server (tomcat 7), un moteur osgi (karaf). Ces 2 applications, doivent tourner ensembles, pour pouvoir effectuer mes tests finaux.
Pour réaliser les tests, j’ai créé un projet spécial qui:
- Extrait l’application finale dans “target” (fichier zip)
- Lance karaf (antrun)
- Créé un conteneur CARGO en local
- Lance les tests selenium
Le build et les tests fonctionnent très bien sous Windows.
Sous Linux (Ubuntu 11.10), le build reste bloqué à selenium:start-server, pour finalement me donner une erreur de timeout.
Voici mon pom.xml:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
| <plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>prepare-for-test</id>
<phase>generate-resources</phase>
<configuration>
<target>
<exec dir="${project.build.directory}/CARGO/Karaf/bin" executable="xterm" spawn="true" os="Linux">
<arg value="-e"/>
<arg value="sh"/>
<arg value="-c"/>
<arg value="${project.build.directory}/CARGO/Karaf/bin/Karaf"/>
</exec>
<exec dir="${project.build.directory}/CARGO/Karaf/bin" executable="cmd" spawn="true" os="Windows">
<arg value="/c"/>
<arg value="${project.build.directory}/CARGO/Karaf/bin/Karaf.bat"/>
</exec>
<echo message="Starting Karaf monitoring, Wait 2 min ..."/>
<sleep seconds="120" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<id>kill-karaf</id>
<phase>post-integration-test</phase>
<configuration>
<target >
<exec dir="${project.build.directory}/CARGO/Karaf/bin" executable="xterm" spawn="true" os="Linux">
<arg value="-e"/>
<arg value="sh"/>
<arg value="-c"/>
<arg value="${project.build.directory}/CARGO/Karaf/bin/Karaf"/>
<arg value="stop"/>
</exec>
<exec dir="${project.build.directory}/CARGO/Karaf/bin" executable="cmd" spawn="true" os="Windows">
<arg value="/c"/>
<arg value="${project.build.directory}/CARGO/Karaf/bin/Karaf.bat"/>
<arg value="stop"/>
</exec>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
<wait>false</wait>
<container>
<containerId>tomcat7x</containerId>
<home>${project.build.directory}/CARGO/Tomcat7</home>
<timeout>1800000</timeout>
<output> ${project.build.directory}/tomcat7x/container.log</output>
<append>false</append>
<log> ${project.build.directory}/tomcat7x/cargo.log</log>
</container>
<configuration>
<type>existing</type>
<home>${project.build.directory}/CARGO/Tomcat7</home>
<properties>
<cargo.java.home>${project.build.directory}/CARGO/java</cargo.java.home>
<cargo.jvmargs>-Xmx512M -XX:MaxPermSize=512m</cargo.jvmargs>
</properties>
</configuration>
</configuration>
<executions>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>selenium-maven-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<id>server</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start-server</goal>
</goals>
<configuration>
<background>true</background>
<singleWindow>true</singleWindow>
<logOutput>true</logOutput>
<ensureCleanSession>true</ensureCleanSession>
<trustAllSSLCertificates>true</trustAllSSLCertificates>
</configuration>
</execution>
<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop-server</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/company/**</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>run-it</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<systemPropertyVariables>
<rootTesting>${project.build.directory}/CARGO</rootTesting>
</systemPropertyVariables>
<excludes>
<exclude>*</exclude>
</excludes>
<includes>
<include>**/company/**/Test.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin> |
Voici ce que je me suis résous à faire temporairement pour remplacer cargo (dans le plugin antrun):
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| <chmod file="${project.build.directory}/CARGO/Tomcat7/bin/catalina.sh" perm="755" />
<chmod file="${project.build.directory}/CARGO/Tomcat7/bin/configtest.sh" perm="755" />
<chmod file="${project.build.directory}/CARGO/Tomcat7/bin/digest.sh" perm="755" />
<chmod file="${project.build.directory}/CARGO/Tomcat7/bin/setclasspath.sh" perm="755" />
<chmod file="${project.build.directory}/CARGO/Tomcat7/bin/shutdown.sh" perm="755" />
<chmod file="${project.build.directory}/CARGO/Tomcat7/bin/startup.sh" perm="755" />
<chmod file="${project.build.directory}/CARGO/Tomcat7/bin/tool-wrapper.sh" perm="755" />
<chmod file="${project.build.directory}/CARGO/Tomcat7/bin/version.sh" perm="755" />
<exec dir="${project.build.directory}/CARGO/Tomcat7/bin" executable="/bin/sh" spawn="true" os="Linux">
<arg value="${project.build.directory}/CARGO/Tomcat7/bin/startup.sh"/>
</exec>
<exec dir="${project.build.directory}/CARGO/Tomcat7/bin" executable="cmd" spawn="true" os="Windows">
<arg value="/c"/>
<arg value="${project.build.directory}/CARGO/Karaf/bin/startup.bat"/>
</exec>
<echo message="Starting Tomcat Web Server, Waiting 10 min ..."/>
<sleep seconds="600" /> |
Bien évidemment, je préfère utiliser cargo, qui me permet d’attendre la fin du déploiement de Tomcat, mais aussi d’effectuer un shudown de Tomcat même en cas d’échec du test.
Je ne pense pas que ce problème soit dû à des paramétrages de permissions d’exécution sous Linux, puisque j’ai essayé en faisant un "chmod –R 777".
Environnement :
OS : Ubuntu 11.10 / Kernel Linux 3.0.0-12-generic
Apache Maven version 3.0.3
cargo-maven2-plugin version 1.1.4
Apache Tomcat version 7.0.23