Closed ruda closed 4 months ago
Merging #435 (ea0f293) into main (eed0bd2) will not change coverage. The diff coverage is
n/a
.
@@ Coverage Diff @@
## main #435 +/- ##
=======================================
Coverage 79.11% 79.11%
=======================================
Files 5 5
Lines 249 249
=======================================
Hits 197 197
Misses 52 52
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more
This is really a problem only for a single test, test_update_password_to_sshkeyfile
, but I'm not a fan how it calls skip
in the middle of a test, when part of a setup was already done.
I feel the cleaner solution would be to use pytest.marker.skipif
decorator with a function. Function would create new DataProvider instance (unfortunately you can't use fixture) and call data_provider.credentials.new_one({"type": "network", "sshkeyfile": Table.is_not_null()}, data_only=True)
(this ensures no credential is created on server side). If that call raised an exception, then return True
. Otherwise, return False
and let the test run.
Alternatively, a function could import settings
and iterate over credentials to check if there is any with ssh key definition.
I wonder what is the level of effort needed to revert this and use decorator instead? If it's half a day of work, then I guess we should stick to what we have. Maybe only move data_provider
call to beginning of setup in test_update_password_to_sshkeyfile
.
Yeah, by using the decorator it will be a better solution. I going to keep this PR, until I have another one with the improved implementation.
I was working with a minimal configuration file for Camayoc and notice that if the sshkeyfile in any credential configuration is missing, then some of the tests will fail with a misleading message.
I'm creating this PR to skip some of credentials and sources tests if sshkeyfile is missing in configuration.
Example.
Before:
After: