robottelo
robottelo copied to clipboard
RFE: Utilize containers instead of VMs to reduce setup of content host
It would be nice to utilize containers instead of VMs for quick setup of content hosts for testing. Containers can take less than 30 secs to setup so it would speed up several content host related test cases. Feel free to share thoughts and suggestions on this.
Minor correction. Most containers take around 0.5s to spin up :)
@latran Thanks for bringing this topic for discussion. @latran @JacobCallahan We are using docker containers as a content host in upgrade tests. I think it will be good if start using them in normal robottelo tests as well. If we have multiple content host tests, I would say keep a single test with VM and modified other tests to containers ( The reason I'm saying this I would guess that multiple customers should be using VM as the content host (I could be wrong) rather containers just to make sure that we are mimicking the same behaviour as the customer). Yeah, this will decrease automation execution time.
Upgrade Code
https://github.com/SatelliteQE/satellite6-upgrade/blob/e2107917151483c1b1b72d1ce767de183d5be19b/upgrade_tests/helpers/scenarios.py#L58
Example how to Use?
https://github.com/SatelliteQE/robottelo/blob/8879bd5cae19749f57f3fe76edf1d2e2e2128747/tests/upgrades/test_errata.py#L238
@omkarkhatavkar our current proposed design will allow for a couple of interfaces. Direct container instance:
my_host = Container(runtime="docker", image="ch-d", tag="rhel7")
my_host.register(host="my.sat.host.com", ak="rhel7")
assert "Current" in my_host.execute("subscription-manager status")
my_host.delete()
or as a context manager
with ContainerContext(runtime="podman", tag="rhel7") as my_host:
my_host.register(host="my.sat.host.com", ak="rhel7")
with ContainerContext(runtime="podman", tag="rhel7", count=5) as c_hosts:
for c_host in c_hosts:
assert "registered" in c_host.register("my.sat.host.com")
@JacobCallahan looks good, when are you planning to raise PR with that code? There will be a good chunk of tests need to move from VM to Container. I got to be attracted to that count=5.
@omkarkhatavkar most of the work has been done, but there is still more ahead. Once we have tested everything and are confident in the state of things, then I'll submit the PR. In the meantime, you can follow the progress over at https://github.com/JacobCallahan/content-host-helpers/
Linking RFE to PR: #7436