[merged] make vagrant-check: Run tests with vagrant#736
[merged] make vagrant-check: Run tests with vagrant#736baude wants to merge 1 commit intoprojectatomic:masterfrom
Conversation
Vagrantfile
Outdated
|
|
||
| # Every Vagrant development environment requires a box. You can search for | ||
| # boxes at https://atlas.hashicorp.com/search. | ||
| config.vm.box = "fedora/24-cloud-base" |
There was a problem hiding this comment.
Why not fedora/24-atomic-host here? Or even better, define all three (the CentOS box is called centos/atomic-host). Someone can then choose to only bring up a single one, e.g. vagrant up fedora/24/atomic.
There was a problem hiding this comment.
Well, two quick reasons.
-
If I understood you correctly, the CentOS and Fedora Atomic host required greater preparations than simply dnf install coverage and atomic. And that is normally handled specially by your tools right which arent in play local use.
-
Aim small, miss small :)
In all seriousness, if you think I should pursue, I'm happy to do so. I think the Makefile would then need to call a bash script instead of trying to handle this all in make. Thoughts?
There was a problem hiding this comment.
- If I understood you correctly, the CentOS and Fedora Atomic host required greater preparations than simply dnf install coverage and atomic. And that is normally handled specially by your tools right which arent in play local use.
For fedora/24/atomic, we don't do any special handling. So the rest of your Vagrantfile should just work as is (minus the dnf install part). For CentOS, hmmm... yeah that's an issue. You'd have to rebase to CAHC, since the official release lags so much behind (or layer all the new reqs). I researched this a while back (we have a similar setup in rpm-ostree), and rebasing and rebooting as part of the Vagrant provisioning process was not straightforward.
- Aim small, miss small :)
Agreed! This is definitely a good start. How about we start with just fedora/24-atomic-host, since I'd say this project holds more importance on AH than in the Cloud variant. Plus, I assume most developers here are not using an Atomic Host to hack on atomic, so this would be an easy way to provide them that environment. WDYT?
There was a problem hiding this comment.
We actually have Vagrant boxes generated for CAHC (both continuous and alpha) btw, and I switched to using CAHC Alpha in coreos/rpm-ostree#502
|
SGTM |
|
See also coreos/rpm-ostree#502 |
|
Rebasing |
|
One thing of note, if you run I think you'll have to |
4890fd2 to
f6ea503
Compare
vagrant.sh
Outdated
|
|
||
|
|
||
| is_running() { | ||
| status=$(vagrant status | grep fedora_atomic | awk '{print $2}') |
There was a problem hiding this comment.
You'll have to change this to grep for ${BOX} since it is selectable
| exit 1 | ||
| fi | ||
| } | ||
|
|
There was a problem hiding this comment.
Maybe add some logic before running the bulk of the script to validate that the value of ${BOX} is supported? Some usage feedback with supported values would go nicely here, too.
| @@ -0,0 +1,31 @@ | |||
| #!/bin/bash | |||
|
|
|||
There was a problem hiding this comment.
set -euo pipefail would be a nice addition
vagrant.sh
Outdated
| tee_file="${BOX}_${timestamp}.log" | ||
| is_running | ||
| vagrant up ${BOX} | ||
| vagrant ssh ${BOX} -c "cd /home/vagrant/atomic && sudo sh ./.redhat-ci.sh" |
There was a problem hiding this comment.
I think this needs to be piped to tee?
There was a problem hiding this comment.
The piping to tee seems to break $? reflecting the actual test result.
01c70db to
5ccc8de
Compare
|
@rhatdan this is good to go now, not sure what is up with the ci tests |
vagrant.sh
Outdated
| status=$(vagrant status | grep ${BOX} | awk '{print $2}') | ||
| if [ ${status} == "running" ]; then | ||
| echo "" | ||
| echo "'${BOX}' is already running. Perform a 'vagrant halt|destroy ${BOX}'" |
There was a problem hiding this comment.
Rather than having to destroy and bring back up each time, can't we just vagrant rsync here if we see it's already up?
There was a problem hiding this comment.
How do I know if it is already running a test? I defaulted to this because I really dont know the existing state if it is running. Thoughts? @rhatdan
There was a problem hiding this comment.
We can leave that to the user, no? I.e. expect them to know when the previous make vagrant-check is done before starting a new one. Or are you thinking of another use case here?
There was a problem hiding this comment.
@jlebon OK I have implemented your suggestion but I hit ...
/usr/share/gems/gems/net-ssh-2.9.1/lib/net/ssh/transport/session.rb:67:in `initialize': Object#timeout is deprecated, use Timeout.timeout instead.
/usr/share/gems/gems/net-ssh-2.9.1/lib/net/ssh/transport/session.rb:84:in`initialize': Object#timeout is deprecated, use Timeout.timeout instead.
==> fedora_atomic: Rsyncing folder: /home/bbaude/docker/atomic/ => /home/vagrant/atomic
==> fedora_atomic: - Exclude: [".vagrant/", ".tmp*"]
- mount --make-rshared /
- systemctl start docker
- '[' -f /run/ostree-booted ']'
- ostree admin unlock
error: Deployment is already in unlocked state: development
Connection to 192.168.121.217 closed.
*\* Test failed. Leaving 'fedora_atomic' running for debug.
*\* Be sure to halt or destroy prior to re-running the check
*\* Logs are stored at fedora_atomic_2016_11_03_09_34.log
Makefile:97: recipe for target 'vagrant-check' failed
make: **\* [vagrant-check] Error 1
So can your rh ci script handle this?
There was a problem hiding this comment.
Sure, we just need to tweak the unlock part. Maybe e.g.:
if [ -f /run/ostree-booted ]; then
ostree admin unlock || :
fiThere was a problem hiding this comment.
Or maybe if we want to be more correct, e.g. check rpm-ostree status --json or whether a /var/tmp/ostree-unlock-ovl.* dir exists.
3f03d87 to
0a4038e
Compare
|
@miabbott @cgwalters Are you guys happy with this? |
|
Down the line we'll definitely want to do more dedup across projects and such, but this seems sane to me to start. |
|
Why does the PR have a merge from master instead of being rebased though? |
|
Yup, looks good on my end as well. |
|
@baude REBASE please and then we can merge. |
Run tests in a vagrant session (w/libvirt for now). This allows the tests to occur similar to the way our jenkins tests work. Run make vagrant-check and we created an F24 session and install the proper deps. We then call the .redhat-ci.sh script inside the vagrant session and the tests are executed. At this time, you will need to vagrant halt to shutdown the session when comlete. By default, the tests will exeute on an instance of fedora-24-atomic. You can test on Colin's CAHC centos-atomic by: make vagrant-check BOX=centos_atomic
|
@rhatdan rebased |
|
📌 Commit 671ed30 has been approved by |
Run tests in a vagrant session (w/libvirt for now). This allows the tests to occur similar to the way our jenkins tests work. Run make vagrant-check and we created an F24 session and install the proper deps. We then call the .redhat-ci.sh script inside the vagrant session and the tests are executed. At this time, you will need to vagrant halt to shutdown the session when comlete. By default, the tests will exeute on an instance of fedora-24-atomic. You can test on Colin's CAHC centos-atomic by: make vagrant-check BOX=centos_atomic Closes: #736 Approved by: rhatdan
|
💔 Test failed - status-atomicjenkins |
|
@rh-atomic-bot retry |
|
☀️ Test successful - status-atomicjenkins |
Run tests in a vagrant session (w/libvirt for now). This allows
the tests to occur similar to the way our jenkins tests work. Run
make vagrant-check and we created an F24 session and install
the proper deps. We then call the .redhat-ci.sh script inside
the vagrant session and the tests are executed. At this time, you
will need to vagrant halt to shutdown the session when comlete.