Skip to content

Commit

Permalink
changed dir loc
Browse files Browse the repository at this point in the history
Signed-off-by: Tejaswi Bondila <bondila.venkatatejaswi@progress.com>
  • Loading branch information
bvtejaswi committed Aug 25, 2023
1 parent f0180a3 commit 5f85123
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
Expand Up @@ -95,7 +95,7 @@ func TestSystemResourceAPI(t *testing.T) {
{
Title: "Temp free space check",
Passed: true,
SuccessMsg: fmt.Sprintf("/tmp should have free space >=%vGB or %v%% of total size of /hab", constants.TMP_FREE_DISK_IN_GB, constants.TMP_FREE_DISK_IN_PER*100),
SuccessMsg: fmt.Sprintf("/var/tmp should have free space >=%vGB or %v%% of total size of /hab", constants.TMP_FREE_DISK_IN_GB, constants.TMP_FREE_DISK_IN_PER*100),
ErrorMsg: "",
ResolutionMsg: "",
},
Expand Down
Expand Up @@ -50,7 +50,7 @@ func (srs *SystemResourcesServiceImpl) GetSystemResourcesForDeployment(nodeType
habFreeSpaceCheck := srs.CheckHabFreeSpace(nodeType, deploymentState)
srsResponse.Checks = append(srsResponse.Checks, *habFreeSpaceCheck)

tmpFreeSpaceCheck := srs.CheckFreeDiskSpaceOfDir("/tmp", constants.TMP_FREE_DISK_IN_PER, constants.TMP_FREE_DISK_IN_GB, "Temp")
tmpFreeSpaceCheck := srs.CheckFreeDiskSpaceOfDir("/var/tmp", constants.TMP_FREE_DISK_IN_PER, constants.TMP_FREE_DISK_IN_GB, "Temp")
srsResponse.Checks = append(srsResponse.Checks, *tmpFreeSpaceCheck)

rootFreeSpaceCheck := srs.CheckFreeDiskSpaceOfDir("/", constants.ROOT_FREE_DISK_IN_PER, constants.ROOT_FREE_DISK_IN_GB, "/(root volume)")
Expand Down
Expand Up @@ -155,8 +155,8 @@ func TestGetFreeDiskSpaceCheckOfDir(t *testing.T) {

testCasesTmpSpaceCheck := []testCase{
{
testCaseDescription: "Checking free disk in /tmp",
respWant: srv.GetChecksModel(true, fmt.Sprintf(constants.FREE_SPACE_CHECK, "Temp"), fmt.Sprintf(constants.SUCCESS_MSG, "/tmp", constants.TMP_FREE_DISK_IN_GB)+fmt.Sprintf(constants.SUCCESS_MSG_IN_PER, constants.TMP_FREE_DISK_IN_PER*100), "", ""),
testCaseDescription: "Checking free disk in /var/tmp",
respWant: srv.GetChecksModel(true, fmt.Sprintf(constants.FREE_SPACE_CHECK, "Temp"), fmt.Sprintf(constants.SUCCESS_MSG, "/var/tmp", constants.TMP_FREE_DISK_IN_GB)+fmt.Sprintf(constants.SUCCESS_MSG_IN_PER, constants.TMP_FREE_DISK_IN_PER*100), "", ""),
mockSystemResource: &systemresource.MockSystemResourceInfoImpl{
GetDiskSpaceInfoFunc: func(s string) (disk.UsageStat, error) {
return disk.UsageStat{
Expand All @@ -170,8 +170,8 @@ func TestGetFreeDiskSpaceCheckOfDir(t *testing.T) {
},
},
{
testCaseDescription: "Checking free disk in /tmp",
respWant: srv.GetChecksModel(false, fmt.Sprintf(constants.FREE_SPACE_CHECK, "Temp"), "", fmt.Sprintf(constants.ERROR_MSG, "/tmp", float64(9)), fmt.Sprintf(constants.SUCCESS_MSG, "/tmp", constants.TMP_FREE_DISK_IN_GB)+fmt.Sprintf(constants.SUCCESS_MSG_IN_PER, constants.TMP_FREE_DISK_IN_PER*100)),
testCaseDescription: "Checking free disk in /var/tmp",
respWant: srv.GetChecksModel(false, fmt.Sprintf(constants.FREE_SPACE_CHECK, "Temp"), "", fmt.Sprintf(constants.ERROR_MSG, "/var/tmp", float64(9)), fmt.Sprintf(constants.SUCCESS_MSG, "/var/tmp", constants.TMP_FREE_DISK_IN_GB)+fmt.Sprintf(constants.SUCCESS_MSG_IN_PER, constants.TMP_FREE_DISK_IN_PER*100)),
mockSystemResource: &systemresource.MockSystemResourceInfoImpl{
GetDiskSpaceInfoFunc: func(s string) (disk.UsageStat, error) {
return disk.UsageStat{
Expand All @@ -185,8 +185,8 @@ func TestGetFreeDiskSpaceCheckOfDir(t *testing.T) {
},
},
{
testCaseDescription: "Checking free disk in /tmp",
respWant: srv.GetChecksModel(true, fmt.Sprintf(constants.FREE_SPACE_CHECK, "Temp"), fmt.Sprintf(constants.SUCCESS_MSG, "/tmp", constants.TMP_FREE_DISK_IN_GB)+fmt.Sprintf(constants.SUCCESS_MSG_IN_PER, constants.TMP_FREE_DISK_IN_PER*100), "", ""),
testCaseDescription: "Checking free disk in /var/tmp",
respWant: srv.GetChecksModel(true, fmt.Sprintf(constants.FREE_SPACE_CHECK, "Temp"), fmt.Sprintf(constants.SUCCESS_MSG, "/var/tmp", constants.TMP_FREE_DISK_IN_GB)+fmt.Sprintf(constants.SUCCESS_MSG_IN_PER, constants.TMP_FREE_DISK_IN_PER*100), "", ""),
mockSystemResource: &systemresource.MockSystemResourceInfoImpl{
GetDiskSpaceInfoFunc: func(s string) (disk.UsageStat, error) {
return disk.UsageStat{
Expand All @@ -200,8 +200,8 @@ func TestGetFreeDiskSpaceCheckOfDir(t *testing.T) {
},
},
{
testCaseDescription: "Checking free disk in /tmp",
respWant: srv.GetChecksModel(false, fmt.Sprintf(constants.FREE_SPACE_CHECK, "Temp"), "", fmt.Sprintf(constants.ERROR_MSG, "/tmp", float64(14)), fmt.Sprintf(constants.SUCCESS_MSG, "/tmp", constants.TMP_FREE_DISK_IN_GB)+fmt.Sprintf(constants.SUCCESS_MSG_IN_PER, constants.TMP_FREE_DISK_IN_PER*100)),
testCaseDescription: "Checking free disk in /var/tmp",
respWant: srv.GetChecksModel(false, fmt.Sprintf(constants.FREE_SPACE_CHECK, "Temp"), "", fmt.Sprintf(constants.ERROR_MSG, "/var/tmp", float64(14)), fmt.Sprintf(constants.SUCCESS_MSG, "/var/tmp", constants.TMP_FREE_DISK_IN_GB)+fmt.Sprintf(constants.SUCCESS_MSG_IN_PER, constants.TMP_FREE_DISK_IN_PER*100)),
mockSystemResource: &systemresource.MockSystemResourceInfoImpl{
GetDiskSpaceInfoFunc: func(s string) (disk.UsageStat, error) {
return disk.UsageStat{
Expand All @@ -215,7 +215,7 @@ func TestGetFreeDiskSpaceCheckOfDir(t *testing.T) {
},
},
{
testCaseDescription: "Checking free disk in /tmp | error",
testCaseDescription: "Checking free disk in /var/tmp | error",
respWant: srv.GetChecksModel(false, fmt.Sprintf(constants.FREE_SPACE_CHECK, "Temp"), "", "error occured while fetching tmp disk space", constants.RESOLUTION_MSG),
mockSystemResource: &systemresource.MockSystemResourceInfoImpl{
GetDiskSpaceInfoFunc: func(s string) (disk.UsageStat, error) {
Expand All @@ -232,7 +232,7 @@ func TestGetFreeDiskSpaceCheckOfDir(t *testing.T) {
t.Run(testCase.testCaseDescription, func(t *testing.T) {
srv.SystemResourceInfo = testCase.mockSystemResource
srv.Fileutils = testCase.mockFileUtils
respGet := srv.CheckFreeDiskSpaceOfDir("/tmp", constants.TMP_FREE_DISK_IN_PER, constants.TMP_FREE_DISK_IN_GB, "Temp")
respGet := srv.CheckFreeDiskSpaceOfDir("/var/tmp", constants.TMP_FREE_DISK_IN_PER, constants.TMP_FREE_DISK_IN_GB, "Temp")
assert.Equal(t, testCase.respWant, respGet)
})
}
Expand Down Expand Up @@ -604,7 +604,7 @@ func TestGetSystemResourcesForDeployment(t *testing.T) {
*srv.GetChecksModel(true, constants.CPU_SPEED_CHECK_TITLE, fmt.Sprintf("CPU speed should be >=%vGHz", constants.MIN_CPU_SPEED), "", ""),
*srv.GetChecksModel(true, constants.MEMORY_SIZE_CHECK_TITLE, fmt.Sprintf("Memory should be >=%vGB", constants.MIN_MEMORY), "", ""),
*srv.GetChecksModel(true, fmt.Sprintf(constants.FREE_SPACE_CHECK, "Hab"), fmt.Sprintf(constants.SUCCESS_MSG, "/hab", constants.HAB_FREE_DISK_BEFORE_DEP_A2), "", ""),
*srv.GetChecksModel(true, fmt.Sprintf(constants.FREE_SPACE_CHECK, "Temp"), fmt.Sprintf(constants.SUCCESS_MSG, "/tmp", constants.TMP_FREE_DISK_IN_GB)+fmt.Sprintf(constants.SUCCESS_MSG_IN_PER, constants.TMP_FREE_DISK_IN_PER*100), "", ""),
*srv.GetChecksModel(true, fmt.Sprintf(constants.FREE_SPACE_CHECK, "Temp"), fmt.Sprintf(constants.SUCCESS_MSG, "/var/tmp", constants.TMP_FREE_DISK_IN_GB)+fmt.Sprintf(constants.SUCCESS_MSG_IN_PER, constants.TMP_FREE_DISK_IN_PER*100), "", ""),
*srv.GetChecksModel(true, fmt.Sprintf(constants.FREE_SPACE_CHECK, "/(root volume)"), fmt.Sprintf(constants.SUCCESS_MSG, "/(root volume)", constants.ROOT_FREE_DISK_IN_GB)+fmt.Sprintf(constants.SUCCESS_MSG_IN_PER, constants.ROOT_FREE_DISK_IN_PER*100), "", ""),
}

Expand Down

0 comments on commit 5f85123

Please sign in to comment.