From bc341c2eeda5b1cc38d1e08bb065964c1e747b3c Mon Sep 17 00:00:00 2001 From: Rishabh Raj Date: Mon, 23 Feb 2026 02:07:54 -0500 Subject: [PATCH] Mirror internal repository with cleaned references --- inttest/pmax_integration_test.go | 23 ++++++++ mock/symmetrix46.json | 9 ++- mock/symmetrix47.json | 6 +- mock/symmetrix48.json | 6 +- system_test.go | 95 ++++++++++++++++++++++++++++++++ types/v100/types.go | 46 +++++++++------- unit_steps_test.go | 3 + unit_test.go | 2 +- 8 files changed, 164 insertions(+), 26 deletions(-) diff --git a/inttest/pmax_integration_test.go b/inttest/pmax_integration_test.go index c22377c..5ed18c2 100644 --- a/inttest/pmax_integration_test.go +++ b/inttest/pmax_integration_test.go @@ -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) { diff --git a/mock/symmetrix46.json b/mock/symmetrix46.json index bf8510f..7ff95e6 100644 --- a/mock/symmetrix46.json +++ b/mock/symmetrix46.json @@ -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)" } diff --git a/mock/symmetrix47.json b/mock/symmetrix47.json index c6d92b3..1a01e33 100644 --- a/mock/symmetrix47.json +++ b/mock/symmetrix47.json @@ -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)" } diff --git a/mock/symmetrix48.json b/mock/symmetrix48.json index fcf5614..51f6d1e 100644 --- a/mock/symmetrix48.json +++ b/mock/symmetrix48.json @@ -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)" } diff --git a/system_test.go b/system_test.go index 26545cc..c04bb36 100644 --- a/system_test.go +++ b/system_test.go @@ -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) { diff --git a/types/v100/types.go b/types/v100/types.go index 27cec49..fa357f0 100644 --- a/types/v100/types.go +++ b/types/v100/types.go @@ -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 diff --git a/unit_steps_test.go b/unit_steps_test.go index fb49776..82570c4 100644 --- a/unit_steps_test.go +++ b/unit_steps_test.go @@ -613,6 +613,9 @@ func (c *unitContext) iGetAValidSymmetrixObjectIfNoError() error { 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 } diff --git a/unit_test.go b/unit_test.go index bf9a961..ed95fe0 100644 --- a/unit_test.go +++ b/unit_test.go @@ -23,8 +23,8 @@ import ( "strings" "testing" - "github.com/cucumber/godog" "github.com/dell/gopowermax/v2/mock" + "github.com/cucumber/godog" ) var mockServer *httptest.Server