Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create_key test: add missing tests #132

Merged
merged 2 commits into from
Jun 22, 2019

Conversation

kyrofa
Copy link
Member

@kyrofa kyrofa commented Jun 20, 2019

In preparation for future work, this PR adds a few tests that are missing from create_key, specifically tests that verify the request.cnf, permissions.p7s, governance.p7s, and ecdsaparam.

Also rework test module to use module fixtures and multiple smaller test cases instead of one large one. This makes it easier to add more, and makes test failures more meaningful.

cc @jacobperron, @emersonknapp

In preparation for future work, add a few tests that are missing from
`create_key`, specifically tests that verify the request.cnf,
permissions.p7s, governance.p7s, and ecdsaparam.

Also rework test module to use module fixtures and multiple smaller test
cases instead of one large one. This makes it easier to add more, and
makes test failures more meaningful.

Signed-off-by: Kyle Fazzari <kyle@canonical.com>
Signed-off-by: Kyle Fazzari <kyle@canonical.com>
Copy link
Contributor

@emersonknapp emersonknapp left a comment

Choose a reason for hiding this comment

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

nice - splitting tests out is a good idea

Copy link
Member

@jacobperron jacobperron left a comment

Choose a reason for hiding this comment

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

LGTM

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@jacobperron jacobperron merged commit 4598535 into ros2:master Jun 22, 2019
from sros2.api import create_keystore


# This fixture will run once for the entire module (as opposed to once per test)
@pytest.fixture(scope='module')
def node_keys_dir(tmp_path_factory):
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Well that's an interesting failure. This is a built-in pytest fixture. Any chance the version of pytest differs between those two tests?

Copy link
Member

Choose a reason for hiding this comment

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

I faced multiple issues about mismatching versions of pytest recently. My guess is that one of these jobs installs a recent pytest from pip and the other one an older version from apt

Copy link
Member

Choose a reason for hiding this comment

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

That is certainly the case: one uses the Debian package from Ubuntu Bionic, the other uses the latest release (currently we pinned 4.x instead of using 5 - but that is a different reason). So the code should work with either of the versions.

Copy link
Member Author

@kyrofa kyrofa Jul 17, 2019

Choose a reason for hiding this comment

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

Good theory, the one from apt may need to also install python3-pytest-tempdir (total guess based on the name, but seems plausible).

Copy link
Member

Choose a reason for hiding this comment

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

Good theory, the one from apt may need to also install python3-pytest-tempdir (total guess based on the name, but seems plausible).

👍 that would make sense. To do so it will need to be listed as a test dependency in sros2's package.xml and added to the rosdep database for rosdep to resolve it properly.

Copy link
Member Author

@kyrofa kyrofa Jul 17, 2019

Choose a reason for hiding this comment

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

Yeah, too bad they're split out like that 🤷‍♂️ . Let me confirm the theory and I'll take care of it if that happens to be the case. @dirk-thomas, is there a way to run the failing test on a pull request instead of the one that passes? Can we do something to bring those testbeds more closely inline with each other?

Copy link
Member

Choose a reason for hiding this comment

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

is there a way to run the failing test on a pull request instead of the one that passes?

The master branch (which will become Eloquent) doesn't have PR jobs yet. So there is no automated way to do that. If you make a PR we can manually trigger a job for it (http://build.ros2.org/view/Eci/job/Eci__overlay_ubuntu_bionic_amd64/).

Can we do something to bring those testbeds more closely inline with each other?

Not easily - both systems are designed for very different cases and therefore intentionally using different dependencies (Debian packages vs. latest).

Copy link
Member Author

@kyrofa kyrofa Jul 17, 2019

Choose a reason for hiding this comment

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

Nope, I was wrong. python3-pytest-tempdir is not required. Apparently, despite it not being present in the changelog, tmp_path_factory wasn't introduced until v4.3.0 of pytest. I'll propose a fix using an older factory.

For what it's worth, it would help avoid these issues if the "install from source" guide installed Debian packages instead of pip. Otherwise issues like this will continue to crop up, with the CI being the limiting factor. Combined with the fact that these jobs don't seem to be the ones that are typically run on PRs, it means we'll continue to catch these issues only after they land, which isn't ideal.

Copy link
Member Author

Choose a reason for hiding this comment

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

PR is up at #145.

@kyrofa kyrofa deleted the feature/missing_create_key_tests branch July 17, 2019 16:32
ruffsl pushed a commit to ruffsl/sros2 that referenced this pull request Aug 6, 2019
* create_key test: add missing tests

In preparation for future work, add a few tests that are missing from
`create_key`, specifically tests that verify the request.cnf,
permissions.p7s, governance.p7s, and ecdsaparam.

Also rework test module to use module fixtures and multiple smaller test
cases instead of one large one. This makes it easier to add more, and
makes test failures more meaningful.

Signed-off-by: Kyle Fazzari <kyle@canonical.com>

* Remove spurious comment

Signed-off-by: Kyle Fazzari <kyle@canonical.com>
Signed-off-by: ruffsl <roxfoxpox@gmail.com>
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.

5 participants