From 9416941f61008a7f7f5d34bfa60a633eb59bf67a Mon Sep 17 00:00:00 2001 From: Sven27 Date: Tue, 20 Jan 2026 10:04:38 +0530 Subject: [PATCH 1/3] GB value fix --- pkg/util/constants.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/util/constants.go b/pkg/util/constants.go index 37f652b..f17c60e 100644 --- a/pkg/util/constants.go +++ b/pkg/util/constants.go @@ -45,7 +45,7 @@ const ( // RAM in GiBs MinMem = 12 // Measure of a GiB in terms of bytes - GB = 1024 * 1024 + GB = 1024 * 1024 * 1024 // Disk size in GiBs MinDisk = 30 // Disk size in GiBs From 8f4271905b5c298581daad130138b779156a5671 Mon Sep 17 00:00:00 2001 From: Sven27 Date: Tue, 20 Jan 2026 13:12:55 +0530 Subject: [PATCH 2/3] callculating in bytes rather than KB --- pkg/platform/centos/centos.go | 4 ++-- pkg/platform/debian/debian.go | 5 ++--- pkg/platform/debian/debian_test.go | 18 +++++++++--------- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/pkg/platform/centos/centos.go b/pkg/platform/centos/centos.go index a383342..424bebf 100644 --- a/pkg/platform/centos/centos.go +++ b/pkg/platform/centos/centos.go @@ -280,7 +280,7 @@ func (c *CentOS) CheckMem() (bool, error) { } func (c *CentOS) CheckDisk() (bool, error) { - diskS, err := c.exec.RunWithStdout("bash", "-c", "df -k / --output=size | sed 1d | xargs | tr -d '\\n'") + diskS, err := c.exec.RunWithStdout("bash", "-c", "df -B1 / --output=size | sed 1d | xargs | tr -d '\\n'") if err != nil { return false, err } @@ -296,7 +296,7 @@ func (c *CentOS) CheckDisk() (bool, error) { zap.S().Debug("Total disk space: ", disk) - availS, err := c.exec.RunWithStdout("bash", "-c", "df -k / --output=avail | sed 1d | xargs | tr -d '\\n'") + availS, err := c.exec.RunWithStdout("bash", "-c", "df -B1 / --output=avail | sed 1d | xargs | tr -d '\\n'") if err != nil { return false, err } diff --git a/pkg/platform/debian/debian.go b/pkg/platform/debian/debian.go index 94ef685..0d4fc6d 100644 --- a/pkg/platform/debian/debian.go +++ b/pkg/platform/debian/debian.go @@ -212,7 +212,7 @@ func (d *Debian) checkMem() (bool, error) { } func (d *Debian) checkDisk() (bool, error) { - diskS, err := d.exec.RunWithStdout("bash", "-c", "df -k / --output=size | sed 1d | xargs | tr -d '\\n'") + diskS, err := d.exec.RunWithStdout("bash", "-c", "df -B1 / --output=size | sed 1d | xargs | tr -d '\\n'") if err != nil { return false, err } @@ -228,7 +228,7 @@ func (d *Debian) checkDisk() (bool, error) { zap.S().Debug("Total disk space: ", disk) - availS, err := d.exec.RunWithStdout("bash", "-c", "df -k / --output=avail | sed 1d | xargs | tr -d '\\n'") + availS, err := d.exec.RunWithStdout("bash", "-c", "df -B1 / --output=avail | sed 1d | xargs | tr -d '\\n'") if err != nil { return false, err } @@ -305,7 +305,6 @@ func (d *Debian) Version() (string, error) { isVersionMatch = true } - if isVersionMatch { return "debian", nil } diff --git a/pkg/platform/debian/debian_test.go b/pkg/platform/debian/debian_test.go index 4be984d..af8289e 100644 --- a/pkg/platform/debian/debian_test.go +++ b/pkg/platform/debian/debian_test.go @@ -15,7 +15,7 @@ type args struct { exec cmdexec.Executor } -//CPU check test case +// CPU check test case func TestCPU(t *testing.T) { type want struct { result bool @@ -71,7 +71,7 @@ func TestCPU(t *testing.T) { } } -//RAM check test case +// RAM check test case func TestRAM(t *testing.T) { type want struct { result bool @@ -127,7 +127,7 @@ func TestRAM(t *testing.T) { } } -//Sudo check test case +// Sudo check test case func TestSudo(t *testing.T) { type want struct { result bool @@ -184,7 +184,7 @@ func TestSudo(t *testing.T) { } } -//Port check test case +// Port check test case func TestPort(t *testing.T) { type want struct { result bool @@ -236,7 +236,7 @@ func TestPort(t *testing.T) { } } -//Disk check test case +// Disk check test case func TestDisk(t *testing.T) { type want struct { result bool @@ -253,7 +253,7 @@ func TestDisk(t *testing.T) { args: args{ exec: &cmdexec.MockExecutor{ MockRunWithStdout: func(name string, args ...string) (string, error) { - return "31457280", nil + return "32212254720", nil }, }, }, @@ -267,7 +267,7 @@ func TestDisk(t *testing.T) { args: args{ exec: &cmdexec.MockExecutor{ MockRunWithStdout: func(name string, args ...string) (string, error) { - return "15728640", nil + return "16106127360", nil }, }, }, @@ -291,7 +291,7 @@ func TestDisk(t *testing.T) { } } -//ExistingInstallation check test case +// ExistingInstallation check test case func TestExistingInstallation(t *testing.T) { type want struct { result bool @@ -403,7 +403,7 @@ func TestOSPackages(t *testing.T) { } } -//Test case for RemovePyCli check +// Test case for RemovePyCli check func TestRemovePyCli(t *testing.T) { type want struct { result bool From 526bf15f05069f972fea98da0dea788c03336ba4 Mon Sep 17 00:00:00 2001 From: Sven27 Date: Tue, 20 Jan 2026 13:20:49 +0530 Subject: [PATCH 3/3] callculating in bytes centos --- pkg/platform/centos/centos_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/platform/centos/centos_test.go b/pkg/platform/centos/centos_test.go index 20a7d6b..f5e5796 100644 --- a/pkg/platform/centos/centos_test.go +++ b/pkg/platform/centos/centos_test.go @@ -146,7 +146,7 @@ func TestDisk(t *testing.T) { args: args{ exec: &cmdexec.MockExecutor{ MockRunWithStdout: func(name string, args ...string) (string, error) { - return "31457280", nil + return "32212254720", nil }, }, }, @@ -160,7 +160,7 @@ func TestDisk(t *testing.T) { args: args{ exec: &cmdexec.MockExecutor{ MockRunWithStdout: func(name string, args ...string) (string, error) { - return "15728640", nil + return "16106127360", nil }, }, },