-
Notifications
You must be signed in to change notification settings - Fork 446
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: disable
ulimits
in rootless docker mode
- Loading branch information
1 parent
509cddc
commit 8c1312b
Showing
7 changed files
with
72 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,27 @@ | ||
import unittest | ||
from unittest.mock import patch | ||
|
||
from .base import TestCommandMixin | ||
|
||
from tutor.commands import dev | ||
|
||
|
||
class DevTests(unittest.TestCase, TestCommandMixin): | ||
def test_dev_help(self) -> None: | ||
result = self.invoke(["dev", "--help"]) | ||
self.assertEqual(0, result.exit_code) | ||
self.assertIsNone(result.exception) | ||
|
||
@patch("tutor.utils.is_docker_rootless") | ||
def test_rootless_no_ulimits(self, mock_is_docker_rootless) -> None: | ||
configs = { | ||
'DEV_PROJECT_NAME': 'maple', | ||
} | ||
|
||
mock_is_docker_rootless.return_value = False | ||
task_runner = dev.DevTaskRunner('/app', configs) | ||
self.assertIn('/app/env/local/docker-compose.ulimits.yml', task_runner.docker_compose_files) | ||
|
||
mock_is_docker_rootless.return_value = True | ||
task_runner = dev.DevTaskRunner('/app', configs) | ||
self.assertNotIn('/app/env/local/docker-compose.ulimits.yml', task_runner.docker_compose_files) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# This file contains the `ulimits` configuration which is skipped on rootless Docker because | ||
# it's not supported. | ||
version: "{{ DOCKER_COMPOSE_VERSION }}" | ||
services: | ||
{% if RUN_ELASTICSEARCH -%} | ||
elasticsearch: | ||
ulimits: | ||
memlock: | ||
soft: -1 | ||
hard: -1 | ||
{%- endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters