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

MDBF-807 - Setup for PAM tests in buildbot #600

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

RazvanLiviuVarzaru
Copy link
Collaborator

@RazvanLiviuVarzaru RazvanLiviuVarzaru commented Oct 22, 2024

  • configure install builders to perform PAM tests. RPM and DEB.
  • migrate pam test script from old - bb:
    • no need to create a new user. We have buildbot user.
    • PAM v1 & v2 are configured and the auth is tested with the buildbot user.
    • the user should not be able to login after the plugin is uninstalled
    • perform MTR pam test in suite=plugins

- configure install builders to perform PAM tests. RPM and DEB.
- migrate pam test script from old - bb:
  - no need to create a new user. We have buildbot user.
  - PAM v1 & v2 are configured and the auth is tested with the buildbot user.
  - the user should not be able to login after the plugin is uninstalled
  - perform MTR pam test in suite=plugins
# MTR
#----------------

cd /usr/share/mysql-test || cd /usr/share/mariadb-test || cd /usr/share/mysql/mysql-test || cd /usr/share/mariadb/mariadb-test
Copy link
Collaborator

Choose a reason for hiding this comment

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

hmm this is confusing an does not look clean, what about something like:

# PATH can differ between MariaDB versions and distros
for db in mysql mariadb; do
  for dir in \
    /usr/share/$db-test \
    /usr/share/$db/$db-test; do
    [[ -d "$dir" ]] && cd "$dir"
  done
done

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure, I'll try it out. Much cleaner, thanks!


cd /usr/share/mysql-test || cd /usr/share/mariadb-test || cd /usr/share/mysql/mysql-test || cd /usr/share/mariadb/mariadb-test

if test -f suite/plugins/pam/pam_mariadb_mtr.so; then
Copy link
Collaborator

Choose a reason for hiding this comment

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

Old syntax and not efficient, use bash builtin commands:

if [[ -f suite/plugins/pam/pam_mariadb_mtr.so ]]; then
  [...]
fi

See: https://google.github.io/styleguide/shellguide.html#test----and---

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, will fix!


if test -f suite/plugins/pam/pam_mariadb_mtr.so; then
for p in /lib*/security /lib*/*/security ; do
test -f "$p/pam_unix.so" && sudo cp -v suite/plugins/pam/pam_mariadb_mtr.so "$p"/
Copy link
Collaborator

Choose a reason for hiding this comment

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

same comment:

[[ -f "$p/pam_unix.so" ]] && sudo cp -v suite/plugins/pam/pam_mariadb_mtr.so "$p"/


set +e

if [ "$res" != "0" ] ; then
Copy link
Collaborator

Choose a reason for hiding this comment

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

Numerical comparison is done with the following:

if ((res != 0)); then
  [...]
fi

see: https://google.github.io/styleguide/shellguide.html#testing-strings

However, be careful when using < and > in [[ … ]] which performs a lexicographical comparison. Use (( … )) or -lt and -gt for numerical comparison.

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

Successfully merging this pull request may close these issues.

3 participants