tests/integration: Fix paths for testing override and reset tags

Tests were not run due to missing __init__.py files.
This commit adds missing files and fixes paths to compose.yaml files.

Signed-off-by: Monika Kairaityte <monika@kibit.lt>
This commit is contained in:
Monika Kairaityte 2025-05-15 21:34:40 +03:00
parent 9c09789948
commit 6e30673260
7 changed files with 27 additions and 12 deletions

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@

View File

@ -10,15 +10,18 @@ from tests.integration.test_utils import test_path
def compose_yaml_path(): def compose_yaml_path():
return os.path.join(os.path.join(test_path(), "override_tag_attribute"), "docker-compose.yaml") return os.path.join(
test_path(),
"merge/reset_and_override_tags/override_tag_attribute/docker-compose.yaml",
)
class TestComposeOverrideTagAttribute(unittest.TestCase, RunSubprocessMixin): class TestComposeOverrideTagAttribute(unittest.TestCase, RunSubprocessMixin):
# test if a service attribute from docker-compose.yaml file is overridden # test if a service attribute from docker-compose.yaml file is overridden
def test_override_tag_attribute(self): def test_override_tag_attribute(self):
override_file = os.path.join( override_file = os.path.join(
os.path.join(test_path(), "override_tag_attribute"), test_path(),
"docker-compose.override_attribute.yaml", "merge/reset_and_override_tags/override_tag_attribute/docker-compose.override_attribute.yaml",
) )
try: try:
self.run_subprocess_assert_returncode([ self.run_subprocess_assert_returncode([

View File

@ -10,15 +10,18 @@ from tests.integration.test_utils import test_path
def compose_yaml_path(): def compose_yaml_path():
return os.path.join(os.path.join(test_path(), "override_tag_service"), "docker-compose.yaml") return os.path.join(
test_path(),
"merge/reset_and_override_tags/override_tag_service/docker-compose.yaml",
)
class TestComposeOverrideTagService(unittest.TestCase, RunSubprocessMixin): class TestComposeOverrideTagService(unittest.TestCase, RunSubprocessMixin):
# test if whole service from docker-compose.yaml file is overridden in another file # test if whole service from docker-compose.yaml file is overridden in another file
def test_override_tag_service(self): def test_override_tag_service(self):
override_file = os.path.join( override_file = os.path.join(
os.path.join(test_path(), "override_tag_service"), test_path(),
"docker-compose.override_service.yaml", "merge/reset_and_override_tags/override_tag_service/docker-compose.override_service.yaml",
) )
try: try:
self.run_subprocess_assert_returncode([ self.run_subprocess_assert_returncode([

View File

@ -9,14 +9,18 @@ from tests.integration.test_utils import test_path
def compose_yaml_path(): def compose_yaml_path():
return os.path.join(os.path.join(test_path(), "reset_tag_attribute"), "docker-compose.yaml") return os.path.join(
test_path(),
"merge/reset_and_override_tags/reset_tag_attribute/docker-compose.yaml",
)
class TestComposeResetTagAttribute(unittest.TestCase, RunSubprocessMixin): class TestComposeResetTagAttribute(unittest.TestCase, RunSubprocessMixin):
# test if the attribute of the service is correctly reset # test if the attribute of the service is correctly reset
def test_reset_tag_attribute(self): def test_reset_tag_attribute(self):
reset_file = os.path.join( reset_file = os.path.join(
os.path.join(test_path(), "reset_tag_attribute"), "docker-compose.reset_attribute.yaml" test_path(),
"merge/reset_and_override_tags/reset_tag_attribute/docker-compose.reset_attribute.yaml",
) )
try: try:
self.run_subprocess_assert_returncode([ self.run_subprocess_assert_returncode([

View File

@ -9,14 +9,17 @@ from tests.integration.test_utils import test_path
def compose_yaml_path(): def compose_yaml_path():
return os.path.join(os.path.join(test_path(), "reset_tag_service"), "docker-compose.yaml") return os.path.join(
test_path(), "merge/reset_and_override_tags/reset_tag_service/docker-compose.yaml"
)
class TestComposeResetTagService(unittest.TestCase, RunSubprocessMixin): class TestComposeResetTagService(unittest.TestCase, RunSubprocessMixin):
# test if whole service from docker-compose.yaml file is reset # test if whole service from docker-compose.yaml file is reset
def test_reset_tag_service(self): def test_reset_tag_service(self):
reset_file = os.path.join( reset_file = os.path.join(
os.path.join(test_path(), "reset_tag_service"), "docker-compose.reset_service.yaml" test_path(),
"merge/reset_and_override_tags/reset_tag_service/docker-compose.reset_service.yaml",
) )
try: try:
self.run_subprocess_assert_returncode([ self.run_subprocess_assert_returncode([

View File

@ -11,7 +11,7 @@ from tests.integration.test_utils import test_path
def compose_yaml_path(compose_name): def compose_yaml_path(compose_name):
""" "Returns the path to the compose file used for this test module""" """ "Returns the path to the compose file used for this test module"""
base_path = os.path.join(test_path(), "volumes_merge/") base_path = os.path.join(test_path(), "merge/volumes_merge/")
return os.path.join(base_path, compose_name) return os.path.join(base_path, compose_name)
@ -55,7 +55,7 @@ class TestComposeVolumesMerge(unittest.TestCase, RunSubprocessMixin):
binds_info = volumes_info["HostConfig"]["Binds"] binds_info = volumes_info["HostConfig"]["Binds"]
binds_info.sort() binds_info.sort()
file_path = os.path.join(test_path(), "volumes_merge/override.txt") file_path = os.path.join(test_path(), "merge/volumes_merge/override.txt")
expected = [ expected = [
f'{file_path}:/var/www/html/index.html:ro,rprivate,rbind', f'{file_path}:/var/www/html/index.html:ro,rprivate,rbind',
f'{file_path}:/var/www/html/index2.html:rw,rprivate,rbind', f'{file_path}:/var/www/html/index2.html:rw,rprivate,rbind',