summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/tests/test_persistence.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/cloudinit/tests/test_persistence.py b/cloudinit/tests/test_persistence.py
index 7b64ced9..3e5eaa8d 100644
--- a/cloudinit/tests/test_persistence.py
+++ b/cloudinit/tests/test_persistence.py
@@ -99,6 +99,16 @@ class VersionDefaultsToZero(CloudInitPickleMixin, metaclass=_Collector):
assert 0 == ci_pkl_version
+class VersionIsPoppedFromState(CloudInitPickleMixin, metaclass=_Collector):
+ """Test _ci_pkl_version is popped from state before being restored."""
+
+ def _unpickle(self, ci_pkl_version: int) -> None:
+ # `self._ci_pkl_version` returns the type's _ci_pkl_version if it isn't
+ # in instance state, so we need to explicitly check self.__dict__.
+ sentinel = mock.sentinel.default
+ assert self.__dict__.get("_ci_pkl_version", sentinel) == sentinel
+
+
class TestPickleMixin:
def test_unpickle_called(self):
"""Test that self._unpickle is called on unpickle."""