Skip to content

Conversation

@james-garner-canonical
Copy link
Contributor

Description

create_secret_data unnecessarily attempts to strip trailing = symbols from secret data, and inadvertently strips all trailing P, Q and = characters instead. This PR drops the unnecessary removal of trailing characters, and adds unit tests covering cases that would previously have been handled badly (as well as some test cases validating existing behaviour that wasn't covered).

Fixes: #1275

QA Steps

Unit test should pass. Locally I have tests/unit/test_jujudata.py::TestJujuData::test_verify_controller_uninitialized failing both on main and on this branch.

@james-garner-canonical james-garner-canonical force-pushed the 2025-07/fix/create-secret-data-splitting branch from c86a5af to 6bbba9c Compare July 10, 2025 22:18
@james-garner-canonical james-garner-canonical force-pushed the 2025-07/fix/create-secret-data-splitting branch from 6bbba9c to 154c7c2 Compare July 10, 2025 22:20

data = create_secret_data(["key1=value1", f"key2#file={file_path}"])

self.assertDictEqual(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just changing to assert data ==, which results in dedenting the assertion data.

from juju.secrets import create_secret_data, read_secret_data


class TestCreateSecretData(unittest.TestCase):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop mostly unused unittest.TestCase base class so that pytest.mark.parametrize can work.

Copy link
Contributor

@dimaqq dimaqq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM

let’s get clarity on failing integration tests vs main

@james-garner-canonical
Copy link
Contributor Author

Manual run on main in progress, let's see how it goes.

@james-garner-canonical
Copy link
Contributor Author

Summary: it's the same on main.


The non-quarantined integration test failures in this branch are all with Juju 3.3. #1267 noted multiple test failures in main with 3.3 specifically in May this year and #1269 proposed to drop 3.3 from without pushback (still unmerged due to ideas of dropping more). The same failures are present on main (and actually we get an extra failure on main in one case, which I suspect is just random flakiness rather than anything to do with this PR).

Quarantined integration tests are failing test_relate on all Juju versions other than 3.1. The jobs are still running on main, but that specific test has already failed (3.3, 3.4, 3.5, 3.6). I've opened #1277 to document the test_relate failure.

Additionally, several more quarantined integration tests fail on 3.3 specifically (3.4, 3.5, and 3.6 only fail test_relate). This is also the case on main.

@james-garner-canonical
Copy link
Contributor Author

/merge

@jujubot jujubot merged commit a88316f into juju:main Jul 10, 2025
22 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

create_secret_data() strips valid trailing characters from secret values

3 participants