Added a unit test case for the change in the if-else logic of func isSafeContainerRegistryConfChanges
@@ -235,6 +235,31 @@ unqualified-search-registries = ["example.com", "foo.com"]
[[registry]]
prefix = ""
location = "example.com/repo/test-img"
+`))),
+ },
+ },
+ }}),
+ "mc11": helpers.NewMachineConfig("11-test", nil, "dummy://", []ign3types.File{{
+ Node: ign3types.Node{
+ Path: "/etc/containers/registries.conf",
+ },
+ FileEmbedded1: ign3types.FileEmbedded1{
+ Contents: ign3types.Resource{
+ Source: helpers.StrToPtr(dataurl.EncodeBytes([]byte(`
+unqualified-search-registries = ["example.com", "foo.com"]
+
+[[registry]]
+prefix = ""
+location = "example.com/repo1/test-img"
+mirror-by-digest-only = true
+
+[[registry.mirror]]
+location = "mirror.com/repo1/test-img"
+
+[[registry]]
+prefix = "bar.com"
+location = "example.com/repo/test-img"
+blocked = true
`))),
},
},
@@ -297,6 +322,13 @@ location = "example.com/repo/test-img"
newConfig: machineConfigs["mc2"],
expectedAction: false,
},
+ {
+ // skip drain: only new mirrors are added to registry with mirror-by-digest-only=true while existing registries with mirror-by-digest-only=false are unchanged
+ actions: []string{postConfigChangeActionReloadCrio},
+ oldConfig: machineConfigs["mc9"],
+ newConfig: machineConfigs["mc11"],
+ expectedAction: false,
+ },
{
// perform drain: only new mirrors got added to the registry with mirror-by-digest-only set to false for registry
actions: []string{postConfigChangeActionReloadCrio},
