auditd: refactor testing inside docker

This commit is contained in:
Aleksey Nikitin
2023-02-01 11:59:21 +03:00
parent 1141e4f8fd
commit e715eaaf41
7 changed files with 11 additions and 13 deletions
+4 -4
View File
@@ -1,5 +1,5 @@
test:
$(SOLDR_MODULES)/bin/busted --exclude-tags=root $(BUSTED_FLAGS) .
$(SOLDR_MODULES)/bin/busted $(BUSTED_FLAGS) .
OS_LIST := $(subst docker/Dockerfile.,,$(wildcard docker/Dockerfile.*))
test-inside-all: $(OS_LIST:%=test-inside-%)
@@ -8,6 +8,6 @@ test-inside-%: docker/Dockerfile.%
@echo === $* ===
@docker build -t test/$* -f docker/Dockerfile.$* . >&-
@docker run --rm \
-e SOLDR_MODULES=/src \
-v $(SOLDR_MODULES):/src:ro -w /src/auditd/1.0.0 \
test/$* /src/bin/busted $(BUSTED_FLAGS) .
-e SOLDR_MODULES=/src -e BUSTED_FLAGS \
-v $(SOLDR_MODULES):/src:ro \
test/$* make test -sC /src/auditd/1.0.0
+2 -4
View File
@@ -2,7 +2,7 @@ local managed = require "managed"
local exec = require "exec"
local function rm(path)
local cmd = string.format("rm -r %q", path)
local cmd = string.format("rm -rf %q", path)
assert(exec(cmd))
end
@@ -22,9 +22,7 @@ describe("Managed file #write", function()
tmp = assert(exec("mktemp -d"))
f_name = tmp .. "/sub/file"
end)
teardown(function()
rm(tmp)
end)
teardown(function() rm(tmp) end)
describe("ensure()", function()
it("should create a file unless it exists", function()
+1 -1
View File
@@ -1,4 +1,4 @@
FROM debian:10
RUN apt-get update;
RUN apt-get install --yes systemd;
RUN apt-get install --yes systemd make;
RUN apt-get install --yes --download-only auditd;
+1 -1
View File
@@ -1,4 +1,4 @@
FROM debian:11
RUN apt-get update;
RUN apt-get install --yes systemd;
RUN apt-get install --yes systemd make;
RUN apt-get install --yes --download-only auditd;
+1 -1
View File
@@ -1,3 +1,3 @@
FROM oraclelinux:8
RUN dnf makecache;
RUN dnf install -y make;
RUN dnf install -y --downloadonly audit;
+1 -1
View File
@@ -1,4 +1,4 @@
FROM ubuntu:20.04
RUN apt-get update;
RUN apt-get install --yes systemd;
RUN apt-get install --yes systemd make;
RUN apt-get install --yes --download-only auditd;
+1 -1
View File
@@ -1,4 +1,4 @@
FROM ubuntu:22.04
RUN apt-get update;
RUN apt-get install --yes systemd;
RUN apt-get install --yes systemd make;
RUN apt-get install --yes --download-only auditd;