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

fix: add test for checking existannce of public/hash.txt file #1010

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ofirc77
Copy link
Collaborator

@ofirc77 ofirc77 commented Jan 15, 2025

fix: add test for checking existannce of public/hash.txt file

@ofirc77 ofirc77 self-assigned this Jan 15, 2025
@ofirc77 ofirc77 requested a review from NoamGaash as a code owner January 15, 2025 16:17
@ofirc77
Copy link
Collaborator Author

ofirc77 commented Jan 15, 2025

@NoamGaash Added comment from previous commit for context:

In short, updated the commit hash in hash.txt in the build.yaml file
this commit will focus on writing test for that feature.

seems like you're testing for the existence of public/hash.txt - and I don't think we should expect this file to be found in this stage because this job is not the same job that created this file.
I do think we want to test that http://localhost:3000/hash.txt returns a text string (mime type text/plain) that is short (less then 100 chars or so).
This test can also be performed locally if you run docker build and docker run, and then navigate to this url in your browser.
also, please consider adding separated commits so it will be easier to follow what have we tried

Updated this commit according to what you asked

@ofirc77
Copy link
Collaborator Author

ofirc77 commented Jan 15, 2025

Updated the test in the validate section. It seems now that it redirects it to the main page again for my opinion ( this is why we have 3100 chars and not less than 100 )
I will try to think on solution while running it locally for that issue.
Please let me know if you have more ideas

Copy link
Member

@NoamGaash NoamGaash left a comment

Choose a reason for hiding this comment

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

Great!
Try to run the image locally and see A) if it has the file inside the public directory and b) if it serve it

exit 1
fi
mime_type=$(file --mime-type -b /tmp/hash.txt)
if [ "$mime_type" != "text/html" ]; then
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if [ "$mime_type" != "text/html" ]; then
if [ "$mime_type" != "text/plain" ]; then

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.

2 participants