From 334f4219277c28088b5522c9971912c1ea927b6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Budai?= Date: Fri, 19 Mar 2021 16:23:45 +0100 Subject: [PATCH] test/cli: add a sanity check for Weldr logs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To prevent the issue fixed by the previous commit. Signed-off-by: Ondřej Budai --- cmd/osbuild-composer-cli-tests/main_test.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/osbuild-composer-cli-tests/main_test.go b/cmd/osbuild-composer-cli-tests/main_test.go index d35a02702..7f391a767 100644 --- a/cmd/osbuild-composer-cli-tests/main_test.go +++ b/cmd/osbuild-composer-cli-tests/main_test.go @@ -11,6 +11,7 @@ import ( "os" "os/exec" "strings" + "testing" "time" "github.com/BurntSushi/toml" @@ -20,8 +21,6 @@ import ( "github.com/osbuild/osbuild-composer/internal/blueprint" "github.com/osbuild/osbuild-composer/internal/weldr" - - "testing" ) func TestComposeCommands(t *testing.T) { @@ -32,7 +31,7 @@ func TestComposeCommands(t *testing.T) { bp := blueprint.Blueprint{ Name: "empty", Description: "Test blueprint in toml format", - Packages: []blueprint.Package{{Name: "bash", Version: "*"}}, + Packages: []blueprint.Package{{Name: "bash", Version: "*"}}, } pushBlueprint(t, &bp) defer deleteBlueprint(t, &bp) @@ -181,6 +180,11 @@ func buildCompose(t *testing.T, bpName string, outputType string) uuid.UUID { logs := getLogs(t, uuid) assert.NotEmpty(t, logs, "logs are empty after the build is finished/failed") + // A sanity check for logs - every log for a compose should contain at + // least one mention of org.osbuild.rpm stage. + // This check should prevent bugs where we lose logs for all stages. + assert.Contains(t, logs, "org.osbuild.rpm") + if !assert.Equalf(t, "FINISHED", status, "Unexpected compose result: %s", status) { log.Print("logs from the build: ", logs) t.FailNow()