Skip to content

Commit 001e08e

Browse files
committed
build up the requirements to install node-solid-server
1 parent 5505088 commit 001e08e

6 files changed

Lines changed: 68 additions & 0 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.pytest_cache/
2+
__pycache__

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,15 @@
11
# docker-solid-server
2+
23
Containerized 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.

src/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM node:10-alpine
2+
3+
WORKDIR /opt/solid
4+
5+
USER node

test/conftest.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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

test/test_image_foundations.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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"

0 commit comments

Comments
 (0)