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

Adding acceptance tests for nodejs Stack #35

Merged
merged 31 commits into from
Feb 27, 2024

Conversation

pacostas
Copy link
Contributor

@pacostas pacostas commented Jan 17, 2024

Merge After

Related issues

Summary

This PR adds acceptance tests for Node stacks. That way we ensure before each release, that stacks work properly with ubi-nodejs-extension.

Use Cases

Checklist

  • I have viewed, signed, and submitted the Contributor License Agreement.
  • I have linked issue(s) that this PR should close using keywords or the Github UI (See docs)
  • I have added an integration test, if necessary.
  • I have reviewed the styleguide for guidance on my code quality.
  • I'm happy with the commit history on this PR (I have rebased/squashed as needed).

@mhdawson
Copy link
Member

Is there a reason to move buildpack_integration_test.go into the subdirectory. Just asking as it makes it less consistent with other stacks, for example - https://github.com/paketo-buildpacks/jammy-full-stack

@mhdawson
Copy link
Member

@pacostas Can you confirm that the updates in scripts/.util/tools.sh are just to bring it up to date with the template shared version of that?

scripts/test.sh Outdated Show resolved Hide resolved
scripts/test.sh Outdated Show resolved Hide resolved
@mhdawson
Copy link
Member

I think keep in the simple go test might also make sense. If we ever have to temparily disable the Node.js tests it would still be good to have that basic test in place.

@pacostas
Copy link
Contributor Author

Is there a reason to move buildpack_integration_test.go into the subdirectory. Just asking as it makes it less consistent with other stacks, for example - https://github.com/paketo-buildpacks/jammy-full-stack

@mhdawson They named the file buildpack_integration_test.go and I thought why not putting it under the integration folder following similar pattern to what we have on the buildpacks. BTW I should have remove string integration from the name nodejs_stack_integration_test.go as the file is moved under the integration directory.
Usually on the top level they put the unit tests. The correct I think is to have all the integration tests under the integration directory. In case we put the file under the root directory, we should also move the init_test.go on the root directory. What do you think?

@pacostas
Copy link
Contributor Author

pacostas commented Jan 18, 2024

@pacostas Can you confirm that the updates in scripts/.util/tools.sh are just to bring it up to date with the template shared version of that?

@mhdawson Its not fully aligned yet. I'm working on it.

Status updated: @mhdawson now its fully aligned.

@mhdawson
Copy link
Member

Is there a reason to move buildpack_integration_test.go into the subdirectory. Just asking as it makes it less consistent with other stacks, for example - https://github.com/paketo-buildpacks/jammy-full-stack

@mhdawson They named the file buildpack_integration_test.go and I thought why not putting it under the integration folder following similar pattern to what we have on the buildpacks. BTW I should have remove string integration from the name nodejs_stack_integration_test.go as the file is moved under the integration directory. Usually on the top level they put the unit tests. The correct I think is to have all the integration tests under the integration directory. In case we put the file under the root directory, we should also move the init_test.go on the root directory. What do you think?

My main concern is that we can share as much as possible with the generic files like test.sh as possible. If they run something called X then ideally we should have something called X instead of a differently located/named file. Having said that, if we have X and it calls runs/tests that are in other files that is good as well. In this case I thing other stacks had a file called buildpack_integration_test.go so wanted to be consitent with the other stacks.

@pacostas
Copy link
Contributor Author

Is there a reason to move buildpack_integration_test.go into the subdirectory. Just asking as it makes it less consistent with other stacks, for example - https://github.com/paketo-buildpacks/jammy-full-stack

@mhdawson They named the file buildpack_integration_test.go and I thought why not putting it under the integration folder following similar pattern to what we have on the buildpacks. BTW I should have remove string integration from the name nodejs_stack_integration_test.go as the file is moved under the integration directory. Usually on the top level they put the unit tests. The correct I think is to have all the integration tests under the integration directory. In case we put the file under the root directory, we should also move the init_test.go on the root directory. What do you think?

My main concern is that we can share as much as possible with the generic files like test.sh as possible. If they run something called X then ideally we should have something called X instead of a differently located/named file. Having said that, if we have X and it calls runs/tests that are in other files that is good as well. In this case I thing other stacks had a file called buildpack_integration_test.go so wanted to be consitent with the other stacks.

Aligned also with what exists on jammy implementation, in terms of file structure.

@pacostas
Copy link
Contributor Author

@mhdawson Ive finished with the review fixes, I think I've covered all suggestions. Can you have a fresh look and see if something is missing, or if the structure is consistent enough?

@pacostas
Copy link
Contributor Author

Related issue to close after merging this PR #2

@pacostas
Copy link
Contributor Author

@mhdawson I also added a .github/dependabot.yml file to update the go modules as they were outdated. This file is missing as is not also on the jammy-base-stack, although is present on bionic-base-stack (deprecated stack)
I dont see the reason why not upgrading the go modules, at first i thought that we might have releases very often as new prs for upgrading the go modules will land, but this is not the case as we only have a release when the image hash codes change.

@mhdawson
Copy link
Member

@mhdawson I also added a .github/dependabot.yml file to update the go modules as they were outdated. This file is missing as is not also on the jammy-base-stack, although is present on bionic-base-stack (deprecated stack)
I dont see the reason why not upgrading the go modules, at first i thought that we might have releases very often as new prs for upgrading the go modules will land, but this is not the case as we only have a release when the image hash codes change.

Thanks, just sounds like an oversight on my part.

@mhdawson
Copy link
Member

mhdawson commented Jan 22, 2024

@pacostas it still seems to differ in the top level name of the integration test. In the jammy base stack:buildpack_integration_test.go

verus being changed to nodejs_stack_integration_test.go in this PR

metadata_test.go Outdated Show resolved Hide resolved
@mhdawson
Copy link
Member

I'm not sure removing the npm buildpack is good. We likely want to be testing that our run images include both the node and npm binaries. You ready build a buildpack, what would the issue being to just have it include the top level Node.js buildpack and the modified extention (to have the right run images) and use that to build/run the application, making sure that npm is used? I think in that case we would not need the build plan at all ?

@mhdawson
Copy link
Member

@pacostas did another run through and left a few more comments

@pacostas
Copy link
Contributor Author

@pacostas it still seems to differ in the top level name of the integration test. In the jammy base stack:buildpack_integration_test.go

verus being changed to nodejs_stack_integration_test.go in this PR

Yes, I did that intentionally to separate the nodejs stacks from the java stacks or any other stacks that are going to be added in the future, I thought is nice to have them in a separate file. Also I thought the name is little bit misleading as we are not testing buildpacks nor extensions but stacks. This doesnt affect how the integration tests are being called, as they are under the same namespace package acceptance_test. We can also sync about that on todays' meeting.

@pacostas
Copy link
Contributor Author

I'm not sure removing the npm buildpack is good. We likely want to be testing that our run images include both the node and npm binaries. You ready build a buildpack, what would the issue being to just have it include the top level Node.js buildpack and the modified extention (to have the right run images) and use that to build/run the application, making sure that npm is used? I think in that case we would not need the build plan at all ?

I think is better to sync on that on todays' call, as for some reason the extension does not work without the build plan.

@mhdawson
Copy link
Member

@pacostas it still seems to differ in the top level name of the integration test. In the jammy base stack:buildpack_integration_test.go

verus being changed to nodejs_stack_integration_test.go in this PR

Ok understand based on discussion today, tests are run based on package versus the name so naming this way is good.

@pacostas
Copy link
Contributor Author

I'm not sure removing the npm buildpack is good. We likely want to be testing that our run images include both the node and npm binaries. You ready build a buildpack, what would the issue being to just have it include the top level Node.js buildpack and the modified extention (to have the right run images) and use that to build/run the application, making sure that npm is used? I think in that case we would not need the build plan at all ?

I think is better to sync on that on todays' call, as for some reason the extension does not work without the build plan.

Based on todays discussion, I'll add the buildpacks we usually use to build an app, as we dont want to have unexpected errors coming from extension/buildpack combinations that we are not fully aware.

@pacostas pacostas force-pushed the fixin-acceptance-tests branch from f6a306f to 064faf1 Compare January 25, 2024 11:29
@pacostas pacostas marked this pull request as ready for review January 25, 2024 11:30
@mhdawson mhdawson force-pushed the fixin-acceptance-tests branch from bd40203 to 7616df9 Compare February 26, 2024 19:30
mhdawson
mhdawson previously approved these changes Feb 27, 2024
Copy link
Member

@mhdawson mhdawson left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@mhdawson mhdawson left a comment

Choose a reason for hiding this comment

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

LGTM

@mhdawson mhdawson merged commit 16cf374 into paketo-community:main Feb 27, 2024
2 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