Skip to content

Commit f992a8d

Browse files
committed
test for standalone images
1 parent 63ba195 commit f992a8d

File tree

4 files changed

+40
-2
lines changed

4 files changed

+40
-2
lines changed

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ generate_standalone_firefox:
2727
cd ./Standalone && ./generate.sh StandaloneFirefox node-firefox Firefox $(VERSION)
2828

2929
standalone_firefox: generate_standalone_firefox firefox
30-
cd ./StandaloneFirefox && docker build -t $(NAME)/standalone-firefox:$(VERSION) .
30+
cd ./StandaloneFirefox && docker build -t $(NAME)/standalone-firefox:$(VERSION) .
3131

3232
generate_standalone_chrome:
3333
cd ./Standalone && ./generate.sh StandaloneChrome node-chrome Chrome $(VERSION)
@@ -53,22 +53,29 @@ tag_latest:
5353
docker tag $(NAME)/node-base:$(VERSION) $(NAME)/node-base:latest
5454
docker tag $(NAME)/node-chrome:$(VERSION) $(NAME)/node-chrome:latest
5555
docker tag $(NAME)/node-firefox:$(VERSION) $(NAME)/node-firefox:latest
56+
docker tag $(NAME)/standalone-chrome:$(VERSION) $(NAME)/standalone-chrome:latest
57+
docker tag $(NAME)/standalone-firefox:$(VERSION) $(NAME)/standalone-firefox:latest
5658

5759
release: tag_latest
5860
@if ! docker images $(NAME)/base | awk '{ print $$2 }' | grep -q -F $(VERSION); then echo "$(NAME)/base version $(VERSION) is not yet built. Please run 'make build'"; false; fi
5961
@if ! docker images $(NAME)/hub | awk '{ print $$2 }' | grep -q -F $(VERSION); then echo "$(NAME)/hub version $(VERSION) is not yet built. Please run 'make build'"; false; fi
6062
@if ! docker images $(NAME)/node-base | awk '{ print $$2 }' | grep -q -F $(VERSION); then echo "$(NAME)/node-base version $(VERSION) is not yet built. Please run 'make build'"; false; fi
6163
@if ! docker images $(NAME)/node-chrome | awk '{ print $$2 }' | grep -q -F $(VERSION); then echo "$(NAME)/node-chrome version $(VERSION) is not yet built. Please run 'make build'"; false; fi
6264
@if ! docker images $(NAME)/node-firefox | awk '{ print $$2 }' | grep -q -F $(VERSION); then echo "$(NAME)/node-firefox version $(VERSION) is not yet built. Please run 'make build'"; false; fi
65+
@if ! docker images $(NAME)/standalone-chrome | awk '{ print $$2 }' | grep -q -F $(VERSION); then echo "$(NAME)/standalone-chrome version $(VERSION) is not yet built. Please run 'make build'"; false; fi
66+
@if ! docker images $(NAME)/standalone-firefox | awk '{ print $$2 }' | grep -q -F $(VERSION); then echo "$(NAME)/standalone-firefox version $(VERSION) is not yet built. Please run 'make build'"; false; fi
6367
docker push $(NAME)/base
6468
docker push $(NAME)/hub
6569
docker push $(NAME)/node-base
6670
docker push $(NAME)/node-chrome
6771
docker push $(NAME)/node-firefox
72+
docker push $(NAME)/standalone-chrome
73+
docker push $(NAME)/standalone-firefox
6874
@echo "*** Don't forget to create a tag. git tag rel-$(VERSION) && git push origin rel-$(VERSION)"
6975

7076
test:
7177
./test.sh
78+
./sa-test.sh
7279
./test.sh debug
7380

7481
.PHONY: all build ci base hub nodebase chrome firefox \

Test/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
FROM node:0.10-onbuild
22
MAINTAINER Selenium <[email protected]>
33

4+
ENV TEST_CMD node smoke-chrome.js && node smoke-firefox.js
45
# The remainder of this build will be completed by the upstream image's ONBUILD commands

Test/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "Tests for docker selenium configuration",
55
"main": "index.js",
66
"scripts": {
7-
"start": "node smoke-chrome.js && node smoke-firefox.js"
7+
"start": "$TEST_CMD"
88
},
99
"license": "Apache 2",
1010
"dependencies": {

sa-test.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/sh
2+
3+
echo Building test container image
4+
docker build -t selenium/test:local ./Test
5+
6+
function test_standalone {
7+
BROWSER=$1
8+
echo Starting $BROWSER standalone container
9+
10+
SA=$(docker run -d -v /dev/urandom:/dev/random selenium/standalone-$BROWSER:2.44.0)
11+
SA_NAME=$(docker inspect -f '{{ .Name }}' $SA | sed s:/::)
12+
TEST_CMD="node smoke-$BROWSER.js"
13+
14+
echo Running test container...
15+
docker run --rm -it --link $SA_NAME:hub -e "TEST_CMD=$TEST_CMD" selenium/test:local
16+
STATUS=$?
17+
18+
echo Tearing down Selenium $BROWSER standalone container
19+
20+
docker stop $SA_NAME
21+
docker rm $SA_NAME
22+
23+
if [ ! $STATUS == 0 ]; then
24+
echo Failed
25+
exit 1
26+
fi
27+
}
28+
29+
test_standalone firefox
30+
test_standalone chrome

0 commit comments

Comments
 (0)