Merge pull request #9279 from abel-von/remove-validate-mode
sandbox: remove ValidateMode as it is not used
This commit is contained in:
commit
e3c3478cb6
@ -422,16 +422,3 @@ func loadBaseOCISpecs(config *criconfig.Config) (map[string]*oci.Spec, error) {
|
|||||||
|
|
||||||
return specs, nil
|
return specs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateMode validate the given mod value,
|
|
||||||
// returns err if mod is empty or unknown
|
|
||||||
func ValidateMode(modeStr string) error {
|
|
||||||
switch modeStr {
|
|
||||||
case string(criconfig.ModePodSandbox), string(criconfig.ModeShim):
|
|
||||||
return nil
|
|
||||||
case "":
|
|
||||||
return fmt.Errorf("empty sandbox controller mode")
|
|
||||||
default:
|
|
||||||
return fmt.Errorf("unknown sandbox controller mode: %s", modeStr)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -82,17 +82,3 @@ func TestLoadBaseOCISpec(t *testing.T) {
|
|||||||
assert.Equal(t, "1.0.2", out.Version)
|
assert.Equal(t, "1.0.2", out.Version)
|
||||||
assert.Equal(t, "default", out.Hostname)
|
assert.Equal(t, "default", out.Hostname)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestValidateMode(t *testing.T) {
|
|
||||||
mode := ""
|
|
||||||
assert.Error(t, ValidateMode(mode))
|
|
||||||
|
|
||||||
mode = "podsandbox"
|
|
||||||
assert.NoError(t, ValidateMode(mode))
|
|
||||||
|
|
||||||
mode = "shim"
|
|
||||||
assert.NoError(t, ValidateMode(mode))
|
|
||||||
|
|
||||||
mode = "nonexistent"
|
|
||||||
assert.Error(t, ValidateMode(mode))
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user