Added downstream(), and fixed failing tests in RoutingTest
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 42s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m48s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s

This commit is contained in:
2024-05-10 21:33:02 +10:00
parent edee0643ec
commit cd2efbd1d4
3 changed files with 52 additions and 15 deletions

View File

@@ -107,7 +107,7 @@ class RoutingTest extends TestCase
$ao = Address::findFTN('101:0/0@a');
$this->assertEquals($ao->role_id,Address::NODE_ZC);
$this->assertCount(0,$ao->downlinks());
$this->assertCount(0,$ao->downstream());
$this->assertNull($ao->uplink());
}
@@ -117,7 +117,7 @@ class RoutingTest extends TestCase
$this->session_zc();
$ao = Address::findFTN('101:0/0@a');
$this->assertCount(935,$ao->downlinks());
$this->assertCount(935,$ao->downstream());
}
// An RC's parent should be the ZC, when we have session details with parent
@@ -136,7 +136,7 @@ class RoutingTest extends TestCase
$this->session_rc();
$ao = Address::findFTN('100:1/0@a');
$this->assertEquals(185,$ao->downlinks()->count());
$this->assertCount(185,$ao->downstream());
}
// An RCs node still collects mail from the RC
@@ -199,7 +199,7 @@ class RoutingTest extends TestCase
$this->session_nc();
$ao = Address::findFTN('100:1/0@a');
$this->assertCount(185-36,$ao->downlinks());
$this->assertCount(185-36,$ao->downstream());
}
// If we also have session details for an Hub, then there are less RC nodes
@@ -211,7 +211,7 @@ class RoutingTest extends TestCase
$ao->system->sessions()->attach([$ao->zone_id=>['sespass'=>'ABCD']]);
$ao = Address::findFTN('100:1/0@a');
$this->assertCount(185-6,$ao->downlinks());
$this->assertCount(185,$ao->downstream());
$ao = Address::findFTN('100:10/22@a');
$this->assertEquals('100:10/20.0@a',$ao->uplink()->ftn);
@@ -232,7 +232,7 @@ class RoutingTest extends TestCase
$this->session_nc();
$ao = Address::findFTN('100:10/0@a');
$this->assertCount(35,$ao->downlinks());
$this->assertCount(35,$ao->downstream());
}
public function test_complex_rc_nc_hc()
@@ -242,26 +242,26 @@ class RoutingTest extends TestCase
$this->session_hub();
$ao = Address::findFTN('100:1/100.0@a');
$this->assertCount(0,$ao->downlinks());
$this->assertCount(0,$ao->downstream());
$this->assertEquals('100:1/0.0@a',$ao->uplink()->ftn);
// RC
$ao = Address::findFTN('100:1/0.0@a');
$this->assertCount(186-1-30-6,$ao->downlinks());
$this->assertCount(186-1-30-6,$ao->downstream());
$ao = Address::findFTN('100:11/0.0@a');
$this->assertEquals('100:1/0.0@a',$ao->uplink()->ftn);
// NC
$ao = Address::findFTN('100:10/0.0@a');
$this->assertCount(36-1-6,$ao->downlinks());
$this->assertCount(36-1-6,$ao->downstream());
$ao = Address::findFTN('100:10/10.0@a');
$this->assertEquals('100:10/0.0@a',$ao->uplink()->ftn);
// HC
$ao = Address::findFTN('100:10/20.0@a');
$this->assertCount(6-1,$ao->downlinks());
$this->assertCount(6-1,$ao->downstream());
$ao = Address::findFTN('100:10/22.0@a');
$this->assertEquals('100:10/20.0@a',$ao->uplink()->ftn);
@@ -283,26 +283,26 @@ class RoutingTest extends TestCase
$ao->system->sessions()->attach([$ao->zone_id=>['sespass'=>'ABCD']]);
$ao = Address::findFTN('100:1/100.0@a');
$this->assertCount(0,$ao->downlinks());
$this->assertCount(0,$ao->downstream());
$this->assertEquals('100:1/0.0@a',$ao->uplink()?->ftn);
// RC
$ao = Address::findFTN('100:1/0.0@a');
$this->assertCount(186-36-36-1,$ao->downlinks());
$this->assertCount(186-36-36-1,$ao->downstream());
$ao = Address::findFTN('100:11/0.0@a');
$this->assertEquals('100:11/0.0@a',$ao->uplink()->ftn);
// NC
$ao = Address::findFTN('100:10/0.0@a');
$this->assertCount(36-6-1,$ao->downlinks());
$this->assertCount(36-6-1,$ao->downstream());
$ao = Address::findFTN('100:10/10.0@a');
$this->assertNull($ao->uplink()?->ftn);
// HC
$ao = Address::findFTN('100:10/20.0@a');
$this->assertCount(6-1,$ao->downlinks());
$this->assertCount(6-1,$ao->downstream());
$ao = Address::findFTN('100:10/22.0@a');
$this->assertEquals('100:10/20.0@a',$ao->uplink()->ftn);
@@ -333,6 +333,6 @@ class RoutingTest extends TestCase
$this->assertEquals('100:10/21.0@a',$ao->uplink()?->ftn);
$ao = Address::findFTN('100:10/21@a');
$this->assertCount(1,$ao->downlinks());
$this->assertCount(1,$ao->downstream());
}
}