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

Adds integration tests for mysql, postgres and go client-server. #72

Merged
merged 17 commits into from
Jul 20, 2023

Conversation

FedeNQ
Copy link
Contributor

@FedeNQ FedeNQ commented Jun 15, 2023

Changes proposal:

  • Adds integration test for mysql, postgres and client-server golang app.

@faisal-memon
Copy link
Collaborator

Thanks @FedeNQ for writing all these unit tests.

version: '3'
services:
spire-server:
image: ghcr.io/spiffe/spire-server:1.6.3
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you update to 1.7.0 for server and agent?

@faisal-memon
Copy link
Collaborator

Can you move the tests form it/ to .github/tests?

@faisal-memon faisal-memon self-assigned this Jun 18, 2023
Comment on lines 101 to 104
- name: Run integration tests
run: ./integration_test.sh
shell: bash
working-directory: ./it
Copy link
Collaborator

Choose a reason for hiding this comment

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

What do you think of using a test matrix here and calling each test individually? That way it will show what test is running in the Github Actions output.

This snippet from the helm-charts repo will step through the directory with all the tests and build the matrix. https://github.com/spiffe/helm-charts/blob/main/.github/workflows/helm-chart-ci.yaml#L114-L117

@FedeNQ
Copy link
Contributor Author

FedeNQ commented Jun 20, 2023

Hi! Thanks for the review, we've made some changes based on the comments that you've provided.

Can you move the tests form it/ to .github/tests?

In order to add the build-matrix we've created a bunch of scripts on .github/tests that call the required scripts with parameters, should we move ALL the scripts to .github/tests or is it correct as it is now?

@FedeNQ FedeNQ requested a review from faisal-memon June 21, 2023 14:03
@faisal-memon
Copy link
Collaborator

Hi @FedeNQ

Thanks for making the requested changes.

In order to add the build-matrix we've created a bunch of scripts on .github/tests that call the required scripts with parameters, should we move ALL the scripts to .github/tests or is it correct as it is now

Yes. Having the tests there would eliminate the need for those extra scripts and you could just call the tests directly.

Also if you can add a strategy: section that would be great. Then you won't need the for loop and can just do bash .github/tests/${{ matrix.values }}.

Described here: https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs

@faisal-memon
Copy link
Collaborator

Thanks @FedeNQ . The test matrix changes look good. The restore-entry.test.sh is failing and change-entry-test.sh is getting cancelled.

@FedeNQ
Copy link
Contributor Author

FedeNQ commented Jul 3, 2023

Thanks @FedeNQ . The test matrix changes look good. The restore-entry.test.sh is failing and change-entry-test.sh is getting cancelled.

Thanks!
Yes, it appears that there's an issue with building the container. I'm currently working on fix that problem.

FedeNQ and others added 6 commits July 5, 2023 10:13
* adds strategy

Signed-off-by: FedeNQ <[email protected]>

* changes bash command

Signed-off-by: FedeNQ <[email protected]>

---------

Signed-off-by: FedeNQ <[email protected]>
* Change location of test files

Signed-off-by: FedeNQ <[email protected]>

* Change location of restore-entry-test

Signed-off-by: FedeNQ <[email protected]>

* Change location of restore-entry-test

Signed-off-by: FedeNQ <[email protected]>

* Adds shell in Run tests

Signed-off-by: FedeNQ <[email protected]>

---------

Signed-off-by: FedeNQ <[email protected]>
@FedeNQ
Copy link
Contributor Author

FedeNQ commented Jul 6, 2023

@faisal-memon It's seems like we had a false positive on some test, and a problem with the retries, but it should work now.
Let me know if you see another change needed!
Thanks

@faisal-memon
Copy link
Collaborator

Thanks @FedeNQ Can you move everything from it folder to .github/tests? That way you won't need those stub scripts.

@FedeNQ
Copy link
Contributor Author

FedeNQ commented Jul 7, 2023

Can you move everything from it folder to .github/tests? That way you won't need those stub scripts.

The scripts on test folder call the scripts on IT folder with parameters, that's why they are necessary, so move them to .github/tests won't solve the problem (it will avoid only the code block used to move from test folder to IT folder)
A solution could be move all to test folder and change the way we've made the scripts, having one test per case, instead of the parametizable tests that we've, should we?

* Move IT folder to .github folder

Signed-off-by: FedeNQ <[email protected]>

* Add ./.github/it to working directory

Signed-off-by: FedeNQ <[email protected]>

* Change target_dir in tests

Signed-off-by: FedeNQ <[email protected]>

* Change target_dir

Signed-off-by: FedeNQ <[email protected]>

* Change target_dir

Signed-off-by: FedeNQ <[email protected]>

* Add /.github in path

Signed-off-by: FedeNQ <[email protected]>

* change on docker-compose

Signed-off-by: FedeNQ <[email protected]>

* change target_dir in run-postgres-test

Signed-off-by: FedeNQ <[email protected]>

---------

Signed-off-by: FedeNQ <[email protected]>
@faisal-memon
Copy link
Collaborator

Can you move everything from it folder to .github/tests? That way you won't need those stub scripts.

The scripts on test folder call the scripts on IT folder with parameters, that's why they are necessary, so move them to .github/tests won't solve the problem (it will avoid only the code block used to move from test folder to IT folder) A solution could be move all to test folder and change the way we've made the scripts, having one test per case, instead of the parametizable tests that we've, should we?

No need to rewrite the tests. Just move to .github/tests then we can merge.

@FedeNQ
Copy link
Contributor Author

FedeNQ commented Jul 13, 2023

I've moved the IT folder to .github
Is it ok now, or should I move it to .github/tests?

@faisal-memon
Copy link
Collaborator

.github/tests since it is tests

Copy link
Collaborator

@faisal-memon faisal-memon left a comment

Choose a reason for hiding this comment

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

Thanks @FedeNQ for creating these valuable tests.

@faisal-memon
Copy link
Collaborator

@FedeNQ I just noticed integration-tests (change-entry-test.sh) is failing

Signed-off-by: FedeNQ <[email protected]>
@FedeNQ
Copy link
Contributor Author

FedeNQ commented Jul 20, 2023

@faisal-memon I made some changes, and now it passes all checks. Would it be a good idea to re-run all jobs to double-check?

@faisal-memon
Copy link
Collaborator

@faisal-memon I made some changes, and now it passes all checks. Would it be a good idea to re-run all jobs to double-check?

Thanks, looks good now.

@faisal-memon faisal-memon merged commit 68f73c1 into spiffe:main Jul 20, 2023
12 checks passed
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