Merge branch 'dev' of https://repositories.communitynotfound.work/Py-Docktor/DocktorAnalyzer into dev
This commit is contained in:
commit
b2cc65ef2c
5
.pypirc
Normal file
5
.pypirc
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[distutils]
|
||||||
|
index_servers =
|
||||||
|
private-gitea
|
||||||
|
|
||||||
|
[private-gitea]
|
||||||
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
36
tests/unit-tests/instruction_test.py
Normal file
36
tests/unit-tests/instruction_test.py
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# content of test_sample.py
|
||||||
|
from pathlib import Path
|
||||||
|
import re
|
||||||
|
import pytest
|
||||||
|
import docktoranalyzer
|
||||||
|
import docktoranalyzer.dockerfile
|
||||||
|
from docktoranalyzer.dockerfile.docker_constants import DockerConstants
|
||||||
|
from docktoranalyzer.dockerfile.dockerfile_parser import DockerFileParser
|
||||||
|
|
||||||
|
# TODO: use a glob to take files and rege
|
||||||
|
@pytest.fixture
|
||||||
|
def docker_file_arrays():
|
||||||
|
|
||||||
|
# I need to count one stage over to account for instructions
|
||||||
|
# the first FROM
|
||||||
|
return [
|
||||||
|
{"path": "./assets/dockerfiles/binary.dockerfile", "stages": 2},
|
||||||
|
{"path": "./assets/dockerfiles/crypto.dockerfile", "stages": 2},
|
||||||
|
{"path": "./assets/dockerfiles/web.dockerfile", "stages": 3},
|
||||||
|
{"path": "./assets/dockerfiles/with-chunks.dockerfile", "stages": 3},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: Make tests for regex
|
||||||
|
|
||||||
|
|
||||||
|
def test_dockerfile_parser(docker_file_arrays):
|
||||||
|
|
||||||
|
for docker_file_info in docker_file_arrays:
|
||||||
|
|
||||||
|
docker_path = docker_file_info["path"]
|
||||||
|
actual_stages = docker_file_info["stages"]
|
||||||
|
|
||||||
|
docker = DockerFileParser.dockerfile_factory(Path(docker_path))
|
||||||
|
|
||||||
|
assert len(docker.stages) == actual_stages
|
||||||
Loading…
x
Reference in New Issue
Block a user