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

Test paas-app-charmer changes in discourse-gateway #330

Closed
wants to merge 31 commits into from

Conversation

javierdelapuente
Copy link
Contributor

@javierdelapuente javierdelapuente commented Mar 27, 2024

Problem

Following canonical/discourse-gatekeeper#238, the charm files (charmcraft.yaml, metadata.yaml and the docs directory) can be in a directory that is not in the repository base directory. This directory is specified by the github action input variable charm_dir in discourse-gateway. Besides, to get information from the charm, if the metadata.yaml file is not in the project, the charmcraft.yaml file will be used.

Context

Using a customised directory instead of the base one and using only the charmcraft.yaml file are requirements for PAAS app charmer applications to work correctly. Besides, the use of charmcraft.yaml is the recommended way of specifying the name of the charm and the link to the doc for every project (see https://juju.is/docs/sdk/charmcraft-yaml).

Solution

See canonical/discourse-gatekeeper#238.

Testing

A matrix strategy for workflows e2e_conflicts.yaml and e2e_test.yaml to test using the the base directory and the charm directory as charm_dir inputs.

In the workflow e2e_conflicts.yaml when using charm as charm_dir, the charmcraft.yaml file will be used instead of the metadata.yaml file.

Release Notes

New input parameter charm_dir for discourse-gatekeeper accepts, that allows specifying where the charm files and directories are located it they are not in the base directory of the repository.
If the file metadata.yaml does not exist, the file charmcraft.yaml is used to get the charm name and the link to the documentation.

@javierdelapuente javierdelapuente marked this pull request as ready for review April 1, 2024 07:56
@jdkandersson jdkandersson requested a review from deusebio April 2, 2024 03:44
Copy link
Collaborator

@jdkandersson jdkandersson left a comment

Choose a reason for hiding this comment

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

Thanks for creating this e2e test!

Comment on lines +15 to +20
strategy:
max-parallel: 1
matrix:
charm-dir:
-
- charm
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm hesitant to add complexity like this to the e2e tests, especially since we have to write them in bash and that when it is the charm case we also actually change from metadata to charmcraft. 2 options i can think of:

  1. Add another stage to the tests which change from metadata to charmcraft and inside a directory
  2. Add a separate test file

I would also run this in reconclide rather than conflict since we're not really testing a conflict.

Probably we can go with adding another job to reconcile which has 1 documentation file inside a directory and making use of charmcraft rather than metadata and just run the create action on that and leave it at that

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would also run this in reconclide rather than conflict since we're not really testing a conflict.

I'm fine with either, but if we go with 1) I would put this in the conflict tests. End2End tests test a number of things and integrations beside conflicts, so that should be totally fine. The reason why I would not put this in the reconcile is that reconcile is the test where we do update production Discourse (to make sure the integration works correctly) which we don't run in scheduled fashion to avoid cluttering Discourse too much. Anything we put there is somewhat less checked.

So by default, we should place more things on pulling tests (such as the conflict ones) that we run often and don't clutter Discourse.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sounds good, perhaps we can rename this file

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, I'm happy with this, I also find it somewhat confusing. We could just go for "Pulling Test" and "Pushing Test". If we will start splitting tests further we could revisit this

Copy link
Collaborator

@deusebio deusebio left a comment

Choose a reason for hiding this comment

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

Changes look sane. I have raised a comment on @jdkandersson but once that is settled I'm happy to approve.

Only one note, we should probably raise dedicated PR for updating the gatekeeper code and also possibly find a better automation for doing this.

@javierdelapuente
Copy link
Contributor Author

javierdelapuente commented Apr 10, 2024

Changes look sane. I have raised a comment on @jdkandersson but once that is settled I'm happy to approve.

Only one note, we should probably raise dedicated PR for updating the gatekeeper code and also possibly find a better automation for doing this.

I am working on the PR for updating the gatekeeper code in canonical/discourse-gatekeeper#244 and #466. I will left this PR open until that is done. Thanks for the review!

@javierdelapuente
Copy link
Contributor Author

I close this PR and open a simpler one in another PR with just the new test

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