From 2881ef86a68cd2a0f180653ea557c0f42dad354e Mon Sep 17 00:00:00 2001 From: Sam Batschelet Date: Tue, 23 Jan 2024 23:38:50 -0500 Subject: [PATCH] daemon: fixup tests Signed-off-by: Sam Batschelet --- pkg/daemon/daemon_test.go | 1 + pkg/daemon/update_test.go | 8 ++++++++ pkg/daemon/upgrade_monitor_test.go | 1 + 3 files changed, 10 insertions(+) diff --git a/pkg/daemon/daemon_test.go b/pkg/daemon/daemon_test.go index 50101a8c45..961cc81559 100644 --- a/pkg/daemon/daemon_test.go +++ b/pkg/daemon/daemon_test.go @@ -156,6 +156,7 @@ func (f *fixture) newController() *Daemon { i.Machineconfiguration().V1().MachineConfigs(), k8sI.Core().V1().Nodes(), i.Machineconfiguration().V1().ControllerConfigs(), + i.Machineconfiguration().V1().PinnedImageSets(), false, "", d.featureGatesAccessor, diff --git a/pkg/daemon/update_test.go b/pkg/daemon/update_test.go index 70363d852c..bed862c58a 100644 --- a/pkg/daemon/update_test.go +++ b/pkg/daemon/update_test.go @@ -666,6 +666,8 @@ func TestCalculatePostConfigChangeAction(t *testing.T) { "policy2": ctrlcommon.NewIgnFile("/etc/containers/policy.json", "policy2"), "containers-gpg1": ctrlcommon.NewIgnFile("/etc/machine-config-daemon/no-reboot/containers-gpg.pub", "containers-gpg1"), "containers-gpg2": ctrlcommon.NewIgnFile("/etc/machine-config-daemon/no-reboot/containers-gpg.pub", "containers-gpg2"), + "pinned-images1": ctrlcommon.NewIgnFile("/etc/crio/crio.conf.d/01-pinned-images", "image set 1"), + "pinned-images2": ctrlcommon.NewIgnFile("/etc/crio/crio.conf.d/01-pinned-images", "image set 2"), } tests := []struct { @@ -745,6 +747,12 @@ func TestCalculatePostConfigChangeAction(t *testing.T) { newConfig: helpers.NewMachineConfig("01-test", nil, "dummy://", []ign3types.File{files["containers-gpg2"]}), expectedAction: []string{postConfigChangeActionReloadCrio}, }, + { + // test that updating pinned-images is crio reload + oldConfig: helpers.NewMachineConfig("00-test", nil, "dummy://", []ign3types.File{files["pinned-images1"]}), + newConfig: helpers.NewMachineConfig("01-test", nil, "dummy://", []ign3types.File{files["pinned-images2"]}), + expectedAction: []string{postConfigChangeActionReloadCrio}, + }, } for idx, test := range tests { diff --git a/pkg/daemon/upgrade_monitor_test.go b/pkg/daemon/upgrade_monitor_test.go index a9f72c69fa..a639ac6972 100644 --- a/pkg/daemon/upgrade_monitor_test.go +++ b/pkg/daemon/upgrade_monitor_test.go @@ -128,6 +128,7 @@ func (tc upgradeMonitorTestCase) run(t *testing.T) { i.Machineconfiguration().V1().MachineConfigs(), k8sI.Core().V1().Nodes(), i.Machineconfiguration().V1().ControllerConfigs(), + i.Machineconfiguration().V1().PinnedImageSets(), false, "", fgAccess,