diff options
| author | Julia Kreger <juliaashleykreger@gmail.com> | 2023-05-02 17:24:57 -0700 |
|---|---|---|
| committer | Julia Kreger <juliaashleykreger@gmail.com> | 2023-05-02 17:24:57 -0700 |
| commit | c05fdf790c3cab6a18ca5b264e258c5c0016918d (patch) | |
| tree | 013355d90d3b232c3aff6d38d7b709e18e9c2b43 /ironic_python_agent/tests/unit/extensions | |
| parent | f37ea85a2765a9fac580dc031bcf16b3a4e45d98 (diff) | |
| download | ironic-python-agent-c05fdf790c3cab6a18ca5b264e258c5c0016918d.tar.gz | |
Fix checksum validation logic
The checksum validation logic, which was updated early on in the
whole process of deprecating md5, didn't account for a URL *or* a
longer checksum (i.e. sha256/sha512) which was decided while the
overall approach was being decided.
Fixes the logic, and adds additional tests.
Change-Id: Ic4053776e131fc02ace295a1e69e9f9faab47f42
Diffstat (limited to 'ironic_python_agent/tests/unit/extensions')
| -rw-r--r-- | ironic_python_agent/tests/unit/extensions/test_standby.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/ironic_python_agent/tests/unit/extensions/test_standby.py b/ironic_python_agent/tests/unit/extensions/test_standby.py index fee5ad30..9f5a354b 100644 --- a/ironic_python_agent/tests/unit/extensions/test_standby.py +++ b/ironic_python_agent/tests/unit/extensions/test_standby.py @@ -108,6 +108,20 @@ class TestStandbyExtension(base.IronicAgentTest): del image_info['os_hash_value'] standby._validate_image_info(None, image_info) + def test_validate_image_info_url(self): + image_info = _build_fake_image_info() + image_info['checksum'] = 'https://fake.url' + del image_info['os_hash_algo'] + del image_info['os_hash_value'] + standby._validate_image_info(None, image_info) + + def test_validate_image_info_sha256(self): + image_info = _build_fake_image_info() + image_info['checksum'] = 'a' * 64 + del image_info['os_hash_algo'] + del image_info['os_hash_value'] + standby._validate_image_info(None, image_info) + def test_validate_image_info_legacy_md5_checksum(self): image_info = _build_fake_image_info() del image_info['os_hash_algo'] |
