Fix unit tests for master branch
The recent hooks dir change broke the unit tests, which is now fixed.
@@ -25,6 +25,7 @@ var _ = t.Describe("Config", func() {
sut.NetworkDir = os.TempDir()
sut.LogDir = "/"
sut.Listen = t.MustTempFile("crio.sock")
+ sut.HooksDir = []string{}
return sut
}
@@ -204,11 +205,7 @@ var _ = t.Describe("Config", func() {
It("should succeed during runtime", func() {
// Given
- sut.Runtimes["runc"] = &config.RuntimeHandler{
- RuntimePath: validFilePath,
- RuntimeType: config.DefaultRuntimeType,
- }
- sut.Conmon = validFilePath
+ sut = runtimeValidConfig()
// When
err := sut.RuntimeConfig.Validate(nil, true)
@@ -219,12 +216,8 @@ var _ = t.Describe("Config", func() {
It("should succeed with additional devices", func() {
// Given
+ sut = runtimeValidConfig()
sut.AdditionalDevices = []string{"/dev/null:/dev/null:rw"}
- sut.Runtimes["runc"] = &config.RuntimeHandler{
- RuntimePath: validFilePath,
- RuntimeType: config.DefaultRuntimeType,
- }
- sut.Conmon = validFilePath
// When
err := sut.RuntimeConfig.Validate(nil, true)
@@ -567,10 +560,7 @@ var _ = t.Describe("Config", func() {
It("should succeed during runtime", func() {
// Given
- sut.NetworkConfig.NetworkDir = validDirPath
- tmpDir := path.Join(os.TempDir(), "cni-test")
- sut.NetworkConfig.PluginDirs = []string{tmpDir}
- defer os.RemoveAll(tmpDir)
+ sut = runtimeValidConfig()
// When
err := sut.NetworkConfig.Validate(true)
