Skip to content

Conversation

@ConstrictM
Copy link
Contributor

Example Output on FreeBSD:

Device          1K-blocks     Used    Avail Capacity
/dev/vtbd0p3     22801388 11607904 11193484    51%

Example Output on TrueNAS CORE:

Device          1K-blocks     Used    Avail Capacity
/dev/mirror/swap0.eli  16777216        0 16777216     0%
/dev/mirror/swap1.eli   2097152        0  2097152     0%
/dev/mirror/swap2.eli   2097152        0  2097152     0%
/dev/mirror/swap3.eli   2097152        0  2097152     0%
/dev/mirror/swap4.eli   2097152        0  2097152     0%
Total            25165824        0 25165824     0%

Broken:
image

Fixed:
image

@kesselb
Copy link
Collaborator

kesselb commented Mar 4, 2023

Thanks for your pull request 👍

Can you add a test for it?

@ConstrictM
Copy link
Contributor Author

@kesselb I'm not sure if I did that correctly, but I added a test. Please let me know if I have to correct it.

@kesselb
Copy link
Collaborator

kesselb commented Mar 7, 2023

Thank you 👍

@kesselb
Copy link
Collaborator

kesselb commented Mar 7, 2023

Please apply the patch to fix the unit tests:

Index: tests/lib/FreeBSDTest.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/tests/lib/FreeBSDTest.php b/tests/lib/FreeBSDTest.php
--- a/tests/lib/FreeBSDTest.php	(revision beacafe4e724b453942fedfeb49fe4da378030f3)
+++ b/tests/lib/FreeBSDTest.php	(date 1678187528355)
@@ -99,10 +99,10 @@
 
 	public function testGetMemoryTruenasSwapinfo(): void {
 		$this->os->method('executeCommand')
-			->willReturnMap(
+			->willReturnMap([
 				['/usr/sbin/swapinfo -k', file_get_contents(__DIR__ . '/../data/truenas_core_swapinfo')],
 				['/sbin/sysctl -n hw.realmem hw.pagesize vm.stats.vm.v_inactive_count vm.stats.vm.v_cache_count vm.stats.vm.v_free_count', file_get_contents(__DIR__ . '/../data/truenas_core_meminfo')],
-			);
+			]);
 
 		$memory = $this->os->getMemory();

@ConstrictM
Copy link
Contributor Author

Please apply the patch to fix the unit tests:

@kesselb Done

@kesselb kesselb merged commit 96386f8 into nextcloud:master Mar 7, 2023
@kesselb
Copy link
Collaborator

kesselb commented Mar 7, 2023

/backport to stable26

@kesselb
Copy link
Collaborator

kesselb commented Mar 7, 2023

/backport to stable25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants