Skip to content
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.

Fix nmap error in travis #119

Merged
merged 8 commits into from
Aug 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 74 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- codecov

- stage: "Test"
name: "docker - calico e2e Tests"
name: "docker - calico e2e Tests (py3.8)"
language: python
cache: pip
python: "3.8"
Expand All @@ -66,6 +66,7 @@ jobs:
- pip install -r requirements.txt
- pip install codecov
- python setup.py install
- sudo cp ${TRAVIS_BUILD_DIR}/nmap /usr/local/bin/nmap

script:
# run illuminatio e2e tests
Expand All @@ -75,7 +76,7 @@ jobs:
- codecov

- stage: "Test"
name: "containerd - calico e2e Tests"
name: "containerd - calico e2e Tests (py3.8)"
language: python
cache: pip
python: "3.8"
Expand All @@ -100,6 +101,77 @@ jobs:
- pip install -r requirements.txt
- pip install codecov
- python setup.py install
- sudo cp ${TRAVIS_BUILD_DIR}/nmap /usr/local/bin/nmap

script:
# run illuminatio e2e tests
- ./local_dev/run_e2e_tests.sh

after_success:
- codecov

- stage: "Test"
name: "docker - calico e2e Tests (py3.7)"
language: python
cache: pip
python: "3.7"
env:
- KUBECONFIG="$HOME/.kube/config"
# stable version in minikube v1.12.2
- KUBERNETES_VERSION=v1.18.3
- MINIKUBE_VERSION=v1.12.2
- CHANGE_MINIKUBE_NONE_USER=true
- MINIKUBE_WANTUPDATENOTIFICATION=false
- MINIKUBE_WANTREPORTERRORPROMPT=false
- MINIKUBE_HOME=$HOME

before_script:
# install dependent binaries
- curl --fail -Lo kubectl "https://storage.googleapis.com/kubernetes-release/release/${KUBERNETES_VERSION}/bin/linux/amd64/kubectl" && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
- curl --fail -Lo minikube "https://storage.googleapis.com/minikube/releases/${MINIKUBE_VERSION}/minikube-linux-amd64" && chmod +x minikube && sudo mv minikube /usr/local/bin/
- mkdir -p $HOME/.kube $HOME/.minikube
- touch $KUBECONFIG
- minikube config set driver docker
- ./local_dev/start_docker.sh
- pip install -r requirements.txt
- pip install codecov
- python setup.py install
- sudo cp ${TRAVIS_BUILD_DIR}/nmap /usr/local/bin/nmap

script:
# run illuminatio e2e tests
- ./local_dev/run_e2e_tests.sh

after_success:
- codecov

- stage: "Test"
name: "containerd - calico e2e Tests (py3.7)"
language: python
cache: pip
python: "3.7"
env:
- KUBECONFIG="$HOME/.kube/config"
# stable version in minikube v1.12.2
- KUBERNETES_VERSION=v1.18.3
- MINIKUBE_VERSION=v1.12.2
- CHANGE_MINIKUBE_NONE_USER=true
- MINIKUBE_WANTUPDATENOTIFICATION=false
- MINIKUBE_WANTREPORTERRORPROMPT=false
- MINIKUBE_HOME=$HOME

before_script:
# install dependent binaries
- curl --fail -Lo kubectl "https://storage.googleapis.com/kubernetes-release/release/${KUBERNETES_VERSION}/bin/linux/amd64/kubectl" && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
- curl --fail -Lo minikube "https://storage.googleapis.com/minikube/releases/${MINIKUBE_VERSION}/minikube-linux-amd64" && chmod +x minikube && sudo mv minikube /usr/local/bin/
- mkdir -p $HOME/.kube $HOME/.minikube
- touch $KUBECONFIG
- minikube config set driver docker
- ./local_dev/start_containerd.sh
- pip install -r requirements.txt
- pip install codecov
- python setup.py install
- sudo cp ${TRAVIS_BUILD_DIR}/nmap /usr/local/bin/nmap

script:
# run illuminatio e2e tests
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ kubernetes==10.0.1
click==6.7
click_log==0.3.2
docker==3.7.0
nsenter==0.2
# Use current master to prevent pathlib error
git+https:/zalando/python-nsenter.git@b7fd78fef24c456d88130c75fe734417728e97e8
attrs==19.1.0
pluggy==0.11.0
pytest==4.5.0
Expand Down
25 changes: 19 additions & 6 deletions tests/test_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ def clean_cluster(core_v1):
for namespace in e2e_namespaces.items:
core_v1.delete_namespace(name=namespace.metadata.name)
# delete illuminatio resources
subprocess.check_output(["illuminatio", "clean"])
try:
print(subprocess.check_output(["illuminatio", "clean"]))
except subprocess.CalledProcessError as cpe:
print(cpe)


@pytest.mark.parametrize(
Expand Down Expand Up @@ -66,15 +69,25 @@ def test__e2e__clean_setup__results_are_expected(e2e_test_case, api_client, apps
"-o",
f"{result_file.name}",
]
subprocess.check_output(cmd, timeout=120)
try:
print(subprocess.check_output(cmd, timeout=120))
except subprocess.CalledProcessError as cpe:
print(cpe)
# load contents of result and expected
result = None
with open(result_file_name, "r") as stream:
result = yaml.safe_load(stream)
try:
with open(result_file_name, "r") as stream:
result = yaml.safe_load(stream)
except OSError:
maxbischoff marked this conversation as resolved.
Show resolved Hide resolved
pass
assert result is not None, f"Could not load result from {result_file_name}"
expected = None
with open(expected_yaml, "r") as stream:
expected = yaml.safe_load(stream)

try:
with open(expected_yaml, "r") as stream:
expected = yaml.safe_load(stream)
except OSError:
pass
assert expected is not None, f"Could not load expected from {expected_yaml}"
# assert that the correct cases have been generated and results match
assert "cases" in result
Expand Down