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

Enable unit tests for Python 2.6 & 3.4 on Github Actions #3296

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

narrieta
Copy link
Member

@narrieta narrieta commented Jan 10, 2025

The PR also
* removes unnecessary dependency on hashlib
* updates the Azure Pipeline for unit tests to use Ubuntu 24
* patches the Python virtual environments used for unit tests to run on Ubuntu > 16

@@ -385,19 +384,6 @@ def is_str_empty(s):
return is_str_none_or_whitespace(s) or is_str_none_or_whitespace(s.rstrip(' \t\r\n\0'))


def hash_strings(string_list):
Copy link
Member Author

Choose a reason for hiding this comment

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

hash_strings was being used only by the Monitor thread. It has a dependency on hashlib/OpenSSL. The Monitor thread does not really need a cryptographic hash, so I replaced it with Python's own hash function.

@@ -411,8 +411,12 @@ def emulate_assertListEqual(self, seq1, seq2, msg=None, seq_type=None):
diffMsg = '\n' + '\n'.join(
difflib.ndiff(pprint.pformat(seq1).splitlines(),
pprint.pformat(seq2).splitlines()))
standardMsg = self._truncateMessage(standardMsg, diffMsg)
msg = self._formatMessage(msg, standardMsg)
# _truncateMessage and _formatMessage are not defined on Python 2.6; output the entire diff in that case
Copy link
Member Author

@narrieta narrieta Jan 10, 2025

Choose a reason for hiding this comment

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

This issue has always been here. The only reason I noticed it is because a test that uses assertListEqual failed for an unrelated issue and this code raised an exception.

useradd --shell /bin/bash --create-home -g waagent waagent
curl -sSf --retry 5 -o /tmp/python-${PYTHON_VERSION}.tar.bz2 https://dcrdata.blob.core.windows.net/python/python-${PYTHON_VERSION}.tar.bz2
tar xjf /tmp/python-${PYTHON_VERSION}.tar.bz2 --directory /
chown -R waagent:waagent /home/waagent # The UID:GID in the tarball may not match those of the user, so we need to fix that.
Copy link
Member Author

@narrieta narrieta Jan 10, 2025

Choose a reason for hiding this comment

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

Ubuntu 24 has a new user, ubuntu, with PID 1000 so now the PID in the tarball does not match waagent's (which now gets 1001)

@narrieta narrieta changed the title Use Ubuntu 24 for unit tests runs [Python 2.6 & 3.4] Enable unit tests for Python 2.6 & 3.4 on Github Actions Jan 10, 2025
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.

1 participant