Skip to content

Commit

Permalink
smoke test and source from projectcontur
Browse files Browse the repository at this point in the history
KU-1063
  • Loading branch information
Maciek Golaszewski committed Jul 15, 2024
1 parent 3feb4dc commit 5e6bd29
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 54 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# contour-rock
OCI image for [contour](https://bitnami.com/stack/contour) based on Ubuntu 22.04 built using [rockcraft](https://github.com/canonical/rockcraft).
OCI image for [contour](https://projectcontour.io/) based on Ubuntu 22.04 built using [rockcraft](https://github.com/canonical/rockcraft).

Image is loosely based on original Dockerfile [](https://github.com/bitnami/containers/blob/main/bitnami/contour/1.28/debian-12/Dockerfile)
Image is loosely based on original [Dockerfile](https://github.com/projectcontour/contour/blob/main/Dockerfile) and [Makefile](https://github.com/projectcontour/contour/blob/main/Makefile)
17 changes: 12 additions & 5 deletions rockcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,18 @@ services:

entrypoint-service: contour


parts:
download-contour:
contour:
plugin: nil
source: https://downloads.bitnami.com/files/stacksmith/contour-1.28.5-0-linux-${CRAFT_PLATFORM}-debian-12.tar.gz
source: https://github.com/projectcontour/contour.git
source-type: git
source-tag: v1.28.2
source-depth: 1

build-snaps:
- go/1.21/stable
override-build: |
cp ${CRAFT_PART_BUILD}/files/contour/bin/contour ${CRAFT_PART_INSTALL}
prime:
- contour
make build
cp contour ${CRAFT_PART_INSTALL}/contour
5 changes: 5 additions & 0 deletions tests/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
black==24.3.0
codespell==2.2.4
flake8==6.0.0
isort==5.12.0
licenseheaders==0.8.8
4 changes: 4 additions & 0 deletions tests/requirements-test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
coverage[toml]==7.2.5
pytest==7.3.1
PyYAML==6.0.1
tenacity==8.2.3
17 changes: 17 additions & 0 deletions tests/sanity/test_rock.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import os
import subprocess


def test_sanity():
image_variable = "ROCK_CONTUR"
entrypoint = "/contour"
image = os.getenv(image_variable)
assert image is not None, f"${image_variable} is not set"

docker_run = subprocess.run(
["docker", "run", "--rm", "--entrypoint", entrypoint, image, "--help"],

capture_output=True,
text=True,
)
assert "Contour Kubernetes ingress controller." in docker_run.stderr
47 changes: 0 additions & 47 deletions tests/test_rock.py

This file was deleted.

61 changes: 61 additions & 0 deletions tests/tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[tox]
no_package = True
skip_missing_interpreters = True
env_list = format, lint, integration
min_version = 4.0.0

[testenv]
set_env =
PYTHONBREAKPOINT=pdb.set_trace
PY_COLORS=1
pass_env =
PYTHONPATH

[testenv:format]
description = Apply coding style standards to code
deps = -r {tox_root}/requirements-dev.txt
commands =
; licenseheaders -t {tox_root}/.copyright.tmpl -cy -o 'Canonical, Ltd' -d {tox_root}
isort {tox_root} --profile=black
black {tox_root}

[testenv:lint]
description = Check code against coding style standards
deps = -r {tox_root}/requirements-dev.txt
commands =
codespell {tox_root} --skip=".tox"
flake8 {tox_root}
licenseheaders -t {tox_root}/.copyright.tmpl -cy -o 'Canonical, Ltd' -d {tox_root} --dry
isort {tox_root} --profile=black --check
black {tox_root} --check --diff

[testenv:sanity]
description = Run integration tests
deps =
-r {tox_root}/requirements-test.txt
commands =
pytest -v \
--maxfail 1 \
--tb native \
--log-cli-level DEBUG \
--disable-warnings \
{posargs} \
{tox_root}/sanity
pass_env =
TEST_*
ROCK_*

[testenv: integration]
allowlist_externals =
echo
commands =
# TODO: Implement integration tests here
echo "WARNING: This is a placeholder test - no test is implemented here."


[flake8]
max-line-length = 120
select = E,W,F,C,N
ignore = W503
exclude = venv,.git,.tox,.tox_env,.venv,build,dist,*.egg_info
show-source = true

0 comments on commit 5e6bd29

Please sign in to comment.