-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[LDAP] Add ldap tests to github CI #39030
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
Conversation
Thank you for starting this PR! Adding LDAP integration tests to the already complex CI set-up of Symfony is a really brave task :) Let's start with a big disclaimer: I've never used LDAP before, so my knowledge about it is very weak. Can you maybe share why a custom docker image was used (instead of semi-official ones like |
Well, honestly I'm not into LDAP too. I've just used it for authentication. But I've made a PR which led to a bug that would have been avoided if I had been more accurate with tests. So... this is my way to ask forgiveness.. You're absolutely right: introducing a dependency on a custom image would absolutely be risky. I needed to do it because I needed to push some initial data to the LDAP server, namely, those in the test env. And it is precisely what I do in my custom Dockerfile: I create a folder where I store the data and copy it there. Then, with the env, I tell the image to load it. I think, the best aproach would be to use the standard image and then, add a step in the action, that pushes the data to the server. In order to do that I should use some command line program like Another way would be to create a custom action, which would lead to tha same problem as having a custom docker image. |
If we really need a custom image (which I'd like to avoid), we should move its maintenance this this repository or at least a repository within the Symfony organization. |
we even don't need a docker image. Github Action can run Dockerfile directly (https://docs.github.com/en/free-pro-team@latest/actions/creating-actions/creating-a-docker-container-action) |
We can do this without a custom image I think. The following docker compose config (docker compose isn't needed here, it's just more readable than a docker run command imho) sets up the openldap image with our fixture data (as far as I can see): version: '3.0'
services:
ldap:
image: osixia/openldap:1.4.0
ports:
- 3389:389
volumes:
- ./src/Symfony/Component/Ldap/Tests/Fixtures/data/fixtures.ldif:/container/service/slapd/assets/config/bootstrap/ldif/50-bootstrap.ldif
command: --copy-service --loglevel debug
environment:
LDAP_DOMAIN: symfony.com
LDAP_BASE_DN: dc=symfony,dc=com
LDAP_ADMIN_PASSWORD: 'symfony' Please note that I can't make the tests pass with this config, so something isn't quite right. But it at least is a start to get custom data in the openldap image without using a custom image. |
@wouterj I've tryed your suggestion. seemd promising! I've mounted a volume with the GHA: openldap:
image: osixia/openldap:1.4.0
options: -v ${{ github.workspace }}/src/Symfony/Component/Ldap/Tests/Fixtures/data/fixtures.ldif:/ldif-data
ports:
- 3389:389
env:
LDAP_DOMAIN: "symfony.com"
LDAP_ADMIN_PASSWORD: symfony
LDAP_BASE_DN: "dc=symfony,dc=com"
LDAP_SEED_INTERNAL_LDIF_PATH: "/ldif-data" But in the I'll try some alternatives and read the article pointed from @jderusse |
At a first impression, that would move the problem. In the sense that, instead of maintaing a docker image, there should be a GHA to maintain. |
Hmm, according to actions/checkout#211 (comment) the solution would be to run this command before the checkout action:
|
89011e9
to
0a04aab
Compare
My bad @jderusse ! Indeed, we can use a local action and not depenend on an external one. |
72765b9
to
972eac8
Compare
972eac8
to
285adf4
Compare
Rebase went wrong? It seems that an unrelated commit landed in this PR 3510b67 |
@chalasr is right, that does not look right. The content of that commit looks okay, but message and author are from a different PR. |
Yeah, the commit was there in the original PR (lucasaba@9de6771) I can reword it or squash it if you want @derrabus |
Right now, the commit message is misleading and I'm the author of that commit. I think, squashing it into the second commit and removing me as author would be good. 😃 |
Adds ext-ldap on github-actions
285adf4
to
a585f1b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really understand anything about what's happening here, but it seems to make the LDAP tests run successfully 👍
Should this also remove the - now unused - src/Symfony/Component/Ldap/Tests/Fixtures/conf/slapd.conf
and src/Symfony/Component/Ldap/Tests/Fixtures/data/base.ldif
files?
(unrelated, but I'm a bit scared by amount of integration tests that are skipped on our CI)
For the record. This PR update the CI to:
Then it fixes tests:
So do I.. Shall we run tests with option -vv to see the reason of skipped tests? |
a585f1b
to
97902df
Compare
Yes, that would be good. Integration tests are often skipped if an external system is not available. If we have a CI run dedicated to integration tests, skipped tests are likely an accident. |
97902df
to
ea78f72
Compare
Done. We have ~200 skipped tests for the following reasons:
I'm checking for the REDIS_SENTINEL test. |
All right, none of them is related to LDAP, so this PR should be good. |
(fwiw, let's move the conversation of the skipped tests to another PR/issue, so we can merge this asap) |
Thanks @lucasaba. |
Thank you all guys. As usual, has been a pleasure and a privilege. Learned a lot! |
I'll merge this up to 5.1 now. Let's hope, the tests stay green. 😃 |
Anyone up for a quick fix before I move on to 5.2? 😁 |
|
That makes sense. I've extracted that variable on 4.4 already, in order to keep the diff small. #39094 |
This PR was merged into the 4.4 branch. Discussion ---------- [Ldap] Fix undefined variable $con | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | #39030 (comment) | License | MIT | Doc PR | N/A This PR extracts the connection resource into a variable. This will fix an undefined variable error on 5.1. Commits ------- 15da316 [Ldap] Fix undefined variable $con.
The LDAP integration tests are now green on 5.1, 5.2 and 5.x. 🎉 |
thank you for your help @lucasaba . It helped to detect issue in 5.1 if I understand well, and would have prevent bugs in previous PRs. 🎉 |
Ok, now I'm really flattered! You've made my day!!!!! ❤️ |
Adds LDAP test on github actions pipeline and corrects sum bugs in the LDAP Component test
It also adds a bug resolution from @Nek- made in #38875