Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docker-compose-plugin package for Debian #60

Merged
merged 8 commits into from
Jun 6, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# These owners will be the default owners for everything in the
# repo. Unless a later match takes precedence, these owners will be
# requested for review when someone opens a pull request.
* @dav3r @felddy @jsf9k
* @dav3r @felddy @jsf9k @mcdonnnj

# These folks own any files in the .github directory at the root of
# the repository and any of its subdirectories.
Expand Down
115 changes: 89 additions & 26 deletions molecule/default/tests/test_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,67 @@ def test_packages(host):
distribution = host.system_info.distribution
codename = host.system_info.codename

# Docker package
if (
distribution == "debian" and (codename == "bookworm" or codename is None)
) or distribution == "kali":
# Debian Bookworm is not yet supported by the official Docker
# package repo
#
# https://docs.docker.com/engine/install/debian/
assert host.package("docker.io").is_installed
elif distribution == "fedora":
# Only Moby is available for Feodra 32 and 33
#
# https://docs.docker.com/engine/install/fedora/
assert host.package("moby-engine").is_installed
if distribution in ["debian"]:
if codename in ["stretch"]:
assert all(
[
host.package(pkg)
jsf9k marked this conversation as resolved.
Show resolved Hide resolved
for pkg in [
"docker-ce",
"docker-compose",
"python-docker",
]
]
)
elif codename in ["buster", "bullseye"]:
assert all(
[
host.package(pkg)
jsf9k marked this conversation as resolved.
Show resolved Hide resolved
for pkg in [
"docker-ce",
"docker-compose",
"docker-compose-plugin",
"python3-docker",
]
]
)
elif codename in ["bookworm"]:
assert all(
[
host.package(pkg)
jsf9k marked this conversation as resolved.
Show resolved Hide resolved
for pkg in ["docker.io", "docker-compose", "python3-docker"]
]
)
else:
assert False, f"Unknown codename {codename}"
elif distribution in ["kali"]:
assert all(
[
host.package(pkg)
jsf9k marked this conversation as resolved.
Show resolved Hide resolved
for pkg in ["docker.io", "docker-compose", "python3-docker"]
]
)
elif distribution in ["ubuntu"]:
assert all(
[
host.package(pkg)
jsf9k marked this conversation as resolved.
Show resolved Hide resolved
for pkg in [
"docker-ce",
"docker-compose",
"docker-compose-plugin",
"python3-docker",
]
]
)
elif distribution in ["amzn", "fedora"]:
assert all(
[
host.package(pkg)
jsf9k marked this conversation as resolved.
Show resolved Hide resolved
for pkg in ["docker-compose", "moby-engine", "python3-docker"]
]
)
else:
assert host.package("docker-ce").is_installed

# docker-compose package
assert host.package("docker-compose").is_installed

# Docker python library
if distribution == "debian" and codename == "stretch":
# Our Stretch AMIs are still using Python 2
assert host.package("python-docker").is_installed
else:
assert host.package("python3-docker").is_installed
assert False, f"Unknown distribution {distribution}"


@pytest.mark.parametrize("svc", ["docker"])
Expand All @@ -52,6 +87,34 @@ def test_services(host, svc):


@pytest.mark.parametrize("command", ["docker-compose version"])
mcdonnnj marked this conversation as resolved.
Show resolved Hide resolved
def test_command(host, command):
def test_commands(host, command):
"""Test that appropriate commands are available."""
distribution = host.system_info.distribution
codename = host.system_info.codename

if distribution in ["debian"]:
if codename in ["buster", "bullseye"]:
assert all(
[
host.run(cmd).rc == 0
for cmd in ["docker compose version", "docker-compose version"]
]
)
elif codename in ["stretch", "bookworm"]:
assert all([host.run(cmd).rc == 0 for cmd in ["docker-compose version"]])
else:
assert False, f"Unknown codename {codename}"
elif distribution in ["kali"]:
assert all([host.run(cmd).rc == 0 for cmd in ["docker-compose version"]])
elif distribution in ["ubuntu"]:
assert all(
[
host.run(cmd).rc == 0
for cmd in ["docker compose version", "docker-compose version"]
]
)
elif distribution in ["amzn", "fedora"]:
assert all([host.run(cmd).rc == 0 for cmd in ["docker-compose version"]])
else:
assert False, f"Unknown distribution {distribution}"
assert host.run(command).rc == 0
mcdonnnj marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions vars/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
package_names:
- docker-ce
- docker-compose
- docker-compose-plugin
- python3-docker
2 changes: 1 addition & 1 deletion vars/Debian_bookworm.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# The system packages to install
#
# Note that Debian Bullseye is not yet supported by the official
# Note that Debian Bookworm is not yet supported by the official
# Docker package repo.
#
# https://docs.docker.com/engine/install/debian/
Expand Down
2 changes: 2 additions & 0 deletions vars/Debian_stretch.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
# The system packages to install
package_names:
# Note that the docker-compose-plugin package is unavailable for
# Debian stretch.
jsf9k marked this conversation as resolved.
Show resolved Hide resolved
- docker-ce
- docker-compose
- python-docker