test/mon/*: prime mon with initial command before injection

The osdmonitor_prepare_command is very fragile.  Send an initial command
to the mon beforehand.  This seems to prevent the initial command from
getting combined into an early mon proposal with some other stuff.

Alternatively, we could remove these tests and this mechanism entirely as
it is likely to great in the future when the next set of mon changes are
made, but they have shown themselves to be useful it catching other
regressions, so we'll patch them up for a bit longer.

Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2014-08-28 10:59:18 -07:00
parent bb119360ac
commit e440fb496c
3 changed files with 8 additions and 0 deletions

View File

@ -79,6 +79,7 @@ function TEST_crush_rule_create_simple_exists() {
local ruleset=ruleset2
local root=default
local failure_domain=host
./ceph osd erasure-code-profile ls
# add to the pending OSD map without triggering a paxos proposal
result=$(echo '{"prefix":"osdmonitor_prepare_command","prepare":"osd crush rule create-simple","name":"'$ruleset'","root":"'$root'","type":"'$failure_domain'"}' | nc -U $dir/a/ceph-mon.a.asok | cut --bytes=5-)
test $result = true || return 1
@ -124,6 +125,7 @@ function TEST_crush_rule_create_erasure() {
function TEST_crush_rule_create_erasure_exists() {
local dir=$1
local ruleset=ruleset5
./ceph osd erasure-code-profile ls
# add to the pending OSD map without triggering a paxos proposal
result=$(echo '{"prefix":"osdmonitor_prepare_command","prepare":"osd crush rule create-erasure","name":"'$ruleset'"}' | nc -U $dir/a/ceph-mon.a.asok | cut --bytes=5-)
test $result = true || return 1
@ -135,6 +137,7 @@ function TEST_crush_rule_create_erasure_exists() {
function TEST_crush_rule_create_erasure_profile_default_exists() {
local dir=$1
local ruleset=ruleset6
./ceph osd erasure-code-profile ls
./ceph osd erasure-code-profile rm default || return 1
! ./ceph osd erasure-code-profile ls | grep default || return 1
# add to the pending OSD map without triggering a paxos proposal

View File

@ -64,6 +64,7 @@ function SHARE_MON_TEST_set_pending() {
# try again if the profile is pending
local profile=profile
./ceph osd erasure-code-profile ls
# add to the pending OSD map without triggering a paxos proposal
result=$(echo '{"prefix":"osdmonitor_prepare_command","prepare":"osd erasure-code-profile set","name":"'$profile'"}' | nc -U $dir/$id/ceph-mon.$id.asok | cut --bytes=5-)
test $result = true || return 1
@ -115,6 +116,7 @@ function SHARE_MON_TEST_rm_pending() {
# try again if the profile is pending
local profile=myprofile
./ceph osd erasure-code-profile ls
# add to the pending OSD map without triggering a paxos proposal
result=$(echo '{"prefix":"osdmonitor_prepare_command","prepare":"osd erasure-code-profile set","name":"'$profile'"}' | nc -U $dir/$id/ceph-mon.$id.asok | cut --bytes=5-)
test $result = true || return 1

View File

@ -100,6 +100,7 @@ function TEST_erasure_crush_rule() {
function TEST_erasure_crush_rule_pending() {
local dir=$1
run_mon $dir a --public-addr 127.0.0.1
./ceph osd erasure-code-profile ls
# try again if the ruleset creation is pending
crush_ruleset=erasure_ruleset
# add to the pending OSD map without triggering a paxos proposal
@ -112,6 +113,7 @@ function TEST_erasure_crush_rule_pending() {
function TEST_simple_crush_rule_pending() {
local dir=$1
run_mon $dir a --public-addr 127.0.0.1
./ceph osd erasure-code-profile ls
# try again if the ruleset creation is pending
crush_ruleset=simple_ruleset
./ceph osd crush add-bucket host1 host
@ -135,6 +137,7 @@ function TEST_erasure_code_profile_default() {
function TEST_erasure_code_profile_default_pending() {
local dir=$1
run_mon $dir a --public-addr 127.0.0.1
./ceph osd erasure-code-profile ls
./ceph osd erasure-code-profile rm default || return 1
! ./ceph osd erasure-code-profile ls | grep default || return 1
# add to the pending OSD map without triggering a paxos proposal