Mock astext (#14581)

* Mock astext
avoid dns failures

* whitespace

* fix arista

* restore test data except astext

* restore test data except astext

* Full fresh run

* Move DI call into class
This commit is contained in:
Tony Murray
2022-11-05 01:18:52 +01:00
committed by GitHub
parent 126696e26b
commit 6cbe6fde4f
31 changed files with 255 additions and 252 deletions
+11
View File
@@ -530,6 +530,17 @@ class ModuleTestHelper
Config::set('rrd.enable', false); // disable rrd
Config::set('rrdtool_version', '1.7.2'); // don't detect rrdtool version, rrdtool is not install on ci
// don't allow external DNS queries that could fail
app()->bind(\LibreNMS\Util\AutonomousSystem::class, function ($app, $parameters) {
$asn = $parameters['asn'];
$mock = \Mockery::mock(\LibreNMS\Util\AutonomousSystem::class);
$mock->shouldReceive('name')->withAnyArgs()->zeroOrMoreTimes()->andReturnUsing(function () use ($asn) {
return "AS$asn-MOCK-TEXT";
});
return $mock;
});
if (! is_file($this->snmprec_file)) {
throw new FileNotFoundException("$this->snmprec_file does not exist!");
}