Skip to content
3 changes: 2 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ permissions:
jobs:
build:

runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.2', '8.3']

steps:
Expand Down
4 changes: 4 additions & 0 deletions src/OriginDetection.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ public function parseCgroupNodePath($lines)

public function getCgroupInode($cgroupMountPath, $procSelfCgroupPath)
{
if (!is_readable($procSelfCgroupPath)) {
return '';
}
Comment thread
vickenty marked this conversation as resolved.

$cgroupControllersPaths = $this->parseCgroupNodePath(file_get_contents($procSelfCgroupPath));

foreach ([self::CGROUPV1BASECONTROLLER , ''] as $controller) {
Expand Down
8 changes: 1 addition & 7 deletions tests/UnitTests/DogStatsd/OriginDetectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,6 @@ public function testParseContainerID() {
[
'input' => "1:name=systemd:/docker/34dc0b5e626f2c5c4c5170e34b10e7654ce36f0fcd532739f4445baabea03376.scope",
'expected' => "34dc0b5e626f2c5c4c5170e34b10e7654ce36f0fcd532739f4445baabea03376"
],
[
'input' => "1:name=systemd:/nope
2:pids:/docker/34dc0b5e626f2c5c4c5170e34b10e7654ce36f0fcd532739f4445baabea03376
3:cpu:/invalid",
'expected' => "34dc0b5e626f2c5c4c5170e34b10e7654ce36f0fcd532739f4445baabea03376"
]
];

Expand All @@ -87,7 +81,7 @@ public function testParseContainerID() {
->at($root);

$id = $originDetection->readContainerID(vfsStream::url('proc/self/cgroup'));
$this->assertSame($case['expected'], $id);
$this->assertSame($case['expected'], $id, $case['input']);
}
}

Expand Down
Loading