FOSSology  4.7.1
Open Source License Compliance by Open Source Software
AgentAdderTest Class Reference

Test for AgentAdder::agentsAdd(), covering the scheduling-order fix @runTestsInSeparateProcesses @preserveGlobalState disabled. More...

Inheritance diagram for AgentAdderTest:
Inheritance graph
Collaboration diagram for AgentAdderTest:
Collaboration graph

Public Member Functions

 testPlainAgentsAndReorderedParmAgentsRunBeforeDecider ()
 
 testScancodeScheduleAgentRunsBeforeItsOwnLeftoverAgentAddPass ()
 
 testRejectsNonArrayAgentsToStart ()
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 

Private Member Functions

 registerLoggingPlugin ($menu, $pluginName)
 
 mockContainer ($uploadFilename='test.tar')
 

Private Attributes

 $assertCountBefore
 
 $agentAdder
 
 $callLog
 

Detailed Description

Test for AgentAdder::agentsAdd(), covering the scheduling-order fix @runTestsInSeparateProcesses @preserveGlobalState disabled.

Isolated: loading the real AgentAdder class here would collide with ScanOptionsTest's Mockery::mock('overload:\AgentAdder') elsewhere in the suite.

Regression coverage for: plain agents (nomos/monk/ojo) must be queued before the ParmAgents loop (decider/kotoba, scancode), because decider (and kotoba, scheduled from it) resolves its scanner dependencies by checking whether they are already queued. Getting this order wrong either drops the dependency silently, or (for args-carrying ParmAgents like scancode) re-schedules the agent with no args before its real scheduleAgent() call runs.

Definition at line 36 of file AgentAdderTest.php.

Member Function Documentation

◆ registerLoggingPlugin()

AgentAdderTest::registerLoggingPlugin (   $menu,
  $pluginName 
)
private

Register a fake plugin under $pluginName that logs every AgentAdd()/ scheduleAgent() call (with the plugin name) into the shared call log.

Definition at line 85 of file AgentAdderTest.php.

◆ testPlainAgentsAndReorderedParmAgentsRunBeforeDecider()

AgentAdderTest::testPlainAgentsAndReorderedParmAgentsRunBeforeDecider ( )
Test:
  1. Select nomos (plain), decider+scancode (ParmAgents), where menu order puts decider before scancode (the real, alphabetically sorted case that caused the original bug).
  2. Verify nomos:AgentAdd runs before decider:scheduleAgent, and scancode:scheduleAgent also runs before decider:scheduleAgent.

Definition at line 140 of file AgentAdderTest.php.

◆ testRejectsNonArrayAgentsToStart()

AgentAdderTest::testRejectsNonArrayAgentsToStart ( )
Test:
  1. agentsToStart is not an array.
  2. Verify agentsAdd() returns the "bad parameters" error string instead of proceeding (pre-existing guard, unaffected by the fix).

Definition at line 205 of file AgentAdderTest.php.

◆ testScancodeScheduleAgentRunsBeforeItsOwnLeftoverAgentAddPass()

AgentAdderTest::testScancodeScheduleAgentRunsBeforeItsOwnLeftoverAgentAddPass ( )
Test:
  1. scancode's real scheduleAgent() call (with correct args, from the reordered ParmAgents loop) must run before the leftover bare AgentAdd() pass for any ParmAgent also present in agentsToStart.
  2. This is the invariant that keeps the pre-existing "picked directly from the raw agent list" case safe: the bare call becomes a no-op via IsAlreadyScheduled() only if the real call ran first.

Definition at line 177 of file AgentAdderTest.php.


The documentation for this class was generated from the following file: