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

Fix upgrade_through_versions_test.py::TestUpgrade* tests #228

Closed

Conversation

michaelsembwever
Copy link
Member

Run generated upgrade_through_versions_test on pytest >7.2.0
pytest-7.2.0 changed how markers were inherited, pytest-dev/pytest#7792

Remove how internode_ssl was changing seeds to append the ssl storage port, it's not needed as the tests always already set enable_legacy_ssl_storage_port to true.

Run generated upgrade_through_versions_test on pytest >7.2.0
pytest-7.2.0 changed how markers were inherited, pytest-dev/pytest#7792

Remove how internode_ssl was changing seeds to append the ssl storage port, it's not needed as the tests always already set enable_legacy_ssl_storage_port to true.

 patch by Mick Semb Wever; reviewed by Brandon Williams for CASSANDRA-18499
@@ -325,6 +326,8 @@ def fixture_add_additional_log_patterns(self, fixture_dtest_setup):
)

def prepare(self):
if type(self).__name__ == "TestUpgrade":
Copy link
Contributor

Choose a reason for hiding this comment

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

I like this change


def current_env_java_version():
java_command = os.path.join(os.environ['JAVA_HOME'], 'bin', 'java')
output = subprocess.check_output([java_command, '-version'], stderr=subprocess.STDOUT).decode('utf-8')
Copy link
Contributor

Choose a reason for hiding this comment

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

this is already implemented:

    from ccmlib.common import get_jdk_version_int
    return get_jdk_version_int(java_command)



def current_env_java_version():
java_command = os.path.join(os.environ['JAVA_HOME'], 'bin', 'java')
Copy link
Contributor

Choose a reason for hiding this comment

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

please fail somewhere with a clear message when JAVA_HOME is not defined

Copy link
Member Author

Choose a reason for hiding this comment

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

not needed, see update.

# replace matching meta with current version
for idx, meta in enumerate(metas):
if meta.matches_current_env_version_family:
java_version = current_env_java_version()
Copy link
Contributor

Choose a reason for hiding this comment

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

we should get that java version once and do not do that in every iteration in a loop

Copy link
Member Author

Choose a reason for hiding this comment

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

it should only called once, i was missing a break

Copy link
Contributor

@jacek-lewandowski jacek-lewandowski left a comment

Choose a reason for hiding this comment

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

You should also make sure to skip the entire test if say we run with j17 and the upgrade path ends up with a single version

create_upgrade_class(upgrade.name, [m for m in metas], protocol_version=upgrade.protocol_version, extra_config=upgrade.extra_config)
else:
# even for RUN_STATIC_UPGRADE_MATRIX we only test upgrade paths jdk compatible with the end "indev_" version (or any JAVA<jdk_version>_HOME defined)
metas = jdk_compatible_steps(upgrade.version_metas)
Copy link
Contributor

Choose a reason for hiding this comment

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

you are still calling current_env_java_version() in a loop

Copy link
Member Author

Choose a reason for hiding this comment

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

oh, your talking about the outer loop for upgrade in MULTI_UPGRADES:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants