Skip to content
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.

Commit

Permalink
Merge pull request #537 from zalando/merge-527
Browse files Browse the repository at this point in the history
Move starter proxy responsibilities into proxy set.
  • Loading branch information
diemol authored May 3, 2018
2 parents 936c0a5 + effa6ee commit 9abf3a2
Show file tree
Hide file tree
Showing 40 changed files with 2,313 additions and 1,418 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- docker pull elgalu/selenium
- travis_retry ./run_integration_tests.sh sauceLabs

- env: step=browserStack_with_user1006
- env: step=browserStack
if: type = pull_request
script:
- docker pull elgalu/selenium
Expand All @@ -26,7 +26,7 @@ jobs:
if: type = pull_request
script:
- docker pull elgalu/selenium
- curl -L https://github.com/docker/compose/releases/download/1.13.0/docker-compose-`uname -s`-`uname -m` > docker-compose
- curl -L https://github.com/docker/compose/releases/download/1.21.0/docker-compose-`uname -s`-`uname -m` > docker-compose
- chmod +x docker-compose
- sudo mv docker-compose /usr/local/bin
- travis_retry ./run_integration_tests.sh dockerCompose
Expand Down
4 changes: 2 additions & 2 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ coverage:
project:
default:
target: auto
threshold: 3%
threshold: 10%
patch:
default:
target: auto
target: 80%
target: 55%
9 changes: 7 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,15 @@ RUN cd /tmp \
# -----------------------#
# https://testingbot.com/support/other/tunnel
ENV TB_TUNNEL_URL="https://testingbot.com/tunnel/testingbot-tunnel.jar"
RUN cd /tmp \
# If you need to disable testingBot at build time set a build arg of testingBotEnabled=false
ARG testingBotEnabled=true
RUN if [ "${testingBotEnabled}" = "true" ]; then \
cd /tmp \
&& wget -nv "${TB_TUNNEL_URL}" \
&& mv testingbot-tunnel.jar /usr/local/bin \
&& java -jar /usr/local/bin/testingbot-tunnel.jar --version
&& java -jar /usr/local/bin/testingbot-tunnel.jar --version; \
else echo "Testing Bot Disabled"; \
fi

#===================================================
# Run the following commands as non-privileged user
Expand Down
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>de.vandermeer</groupId>
<artifactId>asciitable</artifactId>
<version>0.3.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
8 changes: 1 addition & 7 deletions run_integration_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,7 @@ else
if [ "$INTEGRATION_TO_TEST" = browserStack ]; then
if [ -n "${BROWSER_STACK_USER}" ]; then
sudo env "PATH=$PATH" mvn clean
mvn clean package -Pbuild-docker-image -DskipTests=true
mkdir -p "${VIDEOS_FOLDER}"
cd target && docker build -t dosel/zalenium:latest . && cd ..
curl -sSL https://raw.githubusercontent.com/dosel/t/i/p | PULL_DEPENDENCIES=false bash -s stop
curl -sSL https://raw.githubusercontent.com/dosel/t/i/p | SAUCE_USERNAME='' SAUCE_ACCESS_KEY='' TESTINGBOT_KEY='' TESTINGBOT_SECRET='' PULL_DEPENDENCIES=false ADDITIONAL_DOCKER_OPTS='-u 1000060000:1000060000' VIDEOS_DIR=${VIDEOS_FOLDER} bash -s start
docker logs zalenium
mvn verify -Pintegration-test -DthreadCountProperty=2 -Dskip.surefire.tests=true -Dskip.failsafe.setup=true -DintegrationToTest=${INTEGRATION_TO_TEST}
mvn clean verify -Pintegration-test -DthreadCountProperty=2 -Dskip.surefire.tests=true -DintegrationToTest=${INTEGRATION_TO_TEST}
# Check for generated videos
ls -la ${VIDEOS_FOLDER}/browserstack*.mp4 || (echo "No BrowserStack videos were downloaded." && exit 2)
ls -la ${VIDEOS_FOLDER}/zalenium*.mp4 || (echo "No Zalenium videos were generated." && exit 2)
Expand Down
24 changes: 1 addition & 23 deletions scripts/zalenium.sh
Original file line number Diff line number Diff line change
Expand Up @@ -446,28 +446,6 @@ StartUp()
fi
echo "Selenium Hub started!"

echo "Starting DockerSeleniumStarter node..."

java -Dlogback.loglevel=${DEBUG_MODE} -Dlogback.appender=${LOGBACK_APPENDER} \
-Djava.util.logging.config.file=logging_${DEBUG_MODE}.properties \
-Dlogback.configurationFile=${LOGBACK_PATH} \
-cp ${ZALENIUM_ARTIFACT} org.openqa.grid.selenium.GridLauncherV3 -role node -hub http://localhost:4444/grid/register \
-registerCycle 0 -proxy de.zalando.ep.zalenium.proxy.DockerSeleniumStarterRemoteProxy \
-nodePolling 90000 -port 30000 ${DEBUG_FLAG} &
echo $! > ${PID_PATH_DOCKER_SELENIUM_NODE}

if ! timeout --foreground "${OVERRIDE_WAIT_TIME:-30s}" bash -c WaitStarterProxy; then
echo "StarterRemoteProxy failed to start after ${OVERRIDE_WAIT_TIME:-30s} seconds, failing..."
curl "http://localhost:30000/wd/hub/status"
exit 12
fi

if ! timeout --foreground "${OVERRIDE_WAIT_TIME:-30s}" bash -c WaitStarterProxyToRegister; then
echo "StarterRemoteProxy failed to register to the hub after ${OVERRIDE_WAIT_TIME:-30s} seconds, failing..."
exit 13
fi
echo "DockerSeleniumStarter node started!"

if ! curl -sSL "http://localhost:4444" | grep Grid >/dev/null; then
echo "Error: The Grid is not listening at port 4444"
exit 7
Expand Down Expand Up @@ -892,4 +870,4 @@ case ${SCRIPT_ACTION} in
*)
usage
;;
esac
esac
14 changes: 8 additions & 6 deletions scripts/zalenium_in_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ export -f WaitZaleniumStarted

StartUp()
{
HOST_OPTIONS=""
if [ "$(uname -s)" != 'Darwin' ]; then
HOST_OPTIONS="-e HOST_UID=\"$(id -u)\" -e HOST_GID=\"$(id -g)\""
fi

DOCKER_SELENIUM_IMAGE_COUNT=$(docker images | grep "elgalu/selenium" | wc -l)
if [ ${DOCKER_SELENIUM_IMAGE_COUNT} -eq 0 ]; then
echo "Seems that docker-selenium's image has not been downloaded yet, please run 'docker pull elgalu/selenium' first"
Expand Down Expand Up @@ -58,8 +63,7 @@ StartUp()
fi

docker run -d -ti --name zalenium -p 4444:4444 \
-e HOST_UID="$(id -u)" \
-e HOST_GID="$(id -g)" \
${HOST_OPTIONS} \
-e SAUCE_USERNAME -e SAUCE_ACCESS_KEY \
-v ${VIDEOS_FOLDER}:/home/seluser/videos \
-v /var/run/docker.sock:/var/run/docker.sock \
Expand All @@ -82,8 +86,7 @@ StartUp()
fi

docker run -d -ti --name zalenium -p 4444:4444 \
-e HOST_UID="$(id -u)" \
-e HOST_GID="$(id -g)" \
${HOST_OPTIONS} \
-e BROWSER_STACK_USER -e BROWSER_STACK_KEY \
-v ${VIDEOS_FOLDER}:/home/seluser/videos \
-v /var/run/docker.sock:/var/run/docker.sock \
Expand All @@ -106,8 +109,7 @@ StartUp()
fi

docker run -d -ti --name zalenium -p 4444:4444 \
-e HOST_UID="$(id -u)" \
-e HOST_GID="$(id -g)" \
${HOST_OPTIONS} \
-e TESTINGBOT_KEY -e TESTINGBOT_SECRET \
-v ${VIDEOS_FOLDER}:/home/seluser/videos \
-v /var/run/docker.sock:/var/run/docker.sock \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@ public interface ContainerClient {
void initialiseContainerEnvironment();

String getContainerIp(String containerName);

boolean isReady(ContainerCreationStatus container);

boolean isTerminated(ContainerCreationStatus container);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@ public class ContainerCreationStatus {

private String containerName;

private String containerId;

private String nodePort;

public ContainerCreationStatus(boolean isCreated) {
super();
this.isCreated = isCreated;
}

public ContainerCreationStatus(boolean isCreated, String containerName, String nodePort) {
public ContainerCreationStatus(boolean isCreated, String containerName, String containerId, String nodePort) {
super();
this.isCreated = isCreated;
this.containerName = containerName;
this.containerId = containerId;
this.nodePort = nodePort;
}

Expand All @@ -28,13 +31,18 @@ public String getContainerName() {
return containerName;
}

public String getContainerId() {
return containerId;
}

public String getNodePort() {
return nodePort;
}

@Override
public String toString() {
return "ContainerCreationStatus [isCreated=" + isCreated + ", containerName=" + containerName + ", nodePort="
+ nodePort + "]";
}
@Override
public String toString() {
return "ContainerCreationStatus [isCreated=" + isCreated + ", containerName=" + containerName + ", containerId="
+ containerId + ", nodePort=" + nodePort + "]";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ private static KubernetesContainerClient createKubernetesContainerClient() {
kubernetesContainerClient = new KubernetesContainerClient(new Environment(),
KubernetesContainerClient::createDoneablePodDefaultImpl,
new DefaultKubernetesClient());
kubernetesContainerClient.initialiseContainerEnvironment();
}
}
}
Expand Down
Loading

0 comments on commit 9abf3a2

Please sign in to comment.