-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added CGroupv2 support into Docker Extensions #839
Changes from 6 commits
15b1b51
4cb146d
cb8f573
7ff1941
aad5630
94be6e9
856fed7
fd0c8e4
5ba7994
78a5a62
14ce9b1
492552d
a3647b3
9e05aba
b5857f0
7b7e580
ba6b6ab
d043c33
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,6 +57,13 @@ public class DockerResourceDetectorTests | |
private const string CONTAINERID = | ||
"d86d75589bf6cc254f3e2cc29debdf85dde404998aa128997a819ff991827356"; | ||
|
||
// cgroupv2 line with container Id | ||
private const string CGROUPLINEV2 = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do you also need to check suffix or prefix for cgroup v2? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can check for them as they are separate implementations. I figured that most of the functionality was similar enough to warrant not having them but I believe you are correct that they should exist, although the suffix isn't a necessary test in my opinion since its not a real case I believe. |
||
"13:name=systemd:/pod/d86d75589bf6cc254f3e2cc29debdf85dde404998aa128997a819ff991827356/hostname"; | ||
|
||
// Expected Container Id | ||
private const string CONTAINERIDV2 = "d86d75589bf6cc254f3e2cc29debdf85dde404998aa128997a819ff991827356"; | ||
|
||
[Fact] | ||
public void TestValidContainer() | ||
{ | ||
|
@@ -85,6 +92,12 @@ public void TestValidContainer() | |
tempFile.Write(CGROUPLINE); | ||
Assert.Equal(CONTAINERID, this.GetContainerId(dockerResourceDetector.BuildResource(tempFile.FilePath))); | ||
} | ||
|
||
using (TempFile tempFile = new TempFile()) | ||
{ | ||
tempFile.Write(CGROUPLINEV2); | ||
Assert.Equal(CONTAINERIDV2, this.GetContainerId(dockerResourceDetector.BuildResource(tempFile.FilePath))); | ||
} | ||
} | ||
|
||
[Fact] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any usage of
FILEPATHV2
in detector. I'd guess, thatExtractContainerIdV2
should use it, instead ofFILEPATH
. Proper fix for it will also solve problem mentioned by @alexeypukhov , as that functions should check different file.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change has been made to check both versions in the Detect method and assuming the version being used in the BuildResource method. This way, the problem mentioned by @alexeypukhov would be solved as you mentioned since no container id would be able to be found when checking for cgroupv1 if cgroupv2 is being used.