Compare commits
No commits in common. "5b0e945c99db6e7900b0010fb2634d0eafb26a4d" and "c7c8b93e092a2666370bb67c56c7f83673cbf31c" have entirely different histories.
5b0e945c99
...
c7c8b93e09
2 changed files with 54 additions and 10 deletions
|
|
@ -1323,7 +1323,7 @@ def _normalise_container_image_item(item: Any) -> Dict[str, Any]:
|
||||||
# --- Container image role renderer ---
|
# --- Container image role renderer ---
|
||||||
_CONTAINER_COLLECTIONS = [
|
_CONTAINER_COLLECTIONS = [
|
||||||
{"name": "community.docker", "version": ">=4.0.0"},
|
{"name": "community.docker", "version": ">=4.0.0"},
|
||||||
{"name": "containers.podman", "version": ">=1.20.0"},
|
{"name": "containers.podman", "version": ">=1.0.0"},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
62
tests.sh
62
tests.sh
|
|
@ -29,7 +29,6 @@ PUPPET_NO_JINJATURTLE_DIR="${WORK_DIR}/puppet-no-jinjaturtle"
|
||||||
SALT_JINJATURTLE_DIR="${WORK_DIR}/salt-jinjaturtle"
|
SALT_JINJATURTLE_DIR="${WORK_DIR}/salt-jinjaturtle"
|
||||||
SALT_NO_JINJATURTLE_DIR="${WORK_DIR}/salt-no-jinjaturtle"
|
SALT_NO_JINJATURTLE_DIR="${WORK_DIR}/salt-no-jinjaturtle"
|
||||||
TEST_FQDN="${ENROLL_TEST_FQDN:-enroll-ci.example.test}"
|
TEST_FQDN="${ENROLL_TEST_FQDN:-enroll-ci.example.test}"
|
||||||
JINJATURTLE_FIXTURE="${WORK_DIR}/enroll-tests-jinjaturtle.ini"
|
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
if [[ "${KEEP_WORKDIR}" -eq 0 ]]; then
|
if [[ "${KEEP_WORKDIR}" -eq 0 ]]; then
|
||||||
|
|
@ -150,27 +149,71 @@ prepare_harvest_fixture() {
|
||||||
section "Common harvest fixture and CLI smoke checks"
|
section "Common harvest fixture and CLI smoke checks"
|
||||||
apt_install jq apache2
|
apt_install jq apache2
|
||||||
|
|
||||||
cat >"${JINJATURTLE_FIXTURE}" <<'EOF'
|
|
||||||
[enroll_tests]
|
|
||||||
enabled = true
|
|
||||||
answer = 42
|
|
||||||
EOF
|
|
||||||
|
|
||||||
cd "${PROJECT_ROOT}"
|
cd "${PROJECT_ROOT}"
|
||||||
rm -rf "${BUNDLE_DIR}" "${BUNDLE_DIFF_DIR}"
|
rm -rf "${BUNDLE_DIR}" "${BUNDLE_DIFF_DIR}"
|
||||||
|
|
||||||
run poetry run enroll harvest --out "${BUNDLE_DIR}" --include-path "${JINJATURTLE_FIXTURE}"
|
run poetry run enroll harvest --out "${BUNDLE_DIR}"
|
||||||
run poetry run enroll explain "${BUNDLE_DIR}"
|
run poetry run enroll explain "${BUNDLE_DIR}"
|
||||||
run bash -c "poetry run enroll explain '${BUNDLE_DIR}' --format json | jq"
|
run bash -c "poetry run enroll explain '${BUNDLE_DIR}' --format json | jq"
|
||||||
run poetry run enroll validate --fail-on-warnings "${BUNDLE_DIR}"
|
run poetry run enroll validate --fail-on-warnings "${BUNDLE_DIR}"
|
||||||
|
|
||||||
apt_install cowsay
|
apt_install cowsay
|
||||||
run poetry run enroll harvest --out "${BUNDLE_DIFF_DIR}" --include-path "${JINJATURTLE_FIXTURE}"
|
run poetry run enroll harvest --out "${BUNDLE_DIFF_DIR}"
|
||||||
run poetry run enroll validate --fail-on-warnings "${BUNDLE_DIFF_DIR}"
|
run poetry run enroll validate --fail-on-warnings "${BUNDLE_DIFF_DIR}"
|
||||||
run bash -c "poetry run enroll diff --old '${BUNDLE_DIR}' --new '${BUNDLE_DIFF_DIR}' --format json | jq"
|
run bash -c "poetry run enroll diff --old '${BUNDLE_DIR}' --new '${BUNDLE_DIFF_DIR}' --format json | jq"
|
||||||
apt_remove_purge cowsay
|
apt_remove_purge cowsay
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add_jinjaturtle_harvest_fixture() {
|
||||||
|
section "JinjaTurtle manifest fixture"
|
||||||
|
|
||||||
|
local fixture_rel="etc/enroll-tests-jinjaturtle.ini"
|
||||||
|
local fixture_path="${BUNDLE_DIR}/artifacts/etc_custom/${fixture_rel}"
|
||||||
|
mkdir -p "$(dirname "${fixture_path}")"
|
||||||
|
cat >"${fixture_path}" <<'EOF'
|
||||||
|
[enroll_tests]
|
||||||
|
enabled = true
|
||||||
|
answer = 42
|
||||||
|
EOF
|
||||||
|
|
||||||
|
BUNDLE_DIR="${BUNDLE_DIR}" python3 - <<'PY'
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
bundle_dir = Path(os.environ["BUNDLE_DIR"])
|
||||||
|
state_path = bundle_dir / "state.json"
|
||||||
|
state = json.loads(state_path.read_text(encoding="utf-8"))
|
||||||
|
roles = state.setdefault("roles", {})
|
||||||
|
etc_custom = roles.setdefault("etc_custom", {})
|
||||||
|
etc_custom.setdefault("role_name", "etc_custom")
|
||||||
|
etc_custom.setdefault("excluded", [])
|
||||||
|
etc_custom.setdefault("notes", [])
|
||||||
|
managed_files = etc_custom.setdefault("managed_files", [])
|
||||||
|
fixture_path = "/etc/enroll-tests-jinjaturtle.ini"
|
||||||
|
managed_files[:] = [
|
||||||
|
item
|
||||||
|
for item in managed_files
|
||||||
|
if not isinstance(item, dict) or item.get("path") != fixture_path
|
||||||
|
]
|
||||||
|
managed_files.append(
|
||||||
|
{
|
||||||
|
"path": fixture_path,
|
||||||
|
"src_rel": "etc/enroll-tests-jinjaturtle.ini",
|
||||||
|
"owner": "root",
|
||||||
|
"group": "root",
|
||||||
|
"mode": "0644",
|
||||||
|
"reason": "tests_jinjaturtle_fixture",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
state_path.write_text(
|
||||||
|
json.dumps(state, indent=2, sort_keys=True) + "\n", encoding="utf-8"
|
||||||
|
)
|
||||||
|
PY
|
||||||
|
|
||||||
|
run poetry run enroll validate --fail-on-warnings "${BUNDLE_DIR}"
|
||||||
|
}
|
||||||
|
|
||||||
assert_template_files() {
|
assert_template_files() {
|
||||||
local manifest_dir="$1"
|
local manifest_dir="$1"
|
||||||
local extension="$2"
|
local extension="$2"
|
||||||
|
|
@ -317,6 +360,7 @@ main() {
|
||||||
require_debian_ci
|
require_debian_ci
|
||||||
run_pytests
|
run_pytests
|
||||||
prepare_harvest_fixture
|
prepare_harvest_fixture
|
||||||
|
add_jinjaturtle_harvest_fixture
|
||||||
run_ansible_noop_tests
|
run_ansible_noop_tests
|
||||||
run_puppet_noop_tests
|
run_puppet_noop_tests
|
||||||
run_salt_noop_tests
|
run_salt_noop_tests
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue