mirror of https://github.com/containers/podman.git
quadlet tests: Run the tests even for (exected) failed tests
Otherwise the noimage test doesn't look at the stderr assertion. Signed-off-by: Alexander Larsson <alexl@redhat.com>
This commit is contained in:
parent
8d41c7d2eb
commit
0de98b1b6c
|
@ -174,7 +174,10 @@ func (t *quadletTestcase) doAssert(check []string, unit *parser.UnitFile, sessio
|
||||||
}
|
}
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
s, _ := unit.ToString()
|
s := "(nil)"
|
||||||
|
if unit != nil {
|
||||||
|
s, _ = unit.ToString()
|
||||||
|
}
|
||||||
return fmt.Errorf("Failed assertion for %s: %s\n\n%s", t.serviceName, strings.Join(check, " "), s)
|
return fmt.Errorf("Failed assertion for %s: %s\n\n%s", t.serviceName, strings.Join(check, " "), s)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -189,12 +192,18 @@ func (t *quadletTestcase) check(generateDir string, session *PodmanSessionIntegr
|
||||||
}
|
}
|
||||||
|
|
||||||
file := filepath.Join(generateDir, t.serviceName)
|
file := filepath.Join(generateDir, t.serviceName)
|
||||||
if _, err := os.Stat(file); os.IsNotExist(err) && expectFail {
|
_, err := os.Stat(file)
|
||||||
return // Successful fail
|
if expectFail {
|
||||||
|
Expect(err).To(MatchError(os.ErrNotExist))
|
||||||
|
} else {
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
}
|
}
|
||||||
|
|
||||||
unit, err := parser.ParseUnitFile(file)
|
var unit *parser.UnitFile
|
||||||
Expect(err).To(BeNil())
|
if !expectFail {
|
||||||
|
unit, err = parser.ParseUnitFile(file)
|
||||||
|
Expect(err).To(BeNil())
|
||||||
|
}
|
||||||
|
|
||||||
for _, check := range t.checks {
|
for _, check := range t.checks {
|
||||||
err := t.doAssert(check, unit, session)
|
err := t.doAssert(check, unit, session)
|
||||||
|
|
Loading…
Reference in New Issue