ci: improve QA with cram based tests
authorPetr Štetiar <ynezz@true.cz>
Fri, 22 Dec 2023 09:46:01 +0000 (09:46 +0000)
committerPetr Štetiar <ynezz@true.cz>
Fri, 22 Dec 2023 10:58:33 +0000 (11:58 +0100)
Currently we've broken master container but we're not aware about it as
current tests are very lame, so lets improve it a bit with some more
reliable, extensible solution.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
.github/workflows/build-push.yml
.gitignore
requirements-dev.txt
tests/cram/master/01-logs.t [new file with mode: 0644]
tests/cram/worker/01-logs.t [new file with mode: 0644]

index 9a2eed4da7d8009f3cfcfcb3be2ea02be5e47a42..f568ed661fe312e375bbe6d09ac46840b2c7ef4f 100644 (file)
@@ -83,8 +83,8 @@ jobs:
         run: |
           docker run --detach ${{ matrix.container_test_command }} --name test-${{ matrix.container_flavor }} local/${{ matrix.container_flavor }}
           sleep 5
-          docker logs test-${{ matrix.container_flavor }} | tee ${{ matrix.container_flavor }}.log
-          grep "${{ matrix.container_verify_string }}" ${{ matrix.container_flavor }}.log
+          pip install cram
+          cram --verbose "tests/cram/${{ matrix.container_flavor }}"
 
   deploy:
     name: Push Container
index a94d1d22ede7e410bcb0e5c14b3bb8012fb5142b..0d4e15fcff942daaea0f1aab1d2f04a6977dd3da 100644 (file)
@@ -25,3 +25,5 @@ phase[12]/twistd.*
 !.github/**/*
 !requirements-dev.txt
 !.ruff.toml
+!tests
+!tests/**/*
index a14cc0301cc578843afb883122765b9fbf798d1a..e1cb65f0c300f27d7e01c96f567b13f524fba55d 100644 (file)
@@ -1,2 +1,3 @@
+cram==0.7
 black==23.3.0
 ruff==0.0.267
diff --git a/tests/cram/master/01-logs.t b/tests/cram/master/01-logs.t
new file mode 100644 (file)
index 0000000..b6c5c81
--- /dev/null
@@ -0,0 +1,7 @@
+Check that logs have expected content after container startup:
+
+  $ docker logs test-master
+  updating existing installation
+  creating /master/master.cfg.sample
+  creating database (sqlite:///state.sqlite)
+  buildmaster configured in /master
diff --git a/tests/cram/worker/01-logs.t b/tests/cram/worker/01-logs.t
new file mode 100644 (file)
index 0000000..7afdd4e
--- /dev/null
@@ -0,0 +1,10 @@
+Check that logs have expected content after container startup:
+
+  $ docker logs test-worker
+  updating existing installation
+  mkdir /builder/info
+  Creating info/admin, you need to edit it appropriately.
+  Creating info/host, you need to edit it appropriately.
+  Not creating info/access_uri - add it if you wish
+  Please edit the files in /builder/info appropriately.
+  worker configured in /builder