Updating integration tests to launch more sub proxies. Update single target tests to use a sample of 4 sub proxies for the target.

This commit is contained in:
Gareth J. Greenaway 2023-04-27 19:03:12 -07:00 committed by Megan Wilhite
parent 580fb824f1
commit de7c2f0515
3 changed files with 73 additions and 56 deletions

View file

@ -631,12 +631,46 @@ def io_loop():
# ----- Helpers ----------------------------------------------------------------------------------------------------->
@pytest.helpers.proxy.register
def delta_proxy_minion_ids():
return [
"dummy_proxy_one",
"dummy_proxy_two",
"dummy_proxy_three",
"dummy_proxy_four",
]
number_words = {
1: "one",
2: "two",
3: "three",
4: "four",
5: "five",
6: "six",
7: "seven",
8: "eight",
9: "nine",
10: "ten",
11: "eleven",
12: "twelve",
13: "thirteen",
14: "fourteen",
15: "fifteen",
16: "sixteen",
17: "seventeen",
18: "eighteen",
19: "nineteen",
20: "twenty",
21: "twenty_one",
22: "twenty_two",
23: "twenty_three",
24: "twenty_four",
25: "twenty_five",
26: "twenty_six",
27: "twenty_seven",
28: "twenty_eight",
29: "twenty_nine",
30: "thirty",
31: "thirty_one",
}
sub_proxies = []
for i in range(1, 32):
sub_proxies.append("dummy_proxy_{}".format(number_words[i]))
return sub_proxies
# <---- Helpers ------------------------------------------------------------------------------------------------------

View file

@ -25,71 +25,53 @@ def deltaproxy_pillar_tree(request, salt_master, salt_delta_proxy_factory):
"""
Create the pillar files for controlproxy and two dummy proxy minions
"""
(
proxy_one,
proxy_two,
proxy_three,
proxy_four,
) = pytest.helpers.proxy.delta_proxy_minion_ids()
minion_ids = pytest.helpers.proxy.delta_proxy_minion_ids()
dummy_proxy_pillar_file = """
proxy:
proxytype: dummy"""
top_file = """
base:
{control}:
- controlproxy
{one}:
- {one}
{two}:
- {two}
{three}:
- {three}
{four}:
- {four}
""".format(
control=salt_delta_proxy_factory.id,
one=proxy_one,
two=proxy_two,
three=proxy_three,
four=proxy_four,
)
controlproxy_pillar_file = """
proxy:
proxytype: deltaproxy
parallel_startup: {}
ids:
- {}
- {}
- {}
- {}
""".format(
request.param,
proxy_one,
proxy_two,
proxy_three,
proxy_four,
)
dummy_proxy_pillar_file = """
proxy:
proxytype: dummy
"""
top_file = """
base:
{control}:
- controlproxy""".format(
control=salt_delta_proxy_factory.id,
)
for minion_id in minion_ids:
top_file += """
{minion_id}:
- dummy""".format(
minion_id=minion_id,
)
controlproxy_pillar_file += """
- {}
""".format(
minion_id,
)
tempfiles = []
top_tempfile = salt_master.pillar_tree.base.temp_file("top.sls", top_file)
controlproxy_tempfile = salt_master.pillar_tree.base.temp_file(
"controlproxy.sls", controlproxy_pillar_file
)
dummy_proxy_one_tempfile = salt_master.pillar_tree.base.temp_file(
"{}.sls".format(proxy_one), dummy_proxy_pillar_file
tempfiles = [top_tempfile, controlproxy_tempfile]
dummy_proxy_tempfile = salt_master.pillar_tree.base.temp_file(
"dummy.sls", dummy_proxy_pillar_file
)
dummy_proxy_two_tempfile = salt_master.pillar_tree.base.temp_file(
"{}.sls".format(proxy_two), dummy_proxy_pillar_file
)
dummy_proxy_three_tempfile = salt_master.pillar_tree.base.temp_file(
"{}.sls".format(proxy_three), dummy_proxy_pillar_file
)
dummy_proxy_four_tempfile = salt_master.pillar_tree.base.temp_file(
"{}.sls".format(proxy_four), dummy_proxy_pillar_file
)
with top_tempfile, controlproxy_tempfile, dummy_proxy_one_tempfile, dummy_proxy_two_tempfile, dummy_proxy_three_tempfile, dummy_proxy_four_tempfile:
with top_tempfile, controlproxy_tempfile, dummy_proxy_tempfile:
yield

View file

@ -2,6 +2,7 @@
Simple Smoke Tests for Connected Proxy Minion
"""
import logging
import random
import pytest
@ -21,7 +22,7 @@ def skip_on_tcp_transport(request):
pytest.skip("Deltaproxy under the TPC transport is not working. See #61367")
@pytest.fixture(params=pytest.helpers.proxy.delta_proxy_minion_ids())
@pytest.fixture(params=random.sample(pytest.helpers.proxy.delta_proxy_minion_ids(), 4))
def proxy_id(request, salt_delta_proxy, skip_on_tcp_transport):
return request.param