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
23 changes: 23 additions & 0 deletions inttest/pmax_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,29 @@ func TestGetSymmetrix(t *testing.T) {
return
}
fmt.Printf("Symmetrix %s: %#v\n", symmetrixID, symmetrix)
if symmetrix.SymmetrixID == "" {
t.Error("Expected non-empty SymmetrixID")
}
if symmetrix.Model == "" {
t.Error("Expected non-empty Model")
}
if symmetrix.Microcode == "" {
t.Error("Expected non-empty Microcode")
}
if symmetrix.MicrocodeDate == "" {
t.Error("Expected non-empty MicrocodeDate")
}
if symmetrix.MicrocodeRegisteredBuild <= 0 {
t.Error("Expected MicrocodeRegisteredBuild > 0")
}
if symmetrix.MicrocodePackageVersion == "" {
t.Error("Expected non-empty MicrocodePackageVersion")
}
if symmetrix.DellServiceTag == "" {
t.Error("Expected non-empty DellServiceTag")
}
fmt.Printf("Microcode: %s, MicrocodeDate: %s, MicrocodeRegisteredBuild: %d, MicrocodePackageVersion: %s\n",
symmetrix.Microcode, symmetrix.MicrocodeDate, symmetrix.MicrocodeRegisteredBuild, symmetrix.MicrocodePackageVersion)
}

func TestGetVolumeIDs(t *testing.T) {
Expand Down
9 changes: 7 additions & 2 deletions mock/symmetrix46.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
{
"symmetrixId": "000197900046",
"dell_service_tag": "service-tag-46",
"device_count": 1045,
"ucode": "5978.221.221",
"model": "PowerMax_2000",
"model": "PowerMax_2500",
"local": true,
"all_flash": true,
"disk_count": 8,
"cache_size_mb": 203776,
"data_encryption": "Disabled"
"data_encryption": "Disabled",
"microcode": "6079.325.0",
"microcode_date": "09-30-2025",
"microcode_registered_build": 84,
"microcode_package_version": "10.3.0.0 (Release 01, Build 6079_325/0084, 2025-09-30 14:44:22)"
}
6 changes: 5 additions & 1 deletion mock/symmetrix47.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@
"all_flash": true,
"disk_count": 8,
"cache_size_mb": 203776,
"data_encryption": "Disabled"
"data_encryption": "Disabled",
"microcode": "5978.441.0",
"microcode_date": "06-15-2022",
"microcode_registered_build": 100,
"microcode_package_version": "9.2.1.0 (HotFix 10055, Build 5978_441/0100, 2022-06-15 10:00:00)"
}
6 changes: 5 additions & 1 deletion mock/symmetrix48.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@
"all_flash": true,
"disk_count": 8,
"cache_size_mb": 203776,
"data_encryption": "Disabled"
"data_encryption": "Disabled",
"microcode": "6079.325.0",
"microcode_date": "09-30-2025",
"microcode_registered_build": 84,
"microcode_package_version": "10.3.0.0 (Release 01, Build 6079_325/0084, 2025-09-30 14:44:22)"
}
95 changes: 95 additions & 0 deletions system_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,101 @@ func TestGetVersionDetails(t *testing.T) {
}
}

func TestGetSymmetrixByID(t *testing.T) {
// Test success case with new microcode fields
mockJSON := `{
"symmetrixId": "000197900046",
"dell_service_tag": "service-tag-46",
"device_count": 1045,
"ucode": "5978.221.221",
"model": "PowerMax_2500",
"local": true,
"all_flash": true,
"disk_count": 8,
"cache_size_mb": 203776,
"data_encryption": "Disabled",
"microcode": "6079.325.0",
"microcode_date": "09-30-2025",
"microcode_registered_build": 84,
"microcode_package_version": "10.3.0.0 (Release 01, Build 6079_325/0084, 2025-09-30 14:44:22)"
}`
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
w.Write([]byte(mockJSON))
}))
defer srv.Close()

client, err := NewClientWithArgs(srv.URL, "", true, false, "")
if err != nil {
t.Fatal(err)
}

sym, err := client.GetSymmetrixByID(context.Background(), "000197900046")
if err != nil {
t.Fatalf("Expected no error, got: %s", err.Error())
}
if sym.SymmetrixID != "000197900046" {
t.Errorf("Expected SymmetrixID 000197900046, got %s", sym.SymmetrixID)
}
if sym.DellServiceTag != "service-tag-46" {
t.Errorf("Expected DellServiceTag service-tag-46, got %s", sym.DellServiceTag)
}
if sym.Model != "PowerMax_2500" {
t.Errorf("Expected Model PowerMax_2500, got %s", sym.Model)
}
if !sym.Local {
t.Errorf("Expected Local true, got false")
}
if sym.Microcode != "6079.325.0" {
t.Errorf("Expected Microcode 6079.325.0, got %s", sym.Microcode)
}
if sym.MicrocodeDate != "09-30-2025" {
t.Errorf("Expected MicrocodeDate 09-30-2025, got %s", sym.MicrocodeDate)
}
if sym.MicrocodeRegisteredBuild != 84 {
t.Errorf("Expected MicrocodeRegisteredBuild 84, got %d", sym.MicrocodeRegisteredBuild)
}
if sym.MicrocodePackageVersion != "10.3.0.0 (Release 01, Build 6079_325/0084, 2025-09-30 14:44:22)" {
t.Errorf("Expected MicrocodePackageVersion, got %s", sym.MicrocodePackageVersion)
}

// Test HTTP error case
srvErr := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
http.Error(w, "Internal Error", http.StatusInternalServerError)
}))
defer srvErr.Close()

client, err = NewClientWithArgs(srvErr.URL, "", true, false, "")
if err != nil {
t.Fatal(err)
}

_, err = client.GetSymmetrixByID(context.Background(), "000197900046")
if err == nil {
t.Errorf("Expected error but got none")
} else {
fmt.Printf("Expected error received: %s\n", err.Error())
}

// Test decode error case (empty body)
srvEmpty := httptest.NewServer(http.HandlerFunc(func(_ http.ResponseWriter, _ *http.Request) {
}))
defer srvEmpty.Close()

client, err = NewClientWithArgs(srvEmpty.URL, "", true, false, "")
if err != nil {
t.Fatal(err)
}

_, err = client.GetSymmetrixByID(context.Background(), "000197900046")
if err == nil {
t.Errorf("Expected error but got none")
} else {
fmt.Printf("Expected error received: %s\n", err.Error())
}
}

func TestGetPorts(t *testing.T) {
// Create a mock server with error
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
Expand Down
46 changes: 25 additions & 21 deletions types/v100/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,31 @@ type SymmetrixIDList struct {

// Symmetrix : information about a Symmetrix system
type Symmetrix struct {
SymmetrixID string `json:"symmetrixId"`
DellServiceTag string `json:"dell_service_tag"`
DeviceCount int `json:"device_count"`
Ucode string `json:"ucode"`
UcodeDate string `json:"ucode_date"`
Model string `json:"model"`
Local bool `json:"local"`
AllFlash bool `json:"all_flash"`
DisplayName string `json:"display_name"`
DiskCount int `json:"disk_count"`
CacheSizeMB int `json:"cache_size_mb"`
DataEncryption string `json:"data_encryption"`
FEDirCount int `json:"fe_dir_count"`
BEDirCount int `json:"be_dir_count"`
RDFDirCount int `json:"rdf_dir_count"`
MaxHyperPerDisk int `json:"max_hyper_per_disk"`
VCMState string `json:"vcm_state"`
VCMDBState string `json:"vcmdb_state"`
ReliabilityState string `json:"reliability_state"`
UcodeRegisteredBuild int `json:"ucode_registered_build"`
SystemSizedProperty []SystemSizedProperty `json:"system_sized_property"`
SymmetrixID string `json:"symmetrixId"`
DellServiceTag string `json:"dell_service_tag"`
DeviceCount int `json:"device_count"`
Ucode string `json:"ucode"`
UcodeDate string `json:"ucode_date"`
Model string `json:"model"`
Local bool `json:"local"`
AllFlash bool `json:"all_flash"`
DisplayName string `json:"display_name"`
DiskCount int `json:"disk_count"`
CacheSizeMB int `json:"cache_size_mb"`
DataEncryption string `json:"data_encryption"`
FEDirCount int `json:"fe_dir_count"`
BEDirCount int `json:"be_dir_count"`
RDFDirCount int `json:"rdf_dir_count"`
MaxHyperPerDisk int `json:"max_hyper_per_disk"`
VCMState string `json:"vcm_state"`
VCMDBState string `json:"vcmdb_state"`
ReliabilityState string `json:"reliability_state"`
UcodeRegisteredBuild int `json:"ucode_registered_build"`
Microcode string `json:"microcode"`
MicrocodeDate string `json:"microcode_date"`
MicrocodeRegisteredBuild int `json:"microcode_registered_build"`
MicrocodePackageVersion string `json:"microcode_package_version"`
SystemSizedProperty []SystemSizedProperty `json:"system_sized_property"`
}

// SystemSizedProperty contains information about size data
Expand Down
3 changes: 3 additions & 0 deletions unit_steps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"runtime"
"strconv"
"strings"

Check failure on line 27 in unit_steps_test.go

View workflow job for this annotation

GitHub Actions / Golang Validation / Lint golang code

File is not properly formatted (gofumpt)
"github.com/dell/gopowermax/v2/mock"
types "github.com/dell/gopowermax/v2/types/v100"
"github.com/cucumber/godog"
Expand Down Expand Up @@ -613,6 +613,9 @@
if c.sym.SymmetrixID == "" || c.sym.Ucode == "" || c.sym.Model == "" || c.sym.DiskCount <= 0 {
return fmt.Errorf("Problem with Symmetrix fields SymmetrixID Ucode Model or DiskCount")
}
if c.sym.Microcode == "" || c.sym.MicrocodeDate == "" || c.sym.MicrocodeRegisteredBuild <= 0 || c.sym.MicrocodePackageVersion == "" {
return fmt.Errorf("Problem with Symmetrix fields Microcode MicrocodeDate MicrocodeRegisteredBuild or MicrocodePackageVersion")
}
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"strings"
"testing"

"github.com/cucumber/godog"
"github.com/dell/gopowermax/v2/mock"

Check failure on line 26 in unit_test.go

View workflow job for this annotation

GitHub Actions / Golang Validation / Lint golang code

File is not properly formatted (gofumpt)
"github.com/cucumber/godog"
)

var mockServer *httptest.Server
Expand Down
Loading