Repository navigation
Conversation
tests/integration/client/test_syndic.py has never tested a syndic (saltstack#58975). SaltClientTestCaseMixin caches one LocalClient for the whole session, built from the config of the first test class that asks for it. When other client tests run first, TestSyndic gets the master's client and pings the regular minion. When it runs on its own, which is what happens on PRs that touch salt/minion.py through tests/filename_map.yml, the client points at a syndic master that nothing starts, and both tests fail. - Cache one client per config. - Start the syndic master and the syndic for the module, and target the minion behind the syndic. - Build the syndic factory with the current salt-factories arguments. The nested defaults were written out as literal master, minion and syndic keys, so none of them applied. The syndic's master also needs the master of masters' publish_port, since that's the port the syndic subscribes on, as in tests/pytests/scenarios/syndic. - Remove tests/integration/files/conf/syndic, which only that fixture read.
67e3bec to
74d13d7
Compare
| } | ||
| config_overrides = {"log_level_logfile": "info"} | ||
| master_overrides = { | ||
| "interface": interface, |
There was a problem hiding this comment.
why do we need to override interface and publish_port here given it is the same value as default?
There was a problem hiding this comment.
You're right, they're redundant. salt-factories writes the syndic's config to conf/master.d/syndic.conf, and the syndic's master reads master.d from the same conf dir, so config_defaults already sets them on that master. Dropped them in 172cf3d; the tests still pass on zeromq and tcp, which they can't unless that master really listens on 127.0.0.2 with the shared publish_port.
| # The syndic subscribes to the master of masters on its own master's | ||
| # publish_port, so both masters need the same publish_port, and the | ||
| # syndic's master listens on another address. | ||
| interface = "127.0.0.2" |
There was a problem hiding this comment.
MacOS only has 127.0.0.1, this might fail on MacOS
There was a problem hiding this comment.
Good catch. Added the same ifconfig lo0 alias 127.0.0.2 up that tests/pytests/integration/minion/conftest.py and the failover multimaster scenario use on macOS and FreeBSD, in 172cf3d. I can't run it on macOS here, so that part is untested.
What does this PR do?
Makes
tests/integration/client/test_syndic.pysend its jobs through a syndic, which it has never done (#58975).SaltClientTestCaseMixin.clientcaches oneLocalClientfor the whole session, built from the config of the first test class that asks for it. In a full run other client tests come first, soTestSyndicgets the master's client and pings the regular minion, and passes. When it runs on its own, the client points atsyndic_master, which no fixture starts, andtest_pingandtest_fibfail with "The salt master could not be contacted". PR runs that touchsalt/minion.pyrun it on its own, throughtests/filename_map.yml. That's why all the Linux and Windows integration jobs on #70423 fail in these two tests and nothing else.SaltClientTestCaseMixincaches one client per config.test_syndic.pystarts the syndic master and the syndic for the module, andSyndicCasetargets the minion behind the syndic.salt_syndic_factoryuses the current salt-factories arguments. The nested{"master": None, "minion": None, "syndic": {...}}defaults were written out as literal keys insyndic.conf, so none of them applied. The syndic's master also gets the master of masters'publish_porton 127.0.0.2, as intests/pytests/scenarios/syndic/sync/conftest.py, because the syndic subscribes to the master of masters on its own master'spublish_port. The fixture also stops the syndic's master and minion when the syndic is terminated, as the scenario does.tests/integration/files/conf/syndicis removed, since only that fixture read it.What issues does this PR fix or reference?
Refs #58975, #70423
Previous Behavior
TestSyndicpassed in full runs without going through a syndic, and failed when run on its own.New Behavior
TestSyndicsendstest.pingandtest.fibthrough the syndic master, the syndic and the syndic's master to the syndic's minion. It passes on its own and after the other client tests.Merge requirements satisfied?
Tests only, so no changelog entry.
Locally on Linux with Python 3.14,
pytest tests/integration/client/test_syndic.py --slow-tests --core-testsfails both tests on 3008.x and passes with this change, with both--transport=zeromqand--transport=tcp.tests/integration/client/as a whole (test_kwarg,test_standard, thentest_syndic) passes, 18 tests. I haven't run it on Windows.Commits signed with GPG?
No