Skip to content

Commit

Permalink
Fixing Unit test cases.
Browse files Browse the repository at this point in the history
Signed-off-by: satbir <satbir.singh@mayadata.io>
  • Loading branch information
satbirchhikara committed Dec 6, 2018
1 parent 5c1930f commit f4323c7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
3 changes: 2 additions & 1 deletion cmd/controller/disk.go
Expand Up @@ -44,6 +44,7 @@ type DiskInfo struct {
RotationRate uint16 // 0 = not reported. 1 = SSD, everything else is an RPM
Compliance string // Compliance is implemented specifications version i.e. SPC-1, SPC-2, etc
DiskType string // DiskType represents the type of disk like Disk, Sparse etc.,
DriveType string // DriveType represents the type of disk like HHD, HDD etc.,

//Stats of disk which keep changing
TotalBytesRead uint64
Expand Down Expand Up @@ -158,7 +159,7 @@ func (di *DiskInfo) getDiskDetails() apis.DiskDetails {
diskDetails.Vendor = di.Vendor
diskDetails.FirmwareRevision = di.FirmwareRevision
diskDetails.Compliance = di.Compliance
diskDetails.DiskType = di.DiskType
diskDetails.DriveType = di.DriveType
diskDetails.RotationRate = di.RotationRate
return diskDetails
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/probe/seachestprobe.go
Expand Up @@ -155,9 +155,9 @@ func (scp *seachestProbe) FillDiskDetails(d *controller.DiskInfo) {
glog.Infof("Disk: %s RotationRate:%d filled by seachest.", d.Path, d.RotationRate)
}

if d.DiskType == "" {
d.DiskType = seachestProbe.SeachestIdentifier.IsRotational(driveInfo)
glog.Infof("Disk: %s DiskType:%s filled by seachest.", d.Path, d.DiskType)
if d.DriveType == "" {
d.DriveType = seachestProbe.SeachestIdentifier.IsRotational(driveInfo)
glog.Infof("Disk: %s DriveType:%s filled by seachest.", d.Path, d.DriveType)
}

if d.TotalBytesRead == 0 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/openebs.io/v1alpha1/types.go
Expand Up @@ -41,7 +41,7 @@ type DiskCapacity struct {
// DiskDetails contains basic and static info of a disk
type DiskDetails struct {
RotationRate uint16 `json: "rotationRate"` // Disk rotation speed if disk is not SSD
DiskType string `json: "DiskType"` // DiskType represents the type of disk like Disk, Sparse etc.,
DriveType string `json: "driveType"` // DriveType represents the type of drive like SSD, HDD etc.,
Model string `json:"model"` // Model is model of disk
Compliance string `json:"compliance"` // Implemented standards/specifications version such as SPC-1, SPC-2, etc
Serial string `json:"serial"` // Serial is serial no of disk
Expand Down
10 changes: 5 additions & 5 deletions pkg/seachest/seachest.go
Expand Up @@ -34,13 +34,13 @@ package seachest
import "C"
import (
"fmt"
"unsafe"
"github.com/golang/glog"
"unsafe"
)

// Seachest errors are converted to string using this function
func SeachestErrors(err int) string {
seachestErrorSting := []string {
seachestErrorSting := []string{
"Success",
"Failed",
"Not Supported",
Expand All @@ -62,8 +62,8 @@ func SeachestErrors(err int) string {
"Cmd Blocked",
"Cmd Interrupted",
"Unknown",
}
return seachestErrorSting[err]
}
return seachestErrorSting[err]
}

// Identifier (devPath such as /dev/sda,etc) is an identifier for seachest probe
Expand Down Expand Up @@ -183,7 +183,7 @@ func (I *Identifier) GetDeviceUtilizationRate(driveInfo *C.driveInformationSAS_S
}

func (I *Identifier) GetPercentEnduranceUsed(driveInfo *C.driveInformationSAS_SATA) float64 {
if (driveInfo.percentEnduranceUsed != -1) {
if driveInfo.percentEnduranceUsed != -1 {
return ((float64)(driveInfo.percentEnduranceUsed))
}
return 0
Expand Down

0 comments on commit f4323c7

Please sign in to comment.