Browse Source

Add option to get a shell into the container used for the tests

Signed-off-by: Clement Verna <cverna@tutanota.com>
Pierre-Yves Chibon 5 years ago
parent
commit
e944ac84fa
1 changed files with 30 additions and 6 deletions
  1. 30 6
      dev/run-tests-container.py

+ 30 - 6
dev/run-tests-container.py

@@ -40,6 +40,13 @@ def setup_parser():
         action="store_false",
         help="Skip building the container image",
     )
+    parser.add_argument(
+        "--shell",
+        dest="shell",
+        action="store_true",
+        help="Gives you a shell into the container instead "
+        "of running the tests",
+    )
 
     return parser
 
@@ -91,10 +98,9 @@ if __name__ == "__main__":
                 "dev/docker",
             ]
         )
-
-    print("--------- Running Test --------------")
-    sp.run(
-        [
+    if args.shell:
+        print("--------- Shelling in the container --------------")
+        command = [
             "podman",
             "run",
             "-it",
@@ -103,7 +109,25 @@ if __name__ == "__main__":
             container_name,
             "-v",
             "{}:/pagure".format(os.getcwd()),
+            "--entrypoint=/bin/bash",
             container_name,
-            args.test_case,
         ]
-    )
+        sp.run(command)
+
+    else:
+
+        print("--------- Running Test --------------")
+        sp.run(
+            [
+                "podman",
+                "run",
+                "-it",
+                "--rm",
+                "--name",
+                container_name,
+                "-v",
+                "{}:/pagure".format(os.getcwd()),
+                container_name,
+                args.test_case,
+            ]
+        )