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

[PR #452/8107530 backport][stable-2] Sync GHA workflow w/ the collection template #453

Conversation

laurent-indermuehle
Copy link
Collaborator

  • Sync GHA workflow w/ the collection template

  • Drop the trailing pre-cmd semicolon

  • Recover missing -e flag of sed

  • Use relative paths for version configs

  • Unquote env.connector_version_file

  • Use string formatting to fix the substitution problem

(cherry picked from commit 8107530)

SUMMARY

This backport-2 needed a manual merge resolution.

ISSUE TYPE
  • Bugfix Pull Request
  • Docs Pull Request
  • Feature Pull Request
  • New Module Pull Request
COMPONENT NAME
ADDITIONAL INFORMATION

@codecov
Copy link

codecov bot commented Oct 3, 2022

Codecov Report

Merging #453 (79046a8) into stable-2 (826e9c7) will decrease coverage by 19.42%.
The diff coverage is n/a.

@@              Coverage Diff              @@
##           stable-2     #453       +/-   ##
=============================================
- Coverage     75.88%   56.45%   -19.43%     
=============================================
  Files            26       12       -14     
  Lines          2297     1750      -547     
  Branches        540      443       -97     
=============================================
- Hits           1743      988      -755     
- Misses          381      606      +225     
+ Partials        173      156       -17     
Flag Coverage Δ
integration 56.45% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
plugins/modules/mysql_db.py 34.14% <0.00%> (-40.77%) ⬇️
plugins/module_utils/mysql.py 49.39% <0.00%> (-33.74%) ⬇️
plugins/modules/mysql_query.py 60.21% <0.00%> (-30.11%) ⬇️
plugins/modules/mysql_role.py 49.32% <0.00%> (-29.20%) ⬇️
plugins/modules/mysql_info.py 65.32% <0.00%> (-14.58%) ⬇️
plugins/module_utils/user.py 75.88% <0.00%> (-5.76%) ⬇️
plugins/module_utils/_version.py 36.36% <0.00%> (-5.46%) ⬇️
plugins/modules/mysql_variables.py
tests/unit/plugins/modules/test_mysql_info.py
...s/module_utils/test_mariadb_user_implementation.py
... and 14 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@laurent-indermuehle
Copy link
Collaborator Author

mmh, not sure if something changed in GHA, but I can't deploy the full log to see what failed.
In the meantime, I will run the tests on my desktop.

@Andersson007
Copy link
Collaborator

hm, all the integration tests fail. I backported another PR to stable-1 and stable-2 today and everything was green there.. Let's close and re-open it

@Andersson007 Andersson007 reopened this Oct 4, 2022
@Andersson007
Copy link
Collaborator

it shows in logs now:

2022-10-03T13:11:34.7949022Z TASK [test_mysql_db : Dump existing databases] *********************************
2022-10-03T13:11:35.1758722Z �[0;31mfatal: [testhost]: FAILED! => {"changed": false, "msg": "mysqldump: [Warning] Using a password on the command line interface can be insecure.\nmysqldump: Got error: 1556: You can't use locks with log tables when using LOCK TABLES\n"}�[0m
2022-10-03T13:15:34.4372679Z TASK [test_mysql_replication : Create user for replication] ********************
2022-10-03T13:15:34.7596270Z �[0;31mfatal: [testhost]: FAILED! => {"changed": true, "cmd": "echo \"CREATE USER 'replication_user'@'localhost' IDENTIFIED WITH mysql_native_password BY 'replication_pass'; GRANT REPLICATION SLAVE ON *.* TO 'replication_user'@'localhost';\" | mysql -uroot -pmsandbox --protocol=tcp -P3307", "delta": "0:00:00.008683", "end": "2022-10-03 13:15:34.732075", "msg": "non-zero return code", "rc": 1, "start": "2022-10-03 13:15:34.723392", "stderr": "mysql: [Warning] Using a password on the command line interface can be insecure.\nERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'BY 'replication_pass'' at line 1", "stderr_lines": ["mysql: [Warning] Using a password on the command line interface can be insecure.", "ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'BY 'replication_pass'' at line 1"], "stdout": "", "stdout_lines": []}�[0m
2022-10-03T13:15:34.7640416Z 
2022-10-03T13:15:34.7640652Z PLAY RECAP *********************************************************************
2022-10-03T13:15:34.7641373Z �[0;31mtesthost�[0m                   : �[0;32mok=33  �[0m �[0;33mchanged=3   �[0m unreachable=0    �[0;31mfailed=1   �[0m �[0;36mskipped=1   �[0m rescued=0    ignored=0
2022-10-03T13:15:51.3646280Z TASK [test_mysql_replication : Create user for replication] ********************
2022-10-03T13:15:51.3647564Z �[1;30mtask path: /root/ansible_collections/community/mysql/tests/output/.tmp/integration/test_mysql_replication-eugt0n4_-ÅÑŚÌβŁÈ/tests/integration/targets/test_mysql_replication/tasks/mysql_replication_initial.yml:33�[0m
2022-10-03T13:15:51.4596118Z �[0;34m<testhost> ESTABLISH LOCAL CONNECTION FOR USER: root�[0m
2022-10-03T13:15:51.4596562Z �[0;34m<testhost> EXEC /bin/sh -c 'echo ~root && sleep 0'�[0m
2022-10-03T13:15:51.4654061Z �[0;34m<testhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1664802951.4644186-27842-233491768306314 `" && echo ansible-tmp-1664802951.4644186-27842-233491768306314="` echo /root/.ansible/tmp/ansible-tmp-1664802951.4644186-27842-233491768306314 `" ) && sleep 0'�[0m
2022-10-03T13:15:51.4755726Z �[0;34mUsing module file /root/ansible/lib/ansible/modules/command.py�[0m
2022-10-03T13:15:51.4762317Z �[0;34m<testhost> PUT /root/.ansible/tmp/ansible-local-27042kfk6uza7/tmpo2exjamh TO /root/.ansible/tmp/ansible-tmp-1664802951.4644186-27842-233491768306314/AnsiballZ_command.py�[0m
2022-10-03T13:15:51.4769217Z �[0;34m<testhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1664802951.4644186-27842-233491768306314/ /root/.ansible/tmp/ansible-tmp-1664802951.4644186-27842-233491768306314/AnsiballZ_command.py && sleep 0'�[0m
2022-10-03T13:15:51.4822341Z �[0;34m<testhost> EXEC /bin/sh -c '/usr/bin/python3.6 /root/.ansible/tmp/ansible-tmp-1664802951.4644186-27842-233491768306314/AnsiballZ_command.py && sleep 0'�[0m
2022-10-03T13:15:51.6734462Z �[0;34m<testhost> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1664802951.4644186-27842-233491768306314/ > /dev/null 2>&1 && sleep 0'�[0m
2022-10-03T13:15:51.6832729Z �[0;31mfatal: [testhost]: FAILED! => {�[0m
2022-10-03T13:15:51.6833082Z �[0;31m    "changed": true,�[0m
2022-10-03T13:15:51.6833806Z �[0;31m    "cmd": "echo \"CREATE USER 'replication_user'@'localhost' IDENTIFIED WITH mysql_native_password BY 'replication_pass'; GRANT REPLICATION SLAVE ON *.* TO 'replication_user'@'localhost';\" | mysql -uroot -pmsandbox --protocol=tcp -P3307",�[0m
2022-10-03T13:15:51.6834372Z �[0;31m    "delta": "0:00:00.008526",�[0m
2022-10-03T13:15:51.6834672Z �[0;31m    "end": "2022-10-03 13:15:51.655810",�[0m
2022-10-03T13:15:51.6834945Z �[0;31m    "invocation": {�[0m
2022-10-03T13:15:51.6835201Z �[0;31m        "module_args": {�[0m
2022-10-03T13:15:51.6835912Z �[0;31m            "_raw_params": "echo \"CREATE USER 'replication_user'@'localhost' IDENTIFIED WITH mysql_native_password BY 'replication_pass'; GRANT REPLICATION SLAVE ON *.* TO 'replication_user'@'localhost';\" | mysql -uroot -pmsandbox --protocol=tcp -P3307",�[0m
2022-10-03T13:15:51.6836461Z �[0;31m            "_uses_shell": true,�[0m
2022-10-03T13:15:51.6836731Z �[0;31m            "argv": null,�[0m
2022-10-03T13:15:51.6836985Z �[0;31m            "chdir": null,�[0m
2022-10-03T13:15:51.6837252Z �[0;31m            "creates": null,�[0m
2022-10-03T13:15:51.6837529Z �[0;31m            "executable": null,�[0m
2022-10-03T13:15:51.6837799Z �[0;31m            "removes": null,�[0m
2022-10-03T13:15:51.6838064Z �[0;31m            "stdin": null,�[0m
2022-10-03T13:15:51.6838352Z �[0;31m            "stdin_add_newline": true,�[0m
2022-10-03T13:15:51.6838649Z �[0;31m            "strip_empty_ends": true,�[0m
2022-10-03T13:15:51.6838926Z �[0;31m            "warn": false�[0m
2022-10-03T13:15:51.6839163Z �[0;31m        }�[0m
2022-10-03T13:15:51.6839370Z �[0;31m    },�[0m
2022-10-03T13:15:51.6839639Z �[0;31m    "msg": "non-zero return code",�[0m
2022-10-03T13:15:51.6839894Z �[0;31m    "rc": 1,�[0m
2022-10-03T13:15:51.6840172Z �[0;31m    "start": "2022-10-03 13:15:51.647284",�[0m
2022-10-03T13:15:51.6840950Z �[0;31m    "stderr": "mysql: [Warning] Using a password on the command line interface can be insecure.\nERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'BY 'replication_pass'' at line 1",�[0m
2022-10-03T13:15:51.6841508Z �[0;31m    "stderr_lines": [�[0m
2022-10-03T13:15:51.6842163Z �[0;31m        "mysql: [Warning] Using a password on the command line interface can be insecure.",�[0m
2022-10-03T13:15:51.6843000Z �[0;31m        "ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'BY 'replication_pass'' at line 1"�[0m
2022-10-03T13:15:51.6843424Z �[0;31m    ],�[0m
2022-10-03T13:15:51.6843661Z �[0;31m    "stdout": "",�[0m
2022-10-03T13:15:51.6843920Z �[0;31m    "stdout_lines": []�[0m
2022-10-03T13:15:51.6844136Z �[0;31m}�[0m
2022-10-03T13:19:17.8376997Z TASK [test_mysql_user : assert user1 TLS requirements] *************************
2022-10-03T13:19:17.9631220Z �[0;31mfatal: [testhost]: FAILED! => {"msg": "The conditional check ''NONE' in reqs' failed. The error was: error while evaluating conditional ('NONE' in reqs): {{(old_result is skipped | ternary(new_result, old_result)).stdout.split('REQUIRE')[1].split(separator)[0].strip() | default('NONE') }}: list object has no element 1"}�[0m
2022-10-03T13:21:40.7234293Z TASK [test_mysql_user : assert user1 TLS requirements] *************************
2022-10-03T13:21:40.7237537Z �[1;30mtask path: /root/ansible_collections/community/mysql/tests/output/.tmp/integration/test_mysql_user-64a6yx35-ÅÑŚÌβŁÈ/tests/integration/targets/test_mysql_user/tasks/tls_requirements.yml:179�[0m
2022-10-03T13:21:40.8475310Z �[0;31mfatal: [testhost]: FAILED! => {�[0m
2022-10-03T13:21:40.8476178Z �[0;31m    "msg": "The conditional check ''NONE' in reqs' failed. The error was: error while evaluating conditional ('NONE' in reqs): {{(old_result is skipped | ternary(new_result, old_result)).stdout.split('REQUIRE')[1].split(separator)[0].strip() | default('NONE') }}: list object has no element 1"�[0m

@laurent-indermuehle @webknjaz Ideas? I don't think anything changes in CI as my backports today (they also went through these tests) were green, resp there were no errors.

@webknjaz
Copy link
Member

webknjaz commented Oct 5, 2022

@laurent-indermuehle @webknjaz Ideas? I don't think anything changes in CI as my backports today (they also went through these tests) were green, resp there were no errors.

The backport is not equivalent to the original. The main branch has different matrix factor structure in the workflow. The names are different and so is the value pattern.
The main branch has db_engine_version: factor with values like mysql_5.7.31. The original PR uses ${{ matrix.db_engine_version }} and splits it by _ to get the DB engine type and version. Since the backport has this non-existing factor, it gets rendered as an empty string, resulting in all the replacements in sed being broken.
It must be adapted to use the existing factors or the factors should be updated too for this patch to work on this branch.

@laurent-indermuehle
Copy link
Collaborator Author

@webknjaz thanks for the explanations! I'll try that asap.

@Andersson007
Copy link
Collaborator

@webknjaz thanks for helping with this!

@webknjaz
Copy link
Member

webknjaz commented Oct 5, 2022

I haven't noticed any other differences in what's being invoked. There's what seems to be failing now:

TASK [test_mysql_user : assert user1 TLS requirements] *************************
task path: /root/ansible_collections/community/mysql/tests/output/.tmp/integration/test_mysql_user-35cc58f2-ÅÑŚÌβŁÈ/tests/integration/targets/test_mysql_user/tasks/tls_requirements.yml:179
fatal: [testhost]: FAILED! => {
    "msg": "The conditional check ''NONE' in reqs' failed. The error was: error while evaluating conditional ('NONE' in reqs): {{(old_result is skipped | ternary(new_result, old_result)).stdout.split('REQUIRE')[1].split(separator)[0].strip() | default('NONE') }}: list object has no element 1"
}

(https://github.com/ansible-collections/community.mysql/actions/runs/3190428087/jobs/5205520954#step:3:46119)

Is there something on this branch that may indirectly influence the integration tests? Could it be just flaky?

run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check

- name: Set MySQL version (${{ matrix.mysql }})
run: "sed -i 's/^mysql_version:.*/mysql_version: \"${{ matrix.mysql }}\"/g' ${{ env.mysql_version_file }}"
Copy link
Member

@webknjaz webknjaz Oct 5, 2022

Choose a reason for hiding this comment

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

This sed is different on the main branch. There, it doesn't wrap the version with double quotes and here it does.

-sed -i 's/^mysql_version:.*/mysql_version: "${{ matrix.mysql }}"/g' ${{ env.mysql_version_file }}
+sed -i "s/^mysql_version:.*/mysql_version: $DB_VERSION/g" ${{ env.mysql_version_file }}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For registering the "reqs" vars, the playbook needs "db_version.version.major <= 5". I feel like I have overlooked how "mysql_version" is used. I'll have a look at it today if I can. Thanks @webknjaz for your investigation!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Pleas forget about my previous comment. db_version is set by setup_mysql. Nothing to do with GHA.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I need to find a way to see errors in the GHA logs. 48000 lines to parse... My browser dies in the process...
@Andersson007 how did you manage to do that?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@laurent-indermuehle click the gear, view logs, i searched by "FAILED:" ignoring stuff with ignoring or something like that, after you find the first error, it'll give you a clue how to parse the rest

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@Andersson007 The issue with "View raw logs" is that all texts are now black on white and color codes are displayed.
But have you tried "View job summary"? It displays only errors. Thought, I can't see if they are ignored or not.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@laurent-indermuehle ah, cool, thanks:) i think they has introduced this since i last time tried to view errors there a long time ago - things usually pop up when testing locally. Good to know, thanks

Copy link
Member

Choose a reason for hiding this comment

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

I need to find a way to see errors in the GHA logs. 48000 lines to parse... My browser dies in the process...

Using the built-in search on the job page helps. The UI downloads the logs in chunks. And yes, downloading a raw logs and using something like Vim that loads files by chunks would help.

@laurent-indermuehle
Copy link
Collaborator Author

I managed to see one of the many integration errors :

TASK [test_mysql_variables : attempt connection with newly created user (expect failure)] ***
fatal: [testhost]: FAILED! => {"changed": false, "msg": "unable to find /root/.my.cnf. Exception message: (1045, \"Access denied for user 'db_user1'@'localhost' (using password: YES)\")"}
...ignoring

TASK [test_mysql_variables : assert] *******************************************
skipping: [testhost] => {"changed": false, "skip_reason": "Conditional result was False"}

TASK [test_mysql_variables : assert] *******************************************
fatal: [testhost]: FAILED! => {
    "assertion": "result is succeeded",
    "changed": false,
    "evaluated_to": false,
    "msg": "Assertion failed"
}

Despite many tests using the same task name, I could find the actual test:
https://github.com/ansible-collections/community.mysql/blob/stable-2/tests/integration/targets/test_mysql_variables/tasks/issue-28.yml#L34-L53

But, When I run the same tests (Python 3.9, MySQL 8.0.22, mysqlclient 2.0.1) I can't reproduce the issue. I'm confused.

Also, the tests are runned with maximum verbosity, which produce 48k lines for each integration tests. It's a nightmare to scroll. The last errors is displayed on line 44k/48k. Any way to filter out the last 4k lines?

@Andersson007
Copy link
Collaborator

Also, the tests are runned with maximum verbosity, which produce 48k lines for each integration tests. It's a nightmare to scroll. The last errors is displayed on line 44k/48k. Any way to filter out the last 4k lines?

@laurent-indermuehle i don't know a solution, i use search by FAILED! (as i can see in your output), feel free to ask in the community matrix channel, maybe someone knows how it can be solved

@webknjaz
Copy link
Member

webknjaz commented Oct 7, 2022

But, When I run the same tests (Python 3.9, MySQL 8.0.22, mysqlclient 2.0.1) I can't reproduce the issue. I'm confused.

@laurent-indermuehle you could use https://github.com/marketplace/actions/debugging-with-tmate to dig deeper.

@laurent-indermuehle
Copy link
Collaborator Author

laurent-indermuehle commented Oct 25, 2022

@webknjaz I need advices please. This is a nightmare to debug. Have you an idea what can differ between your composite action and the run command we used before?

For instance, this was working before:

    - name: attempt connection with newly created user ignoring hostname
      mysql_user:
        name: "{{ user_name_2 }}"
        password: "{{ user_password_2 }}"
        host: 127.0.0.1
        login_user: '{{ user_name_1 }}'
        login_password: '{{ user_password_1 }}'
        login_host: 127.0.0.1
        login_port: '{{ mysql_primary_port }}'
        ca_cert: /tmp/cert.pem
        check_hostname: no
      register: result
      ignore_errors: yes

    - assert:
        that:
          - result is succeeded or 'pymysql >= 0.7.11 is required' in result.msg

But now it fails because result.msg contains unable to find /root/.my.cnf. Exception message: [X509] no certificate or crl found (_ssl.c:4185)

I've reverted the file .github/workflows/ansible-test-plugins.yml to test the value with the old run comand. There, the value of result.msg is 151. But here result is succeeded, unlike the previous run.

Any Idea?

(edited to rename "container" into "composite action"

@webknjaz
Copy link
Member

But now it fails because result.msg contains unable to find /root/.my.cnf. Exception message: [X509] no certificate or crl found (_ssl.c:4185)

There's also a traceback in the log:

The full traceback is:
  File "/tmp/ansible_mysql_variables_payload_5uqw2qov/ansible_mysql_variables_payload.zip/ansible_collections/community/mysql/plugins/modules/mysql_variables.py", line 210, in main
  File "/tmp/ansible_mysql_variables_payload_5uqw2qov/ansible_mysql_variables_payload.zip/ansible_collections/community/mysql/plugins/module_utils/mysql.py", line 106, in mysql_connect
    db_connection = mysql_driver.connect(autocommit=autocommit, **config)
  File "/usr/local/lib/python3.8/dist-packages/pymysql/__init__.py", line 94, in Connect
    return Connection(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/pymysql/connections.py", line 253, in __init__
    self.ctx = self._create_ssl_ctx(ssl)
  File "/usr/local/lib/python3.8/dist-packages/pymysql/connections.py", line 333, in _create_ssl_ctx
    ctx = ssl.create_default_context(cafile=ca, capath=capath)
  File "/usr/lib/python3.8/ssl.py", line 745, in create_default_context
    context.load_verify_locations(cafile, capath, cadata)

So it is coming from pymysql which seems to be executed in the context of the GitHub Actions Runner. It probably attempts to look up .my.cfg in the home directory. I'm curious if there's any difference in $HOME between these two envs. And if so — why?

OTOH, it's great for the test stability to rely on a config that may be located in places outside the project directory. For reproducibility, the tests should point to a carefully constructed config generated specifically for testing.

@laurent-indermuehle
Copy link
Collaborator Author

Hey @webknjaz thank you for taking the time to study the problem.

So it is coming from pymysql which seems to be executed in the context of the GitHub Actions Runner.

The runner uses ubuntu-latest which as Python 3.10 pre-installed. What do you mean by "in the context of GHA"? And how can you know the context? To me it's far from obvious if you're in a Ubuntu started by GHA or in a Ubuntu started by ansible-test --docker.

It probably attempts to look up .my.cfg in the home directory.

I could debug $HOME value and check how PyMySQL and mysqlclient search for the .my.cfg file. Great idea.

I'm curious if there's any difference in $HOME between these two envs. And if so — why?

What would be the second env? Docker container launched by ansible-test?

OTOH, it's great for the test stability to rely on a config that may be located in places outside the project directory. For
reproducibility, the tests should point to a carefully constructed config generated specifically for testing.

This is exactly why I keep suffering on this issue. I can't figured out yet how everything works and don't like the fact that the tests may act differently when we change unrelated things.

@webknjaz
Copy link
Member

The runner uses ubuntu-latest which as Python 3.10 pre-installed. What do you mean by "in the context of GHA"? And how can you know the context? To me it's far from obvious if you're in a Ubuntu started by GHA or in a Ubuntu started by ansible-test --docker.

ansible-test is executed directly on the runner, in whatever VM you specify for the GHA job. That'd be ubuntu-latest usually. The action always runs it with --docker, there's no option to disable that. So the tests will be run in the container environments isolated from that host VM. It sounds to me like that ~/.my.cnf file is being looked up in such a container.

What would be the second env? Docker container launched by ansible-test?

I meant the working main branch vs stable-2. I'd also try staring at a git diff of those branches to try to spot any obvious differences.
Also, have you tried using the same command against this PR checkout locally? Maybe use git worktree to have a checkout in a separate folder on disk.

This is exactly why I keep suffering on this issue. I can't figured out yet how everything works and don't like the fact that the tests may act differently when we change unrelated things.

It'd probably be best to have a config file checked into the repository and make sure that all the tests use that config file via explicit CLI options or env vars.

@laurent-indermuehle
Copy link
Collaborator Author

What would be the second env? Docker container launched by ansible-test?

I meant the working main branch vs stable-2. I'd also try staring at a git diff of those branches to try to spot any obvious differences. Also, have you tried using the same command against this PR checkout locally? Maybe use git worktree to have a checkout in a separate folder on disk.

Git diff shows nothing. The PR works when tested locally. It's only on GHA that the assertions fails.

Thanks to your explanation that helped me understand the GHA setup, I managed to get inside the GHA instance and run a test with --docker-terminate never. Then I entered that container and try to connect to mysql using same parameters as the test. The error message I got was different than the one seen by the tests. It's normal because the tests uses the ansible plugin and I used the mysql command. The latter said "ssl is required but the server doesn't support it"

So, to me, it means 2 things:

  1. Our plugin doesn't return the correct error message or is missing some checks regarding SSL (did SSL was introduced in main? I have to check that)
  2. Our tests install a different set of dependencies for mysql server between GHA and a local test.

@Andersson007 do you think I'm right?

It'd probably be best to have a config file checked into the repository and make sure that all the tests use that config file via explicit CLI options or env vars.

This is what we do. Except that for GHA the variables comes from the matrix and when testing locally we have to manually adjust variables. Is there a way to merge GHA matrix with local testing? Maybe with a shell script that reads values from .github/workflow/ansible-test-plugins.yml?

@webknjaz
Copy link
Member

webknjaz commented Oct 31, 2022

Is there a way to merge GHA matrix with local testing?

No, ansible-test doesn't currently support native parametrization (although, I wish it did).

@laurent-indermuehle laurent-indermuehle force-pushed the patchback/backports/stable-2/81075307442c943ba2661dcbf5cd59459f89083c/pr-452 branch from 6cb3b10 to de38a96 Compare November 8, 2022 20:11
@laurent-indermuehle
Copy link
Collaborator Author

I have the final answer!
I must have misuse my git difftool because many differences between main and stable-2 make that the later is always installing MariaDB 10.5.4 no matter what the test matrix is.

This highlight the fact that our test setup is way too complicated, at least for me. So many files responsible to choose the versions, the engine, the connectors, ... And also they are lying to us, the title says "mysql_5.7.31" but really it is "MariaDB 10.5.4" !!!

I'll close this PR because 1) it is messy 2) it uses the guideline from the patchback-bot instead of the ansible guidelines.

I created a new PR for this backporting #452 to stable-2 : #463

@laurent-indermuehle laurent-indermuehle deleted the patchback/backports/stable-2/81075307442c943ba2661dcbf5cd59459f89083c/pr-452 branch November 10, 2022 09:47
@Andersson007
Copy link
Collaborator

@laurent-indermuehle thanks for investigating and working on this! Very important discoveries!

@webknjaz
Copy link
Member

I'll close this PR because 1) it is messy 2) it uses the guideline from the patchback-bot instead of the ansible guidelines.

I don't think there's anything wrong with those guidelines. They should produce the same result. OTOH, you're right — it's best if I'll teach Patchback to link external docs as suggested in sanitizers/patchback-github-app#19.

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.

3 participants