Skip to content

Commit

Permalink
Fix doc on how to contribute
Browse files Browse the repository at this point in the history
  • Loading branch information
ademariag committed Sep 1, 2024
1 parent 4ebde1c commit 8fadb96
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/pages/contribute/code.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ We build kapitan using `poetry`.
2. Install dependencies

```bash
poetry install --with test
poetry install --all-extras --with dev --with test --with docs
```

Poetry creates a virtual environment with the required dependencies installed.
Expand Down
9 changes: 7 additions & 2 deletions tests/test_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def tearDown(self):
class CompileTestResourcesTestKadet(unittest.TestCase):
def setUp(self):
os.chdir(TEST_RESOURCES_PATH)
reset_cache()

def test_compile(self):
sys.argv = ["kapitan", "compile", "-t", "kadet-test"]
Expand Down Expand Up @@ -86,6 +87,7 @@ def tearDown(self):
class FailCompileTestResourcesTestKadet(unittest.TestCase):
def setUp(self):
os.chdir(TEST_RESOURCES_PATH)
reset_cache()

def test_compile(self):
sys.argv = ["kapitan", "compile", "-t", "fail-compile"]
Expand All @@ -99,6 +101,7 @@ def tearDown(self):
class CompileTestResourcesTestJinja2InputParams(unittest.TestCase):
def setUp(self):
os.chdir(TEST_RESOURCES_PATH)
reset_cache()

def test_compile(self):
sys.argv = ["kapitan", "compile", "-t", "jinja2-input-params"]
Expand Down Expand Up @@ -131,6 +134,7 @@ def tearDown(self):
class CompileTestResourcesTestJinja2PostfixStrip(unittest.TestCase):
def setUp(self):
os.chdir(TEST_RESOURCES_PATH)
reset_cache()

def test_compile(self):
sys.argv = ["kapitan", "compile", "-t", "jinja2-postfix-strip"]
Expand Down Expand Up @@ -177,7 +181,7 @@ def test_compile_not_enough_args(self):
self.assertEqual(cm.exception.code, 1)

def test_compile_specific_target(self):

reset_cache()
sys.argv = ["kapitan", "compile", "-t", "minikube-mysql"] + self.extraArgv
main()
self.assertTrue(
Expand All @@ -188,6 +192,7 @@ def test_compile_specific_target(self):
main()

def test_compile_target_with_label(self):
reset_cache()
sys.argv = ["kapitan", "compile", "-l", "type=kadet"] + self.extraArgv
main()
self.assertTrue(
Expand Down Expand Up @@ -235,7 +240,7 @@ class CompileKubernetesTestOmegaconf(CompileKubernetesTest):
temp_dir = tempfile.mkdtemp()

def setUp(self):

reset_cache()
shutil.copytree(self.inventory_path, self.temp_dir, dirs_exist_ok=True)
self.inventory_path = self.temp_dir
super().setUp()
Expand Down
9 changes: 6 additions & 3 deletions tests/test_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
import logging
import os
import shutil
import sys
import tempfile
import unittest

import kapitan.cached
from kapitan.cli import build_parser
from kapitan.inventory import InventoryBackends
from kapitan.resources import inventory

Expand All @@ -24,16 +27,16 @@


class InventoryTargetTestBase(unittest.TestCase):

def setUp(self) -> None:
from kapitan.cached import args, reset_cache
sys.argv = ["kapitan", "compile"]
args = build_parser().parse_args()

reset_cache()
# Fix inconsistency between reclass-rs (option name) and reclass_rs (module name)
backend_module_name = self.backend_id.replace("-", "_")
if not importlib.util.find_spec(backend_module_name):
self.skipTest(f"backend module {backend_module_name} not available")
args.inventory_backend = self.backend_id
kapitan.cached.args = args

def test_inventory_target(self):
inv = inventory(inventory_path=self.inventory_path, target_name="minikube-es")
Expand Down

0 comments on commit 8fadb96

Please sign in to comment.