-
Notifications
You must be signed in to change notification settings - Fork 409
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
Automate prism service. #229
Automate prism service. #229
Conversation
@thinkingserious hi, should the build succeed now with my change or do you need to setup something on Travis first? 🤔 |
fi | ||
} | ||
|
||
install |
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.
Please add a new line at the end of the file.
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.
Done
@@ -0,0 +1,42 @@ | |||
#!/bin/bash |
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.
The Travis builds are currently failing because this file does not have execute permissions.
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.
hmm, might be, I haven't seen chmod in any other projects travis.yaml files though.
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'm not suggesting this be done via Travis. Try the following and commit the changes:
chmod a+x test/prism.sh
Note that this won't work if you're on a Windows box. If that's the case, then I can make the change.
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 think it doesn’t matter as executable flag is stored in inode and it’s not a part of the file.
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.
Correct. This particular issue is resolved with a21f3da
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.
@andy-trimble I still don't understand how this could solve the problem, permissions are stored in inode which is a structure that is stored somewhere on OS. chmod updates the inode. Could you plz explain where my understanding is wrong?
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.
@dmitraver It is no longer a problem. You fixed it with commit a21f3da.
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.
@andy-trimble yeah but for me this not enough, I want to figure out why its fixed behind the curtains. Just curious ;)
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.
@dmitraver At the time that I made this comment, the Travis build was failing with the following message /home/travis/.travis/job_stages: line 57: ./test/prism.sh: Permission denied
This indicates that the execute permission on the file were not present. Github preserves file permissions, and when Travis checked it out to execute the build, it was not executable.
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.
@andy-trimble yup, I figured out that git actually preserves the file permissions .
git cat-file -p $hash permission bits are stored there as well.
echo "Prism is not installed." | ||
install | ||
run | ||
fi |
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.
Please add a new line at the end of this file.
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.
Done
Thanks for the review @andy-trimble! |
@andy-trimble, fixed the issues you mentioned. |
@dmitraver The Travis build is still failing because Prism is not started up before the tests are run. |
Hmm, I think before_script in travis.yaml does exactly that, maybe adding a sleep should help |
@dmitraver The before_script only installs Prism. It does not start the process. |
@andy-trimble sure, you are right, my original understanding was that it is run by some other mean but I guess I'm wrong. I will update the scripts tomorrow. |
@andy-trimble, @thinkingserious I fixed the prism startup. Build is still failing because of the issue Andy mentioned. |
dmitraver has made the updates
Which issue @dmitraver? It seems like you fixed the issues Andy mentioned. |
@thinkingserious sorry, it was in his branch Builds are still failing due to IOExceptions on travis. |
@dmitraver The current exceptions in Travis are due to Prism not running. It seems that Prism is installed and started, but the process is killed before continuing on to the testing portion of the build. |
Can you add that to travis.yml please? |
@dmitraver, maybe try not running prism in the background. |
@dmitraver In my PR here, I'm using Groovy to kick off the Prism process, thus avoiding having Gradle shut down the process before the tests are run. Additionally, it waits until the Prism port is attached so that we don't have a race condition. Feel free to take whatever you need from that PR to keep your change moving forward. I really only made it as a reference implementation. I'm happy for you to get the Hacktoberfest credit, I'm already getting my swag. 😄 |
@thinkingserious running prism not in background seems to hang the process. I will try to experiment with it a bit. Locally it works fine. |
hi @thinkingserious, @andy-trimble I've done some testing locally and found why the tests are failing on Jenkins. Most of the tests have this check
|
@dmitraver The TRAVIS environment variable isn't actually being set in Travis. You can verify this in the "Setting environment variables from .travis.yml" section in the Travis log. Also, MOCK_HOST is being set to be localhost:4010 (as you can see in the Travis logs). |
@dmitraver One thing you could try is to insert a |
@andy-trimble hmm, this is actually strange cause I used their docker environment for testing and variable resolves to true there. The prism is running, you can see it from the output in travis. I also added the lsof command that checks that its running on port as intended. I still believe its due to the issue I pointed above as the docker environment is exactly the same as the real environment, the only thing that is different is that you need to run all your before scripts yourself. I can print the env variables. |
@andy-trimble also I tried to set mock host variable in the last change and I started getting different exceptions on travis which is now that it can't connect with https connection to localhost so I guess this variable is not set at all. |
@andy-trimble plz check the output of my last change https://travis-ci.org/sendgrid/sendgrid-java/jobs/290320581. 0.00s$ echo TRAVIS $TRAVIS so the travis variable is set but mock host is not. |
@andy-trimble btw, here is the list of default env variables set in travis
https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables
…On 19 October 2017 at 19:11, Andy Trimble ***@***.***> wrote:
@dmitraver <https://github.com/dmitraver> One thing you could try is to
insert a ps -ef | grep prism into the before_script section, after the
sleep command. This should tell you if prism is actually running.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#229 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABtwDH8r0qa2hlT9mHAyderaGFVBNWsbks5st4K0gaJpZM4PtHnd>
.
--
Best wishes,
Dmitry Avershin.
|
@thinkingserious hi, how are we going to proceed with this one? I think I would remove this logic that checks if the test is running on travis and simply leave the branch which uses localhost there. |
Ah, well there you go @dmitraver 😄 . Good sleuthing. It's interesting that the MOCK_HOST isn't set. The output in Travis would indicated that it is being set. This is in the "Build system information" section of the output. I'm unsure how Travis works here. From working on my PR, I noticed that I was having trouble keeping the Prism process running through the various Gradle steps. That's why I suggested checking for the process. I'm not seeing the output of the |
Also, @dmitraver, in order to validate your proposed solution, you could remove the logic from one of the tests, and see if that test passes in Travis. |
@andy-trimble I think you've seen it there cause I added it before to test ;) I will remove this logic and push the code to see if it actually builds. |
@andy-trimble I've commented this Travis part from the 10 tests and these tests passed fine on Travis. I'm gonna remove it from all the tests then. |
Awesome! Sounds good @dmitraver. |
@andy-trimble, @thinkingserious build is passing now. |
Wowza, I just caught up on this thread... Thank you so much @dmitraver and @andy-trimble - this was awesome. |
@andy-trimble if you approve your review, then we will get this merged in. I believe (and hope) it will fix the other build issues we're seeing too :) |
LGTM |
Hello @dmitraver, |
@thinkingserious, @andy-trimble thx, I really appreciate that, happy to help ;) |
Fixes #159.
-Installs prism on travis.
-Creates new gradle task to download and start prism locally. Prism is only downloaded if it wasn't downloaded before. To start prism locally do:
./gradlew startPrism