File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ .pytest_cache /
2+ __pycache__
Original file line number Diff line number Diff line change 1+ test :
2+ docker run --rm -t \
3+ -u " $( shell id -u) :$( shell id -g) " \
4+ -v $(shell pwd) :/project \
5+ -v /var/run/docker.sock:/var/run/docker.sock:ro \
6+ aveltens/docker-testinfra
7+
8+ .PHONY : test
Original file line number Diff line number Diff line change 11# docker-solid-server
2+
23Containerized version of node-solid-server
4+
5+ ## How to use
6+
7+ This is still work in progress and not meant to be used yet.
8+
9+ ## Run tests
10+
11+ ```
12+ make test
13+ ```
14+
15+ The first run might take a while, since the image has to be build. Follow up test runs will be faster.
Original file line number Diff line number Diff line change 1+ FROM node:10-alpine
2+
3+ WORKDIR /opt/solid
4+
5+ USER node
Original file line number Diff line number Diff line change 1+ import docker
2+ import pytest
3+
4+ @pytest .fixture (scope = "session" )
5+ def client ():
6+ return docker .from_env ()
7+
8+ @pytest .fixture (scope = "session" )
9+ def image (client ):
10+ img , _ = client .images .build (path = './src' )
11+ return img
Original file line number Diff line number Diff line change 1+ import docker
2+ import pytest
3+
4+ testinfra_hosts = ['docker://test_container' ]
5+
6+ @pytest .fixture (scope = "module" , autouse = True )
7+ def container (client , image ):
8+ container = client .containers .run (
9+ image .id ,
10+ name = "test_container" ,
11+ detach = True ,
12+ tty = True ,
13+ command = "sh"
14+ )
15+ yield container
16+ container .remove (force = True )
17+
18+ def test_solid_home_dir_exists (host ):
19+ assert host .file ("/opt/solid" ).is_directory
20+
21+ def test_node_command_is_available (host ):
22+ assert host .exists ("node" )
23+
24+ def test_node_version_is_10 (host ):
25+ assert host .check_output ("node --version" ).startswith ('v10' )
26+
27+ def test_current_user_is_node (host ):
28+ assert host .user ().name == "node"
29+ assert host .user ().group == "node"
You can’t perform that action at this time.
0 commit comments