Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/platform/centos/centos.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/platform/centos/centos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
},
},
Expand All @@ -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
},
},
},
Expand Down
5 changes: 2 additions & 3 deletions pkg/platform/debian/debian.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down Expand Up @@ -305,7 +305,6 @@ func (d *Debian) Version() (string, error) {
isVersionMatch = true
}


if isVersionMatch {
return "debian", nil
}
Expand Down
18 changes: 9 additions & 9 deletions pkg/platform/debian/debian_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
},
},
},
Expand All @@ -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
},
},
},
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment thread
Sven27 marked this conversation as resolved.
// Disk size in GiBs
MinDisk = 30
// Disk size in GiBs
Expand Down
Loading