Skip to content

Commit

Permalink
WIP - add pcp tests
Browse files Browse the repository at this point in the history
This was based on the init tests, as the pcp container is based on the
init container. The docker stuff was removed as only podman suuported.

export TARGET=x
export BASEURL=registry.suse.de/home/doreilly/branches/suse/sle-15-sp4/update/bci
tox -e pcp
  • Loading branch information
djoreilly committed May 13, 2022
1 parent 2a1d2b2 commit 1649231
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 2 deletions.
16 changes: 16 additions & 0 deletions bci_tester/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,21 @@ def create_BCI(
default_entry_point=True,
)

PCP_CONTAINER = create_BCI(
build_tag=f"suse/pcp:5.2.2",
image_type="dockerfile",
available_versions=["15.3"],
extra_launch_args=[]
if DOCKER_SELECTED
else [
"--systemd",
"always",
"-p",
"44322:44322",
],
default_entry_point=True,
)

CONTAINER_389DS = create_BCI(
build_tag="suse/389-ds:2.0",
image_type="dockerfile",
Expand Down Expand Up @@ -354,6 +369,7 @@ def create_BCI(
NODEJS_12_CONTAINER,
NODEJS_14_CONTAINER,
NODEJS_16_CONTAINER,
PCP_CONTAINER,
PYTHON36_CONTAINER,
PYTHON39_CONTAINER,
PYTHON310_CONTAINER,
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ markers = [
'bci/dotnet-aspnet_3.1',
'bci/dotnet-aspnet_5.0',
'bci/dotnet-aspnet_6.0',
'suse/389-ds_2.0'
'suse/389-ds_2.0',
'suse/pcp_5.2.2'
]

[tool.black]
Expand Down
2 changes: 2 additions & 0 deletions tests/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
from bci_tester.data import OPENJDK_DEVEL_17_CONTAINER
from bci_tester.data import OS_SP_VERSION
from bci_tester.data import OS_VERSION
from bci_tester.data import PCP_CONTAINER
from bci_tester.data import PYTHON310_CONTAINER
from bci_tester.data import PYTHON36_CONTAINER
from bci_tester.data import PYTHON39_CONTAINER
Expand Down Expand Up @@ -112,6 +113,7 @@ def _get_container_label_prefix(
(PYTHON310_CONTAINER, "python", ImageType.LANGUAGE_STACK),
(RUBY_25_CONTAINER, "ruby", ImageType.LANGUAGE_STACK),
(INIT_CONTAINER, "init", ImageType.OS),
(PCP_CONTAINER, "pcp", ImageType.APPLICATION)),
(CONTAINER_389DS, "389-ds", ImageType.APPLICATION),
(DOTNET_SDK_3_1_CONTAINER, "dotnet.sdk", ImageType.LANGUAGE_STACK),
(DOTNET_SDK_5_0_CONTAINER, "dotnet.sdk", ImageType.LANGUAGE_STACK),
Expand Down
37 changes: 37 additions & 0 deletions tests/test_pcp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"""This module contains the tests for the pcp container
"""
import pytest
import time
from pytest_container.runtime import LOCALHOST

from bci_tester.data import PCP_CONTAINER
from bci_tester.runtime_choice import DOCKER_SELECTED


@pytest.mark.parametrize("container", [PCP_CONTAINER], indirect=True)
@pytest.mark.skipif(DOCKER_SELECTED, reason="only podman is supported")
def test_systemd_present(container):
"""Check that the pcp daemons are running.
"""

# pcp needs a little time to initialize
time.sleep(5)

assert container.connection.run_expect([0], "systemctl status")
assert container.connection.run_expect([0], "systemctl status pmcd")
assert container.connection.run_expect([0], "systemctl status pmlogger")
assert container.connection.run_expect([0], "systemctl status pmproxy")
assert container.connection.run_expect([0], "systemctl status pmie")

# test call to pmcd
assert container.connection.run_expect([0], "pmprobe -v mem.physmem")

# test call to pmproxy
if LOCALHOST.exists("curl"):
assert (
LOCALHOST.run_expect(
[0],
"curl -s http://localhost:44322/metrics?names=mem.physmem",
)
)
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = {py36,py37,py38,py39,py310}-unit, build, all, base, init, dotnet, python, ruby, node, go, openjdk, openjdk_devel, busybox, 389ds, metadata, minimal, multistage, repository, doc, lint
envlist = {py36,py37,py38,py39,py310}-unit, build, all, base, init, dotnet, python, ruby, node, go, openjdk, openjdk_devel, busybox, 389ds, metadata, minimal, multistage, repository, doc, lint, pcp
isolated_build = True
skip_missing_interpreters = True
skipsdist = True
Expand Down

0 comments on commit 1649231

Please sign in to comment.