Skip to content
This repository was archived by the owner on Jun 30, 2021. It is now read-only.

Commit 78fcb92

Browse files
committed
Makefile OSX fixes & discourage wmctrl
1 parent ab0ea51 commit 78fcb92

26 files changed

+166
-41
lines changed

.env

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export VNC_FROM_PORT ?= 40650
2727
export VNC_TO_PORT ?= 40700
2828

2929
# Timeouts
30-
export WAIT_ALL_DONE ?= 40s
30+
export WAIT_ALL_DONE ?= 80s
3131

3232
# Number of nodes
3333
export chrome ?= 1
@@ -50,6 +50,9 @@ export COMPOSE_PROJ_NAME ?= ${PROJ_NAME}
5050
# VNC viewer relative size, vncviewer -Scaling
5151
export SIZE ?= 40%
5252

53+
# Enable video recording
54+
export VIDEO ?= true
55+
5356
# App name is the service name for the web app under test
5457
export APP ?= mock
5558
export APP_NAME ?= ${APP}

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,30 @@ Note image ids also change after scm-source.json has being updated which trigger
77
###### To get container versions
88
docker exec grid versions
99

10+
## TBD_DOCKER_TAG
11+
+ Date: TBD_DATE
12+
+ Bugs: Makefile OSX fixes & discourage wmctrl
13+
+ Image tag details:
14+
+ Selenium: vTBD_SELENIUM_VERSION (TBD_SELENIUM_REVISION)
15+
+ Chrome stable: TBD_CHROME_STABLE
16+
+ Firefox stable: TBD_FIREFOX_STABLE
17+
+ Chromedriver: TBD_CHROME_DRIVER (TBD_CHROMEDRIVER_COMMIT)
18+
+ Java: TBD_JAVA_VENDOR Java TBD_JAVA_BUILD
19+
+ Timezone: TBD_TIME_ZONE
20+
+ FROM ubuntu:UBUNTU_FLAVOR-UBUNTU_DATE
21+
+ Python: TBD_PYTHON_VERSION
22+
+ Sauce Connect TBD_SAUCE_CONNECT_VERS, build TBD_SAUCE_CONNECT_BUILD TBD_SAUCE_CONNECT_REVISION
23+
+ BrowserStack Local version TBD_BROWSER_STACK_VERSION
24+
+ Tested on kernel dev host: 4.4.0-31-generic x86_64
25+
+ Tested on kernel CI host: TBD_HOST_UNAME
26+
+ Built at dev host with: Docker version 1.12.0-rc4, build e4a0dbc
27+
+ Built at CI host with: Docker version TBD_DOCKER_VERS, build TBD_DOCKER_BUILD
28+
+ Built at dev host with: Docker Compose version 1.8.0-rc2, build c72c966
29+
+ Built at CI host with: Docker Compose version TBD_DOCKER_COMPOSE_VERS, build TBD_DOCKER_COMPOSE_BUILD
30+
+ Image size: TBD_IMAGE_SIZE
31+
+ Digest: TBD_DIGEST
32+
+ Image ID: TBD_IMAGE_ID
33+
1034
## 2.53.1l
1135
+ Date: 2016-07-17
1236
+ OSX Makefile fixes

CONTRIBUTING.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ For pull requests or local commits:
88
open ./images/grid_console.png #to verify the versions are correct
99
git checkout ./images/grid_console.png && open ./videos/chrome/*.mkv
1010
travis lint #if you changed .travis.yml
11-
git checkout -b tmp-2.53.1l #name your branch according to your changes
11+
git checkout -b tmp-2.53.1m #name your branch according to your changes
1212
#git add ... git commit ... git push ... open pull request
1313

1414
For repository owners only:
1515

16-
git commit -m "Easily gather video artifacts with `make videos`"
16+
git commit -m "Makefile OSX fixes & discourage wmctrl"
1717
git tag -d latest #tag latest will be updated from TravisCI
18-
git tag 2.53.1l && git push origin tmp-2.53.1l && git push --tags
18+
git tag 2.53.1m && git push origin tmp-2.53.1m && git push --tags
1919

2020
-- Wait for Travis to pass OK
2121
-- Make sure changes got merged into master by elgalubot
2222

23-
git checkout master && git pull && git branch -d tmp-2.53.1l && git push origin --delete tmp-2.53.1l
23+
git checkout master && git pull && git branch -d tmp-2.53.1m && git push origin --delete tmp-2.53.1m
2424

2525
-- Re-add TBD_* section in CHANGELOG.md starting with TBD_DOCKER_TAG
2626
-- If Chrome version changed upload:
@@ -36,9 +36,9 @@ Keep certain bins if chrome version changed for example:
3636
## Retry
3737
Failed in Travis? retry
3838

39-
git tag -d 2.53.1l && git push origin :2.53.1l
39+
git tag -d 2.53.1m && git push origin :2.53.1m
4040
#git add ...
41-
git commit --amend && git tag 2.53.1l && git push --force origin tmp-2.53.1l && git push --tags
41+
git commit --amend && git tag 2.53.1m && git push --force origin tmp-2.53.1m && git push --tags
4242

4343
## Docker push from Travis CI
4444
Travis [steps](https://docs.travis-ci.com/user/docker/#Pushing-a-Docker-Image-to-a-Registry) involve `docker login` and docker credentials encryptions.

Makefile

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ warn_wmctrl:
128128
fi
129129

130130
check_wmctrl:
131+
@if [ $(shell uname -s) = 'Darwin' ]; then \
132+
echo "Sorry: moving windows with wmctrl in OSX is not upported." 1>&2 ; \
133+
exit 11 ; \
134+
fi
131135
@if ! eval ${WMCTRL_CHECK_CMD}; then \
132136
${ECHOERR} ${WMCTRL_CLIENT_ERROR_MSG} ; \
133137
exit 5; \
@@ -159,11 +163,27 @@ cleanup:
159163
--remove-orphans >./mk/compose_down.log 2>&1
160164
@echo "Done!"
161165

162-
# like cleanup but verbose
166+
# like cleanup but verbose plus graceful stop-video
163167
down:
168+
@if [ "${VIDEO}" = "true" ]; then \
169+
$(MAKE) stop_videos_chrome ; \
170+
$(MAKE) stop_videos_firefox ; \
171+
fi
164172
docker-compose -f ${COMPOSE_FILE} -p ${COMPOSE_PROJ_NAME} down \
165173
--remove-orphans
166174

175+
stop_videos:
176+
@for node in $(shell seq --separator ' ' 1 ${tot_nodes}); do \
177+
docker exec "${proj}_${browser}_$$node" stop-video \
178+
>./mk/stop_video_${browser}_$$node.log || true ; \
179+
done
180+
181+
stop_videos_chrome:
182+
@$(MAKE) stop_videos browser=chrome tot_nodes=${chrome}
183+
184+
stop_videos_firefox:
185+
@$(MAKE) stop_videos browser=firefox tot_nodes=${firefox}
186+
167187
scale:
168188
docker-compose -f ${COMPOSE_FILE} -p ${COMPOSE_PROJ_NAME} scale \
169189
${APP_NAME}=1 hub=1 chrome=${chrome} firefox=${firefox}
@@ -251,5 +271,8 @@ test:
251271
gather_videos \
252272
gather_videos_chrome \
253273
gather_videos_firefox \
274+
stop_videos \
275+
stop_videos_chrome \
276+
stop_videos_firefox \
254277
env \
255278
test

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ This image is designed to run one test on each docker container but if you still
102102

103103
1. The recommended way is via [docker-compose](./docs/docker-compose.md) and you should replace `mock` with your web service under test within the [docker-compose.yml][] file.
104104

105-
export SELENIUM_HUB_PORT=4444 VNC_FROM_PORT=40650 VNC_TO_PORT=40700
105+
export SELENIUM_HUB_PORT=4444 VNC_FROM_PORT=40650 VNC_TO_PORT=40700 VIDEO=false
106106
docker-compose -p grid scale mock=1 hub=1 chrome=3 firefox=3
107107

108108
1. The _(not recommended)_ way is by increasing `MAX_INSTANCES` and `MAX_SESSIONS` which now [defaults](https://github.com/elgalu/docker-selenium/blob/2.53.1a/Dockerfile#L967) to 1.

bin/entry.sh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ echo "-- INFO: Available Firefox Versions: ${FIREFOX_VERSION}"
1313
# Fix/extend ENV vars
1414
#---------------------
1515
# export PATH="${PATH}:${BIN_UTILS}"
16-
export VIDEO_LOG_FILE="${LOGS_DIR}/video-rec-stdout.log"
17-
export VIDEO_PIDFILE="${RUN_DIR}/video.pid"
1816
export SAUCE_LOG_FILE="${LOGS_DIR}/saucelabs-stdout.log"
1917
export BSTACK_LOG_FILE="${LOGS_DIR}/browserstack-stdout.log"
2018
export SUPERVISOR_PIDFILE="${RUN_DIR}/supervisord.pid"
@@ -44,11 +42,12 @@ fi
4442

4543
#----------------------------------------------------------
4644
# Extend required services depending on what the user needs
47-
if [ "${VIDEO}" = "true" ]; then
48-
export SUPERVISOR_REQUIRED_SRV_LIST="${SUPERVISOR_REQUIRED_SRV_LIST}|video-rec"
49-
else
50-
export SUPERVISOR_NOT_REQUIRED_SRV_LIST1="video-rec"
51-
fi
45+
export SUPERVISOR_NOT_REQUIRED_SRV_LIST1="video-rec"
46+
# if [ "${VIDEO}" = "true" ]; then
47+
# export SUPERVISOR_REQUIRED_SRV_LIST="${SUPERVISOR_REQUIRED_SRV_LIST}|video-rec"
48+
# else
49+
# export SUPERVISOR_NOT_REQUIRED_SRV_LIST1="video-rec"
50+
# fi
5251

5352
sudo sh -c "echo 'X11Forwarding ${SSHD_X11FORWARDING}' >> /etc/ssh/sshd_config"
5453
sudo sh -c "echo 'GatewayPorts ${SSHD_GATEWAYPORTS}' >> /etc/ssh/sshd_config"
@@ -118,13 +117,18 @@ elif [ "${PICK_ALL_RANDMON_PORTS}" = "true" ]; then
118117
fi
119118

120119
# Video
120+
export VIDEO_LOG_FILE="${LOGS_DIR}/video-rec-stdout.log"
121+
export VIDEO_PIDFILE="${RUN_DIR}/video.pid"
121122
if [ "${VIDEO_FILE_NAME}" = "" ]; then
122123
export VIDEO_FILE_NAME="vid"
123124
[ "${CHROME}" = "true" ] && export VIDEO_FILE_NAME="${VIDEO_FILE_NAME}_chrome_${SELENIUM_NODE_CH_PORT}"
124125
[ "${FIREFOX}" = "true" ] && export VIDEO_FILE_NAME="${VIDEO_FILE_NAME}_firefox_${SELENIUM_NODE_FF_PORT}"
125126
fi
126127
export VIDEO_PATH="${VIDEOS_DIR}/${VIDEO_FILE_NAME}.${VIDEO_FILE_EXTENSION}"
127-
128+
echo "${VIDEO_LOG_FILE}" > VIDEO_LOG_FILE
129+
echo "${VIDEO_PIDFILE}" > VIDEO_PIDFILE
130+
echo "${VIDEO_FILE_NAME}" > VIDEO_FILE_NAME
131+
echo "${VIDEO_PATH}" > VIDEO_PATH
128132

129133
if [ "${VNC_START}" = "true" ]; then
130134
# TODO: Re enable shutdown at some point. But fails when

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ services:
2727
- VNC_FROM_PORT
2828
- VNC_TO_PORT
2929
- PICK_ALL_RANDMON_PORTS=true
30-
- VIDEO=true
30+
- VIDEO
3131
- GRID=false
3232
- CHROME=true
3333
- FIREFOX=false
@@ -40,7 +40,7 @@ services:
4040
- VNC_FROM_PORT
4141
- VNC_TO_PORT
4242
- PICK_ALL_RANDMON_PORTS=true
43-
- VIDEO=true
43+
- VIDEO
4444
- GRID=false
4545
- CHROME=false
4646
- FIREFOX=true

docs/docker-compose.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Either clone this repository or download the file [docker-compose.yml][] using `
1515
Start it with `docker-compose up` then **scale** it:
1616
You should replace `mock` with your web service under test within the [docker-compose.yml][] file.
1717

18-
export SELENIUM_HUB_PORT=4444 NODES=3 VNC_FROM_PORT=40650 VNC_TO_PORT=40700
18+
export SELENIUM_HUB_PORT=4444 NODES=3 VNC_FROM_PORT=40650 VNC_TO_PORT=40700 VIDEO=false
1919
docker-compose -p grid up -d
2020
docker-compose -p grid scale chrome=${NODES} firefox=${NODES}
2121

docs/make.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ If you want VNC helpers support _(optional)_
1010

1111
make install_vnc
1212

13-
If you also want windows manager support, i.e. want to `make move` _(optional but not recommended in OSX)_
13+
### OSX
14+
In OSX is convenient to increase the Docker service CPUs and Memory specially if you plan to run more than one Chrome and Firefox at the same time:
1415

15-
make install_wmctrl
16+
<img id="cpu" width="260" src="../images/Docker_Mac_CPUs_Memory.png" />
1617

1718
## Usage
1819
Make sure to [setup](#setup) first.

images/Docker_Mac_CPUs_Memory.png

109 KB
Loading

0 commit comments

Comments
 (0)