123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225 |
- import salt.config
- import salt.version
- def test_ping(
- mm_master_1_salt_cli, salt_mm_minion_1, mm_master_2_salt_cli, salt_mm_minion_2
- ):
- """
- test.ping
- """
- ret = mm_master_1_salt_cli.run("test.ping", minion_tgt=salt_mm_minion_1.id)
- assert ret.exitcode == 0
- assert ret.json is True
- ret = mm_master_2_salt_cli.run("test.ping", minion_tgt=salt_mm_minion_1.id)
- assert ret.exitcode == 0
- assert ret.json is True
- ret = mm_master_1_salt_cli.run("test.ping", minion_tgt=salt_mm_minion_2.id)
- assert ret.exitcode == 0
- assert ret.json is True
- ret = mm_master_2_salt_cli.run("test.ping", minion_tgt=salt_mm_minion_2.id)
- assert ret.exitcode == 0
- assert ret.json is True
- def test_echo(
- mm_master_1_salt_cli, salt_mm_minion_1, mm_master_2_salt_cli, salt_mm_minion_2
- ):
- """
- test.echo
- """
- ret = mm_master_1_salt_cli.run("test.echo", "text", minion_tgt=salt_mm_minion_1.id)
- assert ret.exitcode == 0
- assert ret.json == "text"
- ret = mm_master_2_salt_cli.run("test.echo", "text", minion_tgt=salt_mm_minion_1.id)
- assert ret.exitcode == 0
- assert ret.json == "text"
- ret = mm_master_1_salt_cli.run("test.echo", "text", minion_tgt=salt_mm_minion_2.id)
- assert ret.exitcode == 0
- assert ret.json == "text"
- ret = mm_master_2_salt_cli.run("test.echo", "text", minion_tgt=salt_mm_minion_2.id)
- assert ret.exitcode == 0
- assert ret.json == "text"
- def test_version(
- mm_master_1_salt_cli, salt_mm_minion_1, mm_master_2_salt_cli, salt_mm_minion_2
- ):
- """
- test.version
- """
- ret = mm_master_1_salt_cli.run("test.version", minion_tgt=salt_mm_minion_1.id)
- assert ret.exitcode == 0
- assert ret.json == salt.version.__saltstack_version__.string
- ret = mm_master_2_salt_cli.run("test.version", minion_tgt=salt_mm_minion_1.id)
- assert ret.exitcode == 0
- assert ret.json == salt.version.__saltstack_version__.string
- ret = mm_master_1_salt_cli.run("test.version", minion_tgt=salt_mm_minion_2.id)
- assert ret.exitcode == 0
- assert ret.json == salt.version.__saltstack_version__.string
- ret = mm_master_2_salt_cli.run("test.version", minion_tgt=salt_mm_minion_2.id)
- assert ret.exitcode == 0
- assert ret.json == salt.version.__saltstack_version__.string
- def test_conf_test(
- mm_master_1_salt_cli, salt_mm_minion_1, mm_master_2_salt_cli, salt_mm_minion_2
- ):
- """
- test.conf_text
- """
- ret = mm_master_1_salt_cli.run("test.conf_test", minion_tgt=salt_mm_minion_1.id)
- assert ret.exitcode == 0
- assert ret.json == "baz"
- ret = mm_master_2_salt_cli.run("test.conf_test", minion_tgt=salt_mm_minion_1.id)
- assert ret.exitcode == 0
- assert ret.json == "baz"
- ret = mm_master_1_salt_cli.run("test.conf_test", minion_tgt=salt_mm_minion_2.id)
- assert ret.exitcode == 0
- assert ret.json == "baz"
- ret = mm_master_2_salt_cli.run("test.conf_test", minion_tgt=salt_mm_minion_2.id)
- assert ret.exitcode == 0
- assert ret.json == "baz"
- def test_cross_test(
- mm_master_1_salt_cli, salt_mm_minion_1, mm_master_2_salt_cli, salt_mm_minion_2
- ):
- """
- test.cross_text
- """
- ret = mm_master_1_salt_cli.run(
- "test.cross_test", "test.ping", minion_tgt=salt_mm_minion_1.id
- )
- assert ret.exitcode == 0
- assert ret.json is True
- ret = mm_master_2_salt_cli.run(
- "test.cross_test", "test.ping", minion_tgt=salt_mm_minion_1.id
- )
- assert ret.exitcode == 0
- assert ret.json is True
- ret = mm_master_1_salt_cli.run(
- "test.cross_test", "test.ping", minion_tgt=salt_mm_minion_2.id
- )
- assert ret.exitcode == 0
- assert ret.json is True
- ret = mm_master_2_salt_cli.run(
- "test.cross_test", "test.ping", minion_tgt=salt_mm_minion_2.id
- )
- assert ret.exitcode == 0
- assert ret.json is True
- def test_outputter(
- mm_master_1_salt_cli, salt_mm_minion_1, mm_master_2_salt_cli, salt_mm_minion_2
- ):
- """
- test.outputter
- """
- ret = mm_master_1_salt_cli.run(
- "test.outputter", "text", minion_tgt=salt_mm_minion_1.id
- )
- assert ret.exitcode == 0
- assert ret.json == "text"
- ret = mm_master_2_salt_cli.run(
- "test.outputter", "text", minion_tgt=salt_mm_minion_1.id
- )
- assert ret.exitcode == 0
- assert ret.json == "text"
- ret = mm_master_1_salt_cli.run(
- "test.outputter", "text", minion_tgt=salt_mm_minion_2.id
- )
- assert ret.exitcode == 0
- assert ret.json == "text"
- ret = mm_master_2_salt_cli.run(
- "test.outputter", "text", minion_tgt=salt_mm_minion_2.id
- )
- assert ret.exitcode == 0
- assert ret.json == "text"
- def test_fib(
- mm_master_1_salt_cli, salt_mm_minion_1, mm_master_2_salt_cli, salt_mm_minion_2
- ):
- """
- test.fib
- """
- ret = mm_master_1_salt_cli.run("test.fib", "20", minion_tgt=salt_mm_minion_1.id)
- assert ret.exitcode == 0
- assert ret.json[0] == 6765
- ret = mm_master_2_salt_cli.run("test.fib", "20", minion_tgt=salt_mm_minion_1.id)
- assert ret.exitcode == 0
- assert ret.json[0] == 6765
- ret = mm_master_1_salt_cli.run("test.fib", "20", minion_tgt=salt_mm_minion_2.id)
- assert ret.exitcode == 0
- assert ret.json[0] == 6765
- ret = mm_master_2_salt_cli.run("test.fib", "20", minion_tgt=salt_mm_minion_2.id)
- assert ret.exitcode == 0
- assert ret.json[0] == 6765
- def test_collatz(
- mm_master_1_salt_cli, salt_mm_minion_1, mm_master_2_salt_cli, salt_mm_minion_2
- ):
- """
- test.fib
- """
- ret = mm_master_1_salt_cli.run("test.collatz", "40", minion_tgt=salt_mm_minion_1.id)
- assert ret.exitcode == 0
- assert ret.json[0][-1] == 2
- ret = mm_master_2_salt_cli.run("test.collatz", "40", minion_tgt=salt_mm_minion_1.id)
- assert ret.exitcode == 0
- assert ret.json[0][-1] == 2
- ret = mm_master_1_salt_cli.run("test.collatz", "40", minion_tgt=salt_mm_minion_2.id)
- assert ret.exitcode == 0
- assert ret.json[0][-1] == 2
- ret = mm_master_2_salt_cli.run("test.collatz", "40", minion_tgt=salt_mm_minion_2.id)
- assert ret.exitcode == 0
- assert ret.json[0][-1] == 2
- def test_get_opts(
- mm_master_1_salt_cli, salt_mm_minion_1, mm_master_2_salt_cli, salt_mm_minion_2
- ):
- """
- test.conf_text
- """
- ret = mm_master_1_salt_cli.run("test.get_opts", minion_tgt=salt_mm_minion_1.id)
- assert ret.exitcode == 0
- assert ret.json["cachedir"] == salt_mm_minion_1.config["cachedir"]
- ret = mm_master_2_salt_cli.run("test.get_opts", minion_tgt=salt_mm_minion_1.id)
- assert ret.exitcode == 0
- assert ret.json["cachedir"] == salt_mm_minion_1.config["cachedir"]
- ret = mm_master_1_salt_cli.run("test.get_opts", minion_tgt=salt_mm_minion_2.id)
- assert ret.exitcode == 0
- assert ret.json["cachedir"] == salt_mm_minion_2.config["cachedir"]
- ret = mm_master_2_salt_cli.run("test.get_opts", minion_tgt=salt_mm_minion_2.id)
- assert ret.exitcode == 0
- assert ret.json["cachedir"] == salt_mm_minion_2.config["cachedir"]
|