test/cli: add a sanity check for Weldr logs

To prevent the issue fixed by the previous commit.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
Ondřej Budai 2021-03-19 16:23:45 +01:00 committed by Ondřej Budai
parent ae2e549dd4
commit 334f421927

View file

@ -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()