Skip to content

Commit 1ceca9e

Browse files
author
Dongsu Park
committed
validation: use rfcError instead of specerror
Now that a new helper `NewRFCError()` is available, we should make use of the helper instead of `specerror.NewError()`. This way, we can avoid doing multiple casts to be able to get rfcError. Signed-off-by: Dongsu Park <[email protected]>
1 parent a90cd2b commit 1ceca9e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

validation/linux_ns_path.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,16 @@ func main() {
181181
err := testNamespacePath(t, c.name, c.unshareOpt)
182182
t.Ok(err == nil, fmt.Sprintf("set %s namespace by path", c.name))
183183
if err != nil {
184-
specErr := specerror.NewError(specerror.NSProcInPath, err, rspec.Version)
184+
rfcError, errRfc := specerror.NewRFCError(specerror.NSProcInPath, err, rspec.Version)
185+
if errRfc != nil {
186+
continue
187+
}
185188
diagnostic := map[string]string{
186189
"actual": fmt.Sprintf("err == %v", err),
187190
"expected": "err == nil",
188191
"namespace type": c.name,
189-
"level": specErr.(*specerror.Error).Err.Level.String(),
190-
"reference": specErr.(*specerror.Error).Err.Reference,
192+
"level": rfcError.Level.String(),
193+
"reference": rfcError.Reference,
191194
}
192195
t.YAML(diagnostic)
193196
}

0 commit comments

Comments
 (0)