File 0002-o-devicestate-fix-unit-test-failure-when-host-snapd-.patch of Package snapd

From d6f1047c212416ab216c09b1e9be758bf28bb934 Mon Sep 17 00:00:00 2001
Message-ID: <d6f1047c212416ab216c09b1e9be758bf28bb934.1716465445.git.maciej.borzecki@canonical.com>
From: Maciej Borzecki <maciej.borzecki@canonical.com>
Date: Mon, 13 May 2024 15:42:24 +0200
Subject: [PATCH] o/devicestate: fix unit test failure when host snapd isn't
 running

The install mode unit tests block unexpectedly when snapd on the host isn't
running. This is caused by missing mocking, so the `snap changes` command called
at the end of the installation process was hitting the actual snapd process
runnig on the host machine.

Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
---
 overlord/devicestate/devicestate_install_mode_test.go | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/overlord/devicestate/devicestate_install_mode_test.go b/overlord/devicestate/devicestate_install_mode_test.go
index e778d32c81ce4d7e0799920b2c90835e0a76ecc8..f9a3f156546203896f87426a95a8eeca0ed64379 100644
--- a/overlord/devicestate/devicestate_install_mode_test.go
+++ b/overlord/devicestate/devicestate_install_mode_test.go
@@ -127,6 +127,9 @@ func (s *deviceMgrInstallModeSuite) SetUpTest(c *C) {
 		return &fakeSeed{}, nil
 	})
 	s.AddCleanup(restore)
+
+	mcmd := testutil.MockCommand(c, "snap", "echo 'snap is not mocked'; exit 1")
+	s.AddCleanup(mcmd.Restore)
 }
 
 const (
-- 
2.45.1

openSUSE Build Service is sponsored by