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
split bats into the real tests and roles to set stuff up #465
Conversation
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.
Looks good to me
boxes.yaml.example
Outdated
@@ -44,6 +44,7 @@ centos7-bats-ci: | |||
bats_tests: | |||
- "swapfile.bats" | |||
- "fb-install-katello.bats" |
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.
IMHO this can be left out now. We should rely on ansible for installation.
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.
You mean basically completely dropping fb-install-katello.bats
? Yeah we can do that.
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 file can stay, but we shouldn't recommend using it I think.
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.
If the file is not used and not recommended, why should it stay? Archaeology lessons can still be done using the Git history, an unused file is just confusing. Same applies for katello-bats
btw, I think it's unused by now?
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.
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.
One of the biggest things we need is https://github.com/evgeni/forklift/blob/99fdda8d44631373e75ece1bb3aefdc2a970f52a/bats/fb-install-katello.bats#L47-L52 which was put in to help out on the CI system as far as I remember.
So maybe we need like a setup role to do a few of those items (instead of "testing" them). Otherwise I think it's safe to remove the install test 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.
For now I'd suggest a haveged role rather than a more global setup role which may get parameters. Start simple.
@@ -5,5 +5,6 @@ bats_output_dir: "/root/bats_results" | |||
bats_update_forklift: "yes" | |||
bats_tests: | |||
- "fb-install-katello.bats" |
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.
Should also be left out IMHO.
Thanks you for this! I wanted to do this but hadn't gotten around to it. |
@@ -0,0 +1,42 @@ | |||
#!/usr/bin/env bats |
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.
@evgeni I think one additional check could be valuable here -- doing a curl of /katello/api/ping
since this provides information of about services that the status check does not, e.g. whether or not Katello can talk to Pulp or Candlepin and whether or not Pulp is having any connectivity issues with the workers. These are things that can produce big smells for installation health.
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.
That's what hammer ping
does. No need to curl
yourself ;)
bats/fb-test-katello.bats
Outdated
} | ||
|
||
@test "check host is registered" { | ||
[ x$FOREMAN_VERSION = "x1.3" ] && skip "Only supported on 1.4+" |
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.
Ha - I think we could drop this line
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.
So I did in my local branch, let me polish and push that before you continue review.
Looks good to me, will let @ekohl have a final pass at the updated version |
bats/fb-test-katello.bats
Outdated
|
||
@test "check smart proxy is registered" { | ||
count=$(hammer --csv proxy list | wc -l) | ||
[ $count -gt 1 ] |
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 wonder if grepping for the hostname would be a better check, but I think this is directly ported so it's fine to leave this in.
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.
yeah. grep -q $hostname
sounds good to me.
Sent from my OnePlus ONEPLUS A3003 using FastHub
@@ -0,0 +1,22 @@ | |||
--- |
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'd drop this role. It was originally added in the foreman-bats because you want to start with a clean install, but in the ansible context it doesn't really make sense (unless you do it before the foreman-installer run).
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.
ack. Was not sure about the history and thought porting was cheaper then thinking.
- name: 'Install Haveged (faster population of PRNG)' | ||
yum: | ||
name: haveged | ||
state: latest |
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 just ensuring it's installed is good enough.
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.
Thats how it was in the freeipa role.
Sent from my OnePlus ONEPLUS A3003 using FastHub
@ekohl there we go, all 3 comments done |
before we had bats doing a lot of setup and then running tests. this moves the setup tasks into a series of own roles (haveged, disable_firewall) and lets bats do what it is supposed to do: run tests.
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.
Untested but it looks correct.
Thanks! |
before we had bats doing a lot of setup and then running tests.
this moves the setup tasks into a series of own roles (haveged, disable_firewall, clean_puppet) and lets bats do what it is supposed to do: run tests.