mirror of
https://gitlab.com/TECHNOFAB/nixtest.git
synced 2025-12-13 02:30:13 +01:00
fix: allow snapshots to use actualDrv aswell
This commit is contained in:
parent
482f15c486
commit
abac8aaf3e
3 changed files with 21 additions and 11 deletions
|
|
@ -88,8 +88,17 @@ func runTest(spec TestSpec) TestResult {
|
|||
var actual any
|
||||
var expected any
|
||||
|
||||
if spec.Type == "snapshot" {
|
||||
if spec.ActualDrv != "" {
|
||||
var err error
|
||||
actual, err = buildAndParse(spec.ActualDrv)
|
||||
if err != nil {
|
||||
result.Error = fmt.Sprintf("[system] failed to parse drv output: %v", err.Error())
|
||||
goto end
|
||||
}
|
||||
} else {
|
||||
actual = spec.Actual
|
||||
}
|
||||
if spec.Type == "snapshot" {
|
||||
filePath := path.Join(
|
||||
*snapshotDir,
|
||||
fmt.Sprintf("%s.snap.json", strings.ToLower(spec.Name)),
|
||||
|
|
@ -111,16 +120,6 @@ func runTest(spec TestSpec) TestResult {
|
|||
goto end
|
||||
}
|
||||
} else if spec.Type == "unit" {
|
||||
if spec.ActualDrv != "" {
|
||||
var err error
|
||||
actual, err = buildAndParse(spec.ActualDrv)
|
||||
if err != nil {
|
||||
result.Error = fmt.Sprintf("[system] failed to parse drv output: %v", err.Error())
|
||||
goto end
|
||||
}
|
||||
} else {
|
||||
actual = spec.Actual
|
||||
}
|
||||
expected = spec.Expected
|
||||
} else {
|
||||
log.Panic().Str("type", spec.Type).Msg("Invalid test type")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue