Skip to content

Commit

Permalink
Fix rebase issues
Browse files Browse the repository at this point in the history
  • Loading branch information
falfaroc committed Dec 18, 2024
1 parent fc70ca9 commit 160dbc4
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 74 deletions.
8 changes: 0 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,6 @@ github.com/dell/gocsi v1.12.0 h1:Dn/8f2BLovo57T/aC5pP/4Eqz4h6WX8SbX+hxT5NlvQ=
github.com/dell/gocsi v1.12.0/go.mod h1:hJURrmDrXDGW4xVtgi5Kx6zUsU3ht9l+nlreNx33rf0=
github.com/dell/gofsutil v1.17.0 h1:QA6gUb1mz8kXNEN4eEx47OHCz8nSqZrrCnaDUYmV5EY=
github.com/dell/gofsutil v1.17.0/go.mod h1:PN2hWl/pVLQiTsFR0X1x+GfhfOrfW8pGgH5xGcGMeFs=
github.com/dell/goscaleio v1.17.2-0.20241209165307-dcbadc33ab2e h1:Y+F8YP3ceH6XRz0phFV5VpS2Pmoi8f0Vtg261/C2pZo=
github.com/dell/goscaleio v1.17.2-0.20241209165307-dcbadc33ab2e/go.mod h1:7bX3rL8JWMmdifGr/UeD/Ju9wbkHUqvKDrbdu7XyGm8=
github.com/dell/goscaleio v1.17.2-0.20241213145027-141cfe292cfa h1:9honWWT9xEcI0OWyLtiWIDCaMAEpBAeyyzW+KPRVh10=
github.com/dell/goscaleio v1.17.2-0.20241213145027-141cfe292cfa/go.mod h1:7bX3rL8JWMmdifGr/UeD/Ju9wbkHUqvKDrbdu7XyGm8=
github.com/dell/goscaleio v1.17.2-0.20241213204026-19006b56eb26 h1:Kg6MSwBmAlmUDWRKiG0YJRv1xd8qi9+mW7vAVNnghj4=
github.com/dell/goscaleio v1.17.2-0.20241213204026-19006b56eb26/go.mod h1:7bX3rL8JWMmdifGr/UeD/Ju9wbkHUqvKDrbdu7XyGm8=
github.com/dell/goscaleio v1.17.2-0.20241213215244-2164caaef4ab h1:DYWY7fs8v1VbmzF2pAx7peZtKhkppW5NCIyHCJN1fS4=
github.com/dell/goscaleio v1.17.2-0.20241213215244-2164caaef4ab/go.mod h1:7bX3rL8JWMmdifGr/UeD/Ju9wbkHUqvKDrbdu7XyGm8=
github.com/dell/goscaleio v1.17.2-0.20241218182509-936b677c46d5 h1:d7DwHvp7/hESR742f4iurtH3nHHSGPvnMadujZA2hsU=
github.com/dell/goscaleio v1.17.2-0.20241218182509-936b677c46d5/go.mod h1:2BsR92dYYnSmbZ34ixYdsucfyoQBDlbhbUUKnv6WalQ=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
Expand Down
9 changes: 6 additions & 3 deletions service/preinit.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func getMdmList(connectionData []*ArrayConnectionData, key, zone string) (string

sb := &strings.Builder{}
for _, connectionData := range connectionData {
if connectionData.Mdm != "" && connectionData.Zone.LabelKey == key && connectionData.Zone.Name == zone {
if connectionData.Mdm != "" && connectionData.AvailabilityZone != nil && connectionData.AvailabilityZone.LabelKey == key && string(connectionData.AvailabilityZone.Name) == zone {
if sb.Len() > 0 {
sb.WriteString("\\&")
}
Expand All @@ -158,10 +158,13 @@ func getLabelKey(connectionData []*ArrayConnectionData) (string, error) {
return "", fmt.Errorf("array connection data is empty")
}

labelKey := connectionData[0].Zone.LabelKey
labelKey := ""
if connectionData[0].AvailabilityZone != nil {
labelKey = connectionData[0].AvailabilityZone.LabelKey
}

for _, v := range connectionData {
if v.Zone.LabelKey != labelKey {
if v.AvailabilityZone != nil && v.AvailabilityZone.LabelKey != labelKey {
return "", fmt.Errorf("zone label key is not the same for all arrays")
}
}
Expand Down
126 changes: 63 additions & 63 deletions service/preinit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ func TestPreInit(t *testing.T) {
name: "should error when zone labels different",
connectionInfo: []*ArrayConnectionData{
{
Zone: ZoneInfo{
AvailabilityZone: &AvailabilityZone{
LabelKey: "key1",
Name: "zone1",
},
},
{
Zone: ZoneInfo{
AvailabilityZone: &AvailabilityZone{
LabelKey: "key2",
Name: "zone1",
},
Expand Down Expand Up @@ -119,7 +119,7 @@ func TestPreInit(t *testing.T) {
connectionInfo: []*ArrayConnectionData{
{
Mdm: "192.168.1.1,192.168.1.2",
Zone: ZoneInfo{
AvailabilityZone: &AvailabilityZone{
LabelKey: "key1",
Name: "zone1",
},
Expand All @@ -133,7 +133,7 @@ func TestPreInit(t *testing.T) {
connectionInfo: []*ArrayConnectionData{
{
Mdm: "192.168.1.1,192.168.1.2",
Zone: ZoneInfo{
AvailabilityZone: &AvailabilityZone{
LabelKey: "key1",
Name: "zone1",
},
Expand All @@ -153,7 +153,7 @@ func TestPreInit(t *testing.T) {
connectionInfo: []*ArrayConnectionData{
{
Mdm: "192.168.1.1,192.168.1.2",
Zone: ZoneInfo{
AvailabilityZone: &AvailabilityZone{
LabelKey: "key1",
Name: "zone1",
},
Expand All @@ -173,14 +173,14 @@ func TestPreInit(t *testing.T) {
connectionInfo: []*ArrayConnectionData{
{
Mdm: "192.168.1.1,192.168.1.2",
Zone: ZoneInfo{
AvailabilityZone: &AvailabilityZone{
LabelKey: "key1",
Name: "zone1",
},
},
{
Mdm: "192.168.2.1,192.168.2.2",
Zone: ZoneInfo{
AvailabilityZone: &AvailabilityZone{
LabelKey: "key1",
Name: "zone2",
},
Expand Down Expand Up @@ -314,9 +314,9 @@ func TestGetMdmList(t *testing.T) {
name: "single MDM",
connectionInfo: []*ArrayConnectionData{
{
SystemID: "testSystemID",
Mdm: "192.168.0.10",
Zone: ZoneInfo{Name: "testZone", LabelKey: "testKey"},
SystemID: "testSystemID",
Mdm: "192.168.0.10",
AvailabilityZone: &AvailabilityZone{Name: "testZone", LabelKey: "testKey"},
},
},
key: "testKey",
Expand All @@ -328,9 +328,9 @@ func TestGetMdmList(t *testing.T) {
name: "two MDMs",
connectionInfo: []*ArrayConnectionData{
{
SystemID: "testSystemID",
Mdm: "192.168.0.10,192.168.0.20",
Zone: ZoneInfo{Name: "testZone", LabelKey: "testKey"},
SystemID: "testSystemID",
Mdm: "192.168.0.10,192.168.0.20",
AvailabilityZone: &AvailabilityZone{Name: "testZone", LabelKey: "testKey"},
},
},
key: "testKey",
Expand All @@ -342,14 +342,14 @@ func TestGetMdmList(t *testing.T) {
name: "two arrays",
connectionInfo: []*ArrayConnectionData{
{
SystemID: "testSystemID1",
Mdm: "192.168.0.10,192.168.0.20",
Zone: ZoneInfo{Name: "testZone", LabelKey: "testKey"},
SystemID: "testSystemID1",
Mdm: "192.168.0.10,192.168.0.20",
AvailabilityZone: &AvailabilityZone{Name: "testZone", LabelKey: "testKey"},
},
{
SystemID: "testSystemID2",
Mdm: "192.168.1.10,192.168.1.20",
Zone: ZoneInfo{Name: "testZone", LabelKey: "testKey"},
SystemID: "testSystemID2",
Mdm: "192.168.1.10,192.168.1.20",
AvailabilityZone: &AvailabilityZone{Name: "testZone", LabelKey: "testKey"},
},
},
key: "testKey",
Expand All @@ -361,14 +361,14 @@ func TestGetMdmList(t *testing.T) {
name: "two arrays with one MDM each",
connectionInfo: []*ArrayConnectionData{
{
SystemID: "testSystemID1",
Mdm: "192.168.0.10",
Zone: ZoneInfo{Name: "testZone", LabelKey: "testKey"},
SystemID: "testSystemID1",
Mdm: "192.168.0.10",
AvailabilityZone: &AvailabilityZone{Name: "testZone", LabelKey: "testKey"},
},
{
SystemID: "testSystemID2",
Mdm: "192.168.1.10",
Zone: ZoneInfo{Name: "testZone", LabelKey: "testKey"},
SystemID: "testSystemID2",
Mdm: "192.168.1.10",
AvailabilityZone: &AvailabilityZone{Name: "testZone", LabelKey: "testKey"},
},
},
key: "testKey",
Expand All @@ -380,14 +380,14 @@ func TestGetMdmList(t *testing.T) {
name: "two arrays with multiple zones 1",
connectionInfo: []*ArrayConnectionData{
{
SystemID: "testSystemID1",
Mdm: "192.168.0.10,192.168.0.20",
Zone: ZoneInfo{Name: "testZone1", LabelKey: "testKey"},
SystemID: "testSystemID1",
Mdm: "192.168.0.10,192.168.0.20",
AvailabilityZone: &AvailabilityZone{Name: "testZone1", LabelKey: "testKey"},
},
{
SystemID: "testSystemID2",
Mdm: "192.168.1.10,192.168.1.20",
Zone: ZoneInfo{Name: "testZone2", LabelKey: "testKey"},
SystemID: "testSystemID2",
Mdm: "192.168.1.10,192.168.1.20",
AvailabilityZone: &AvailabilityZone{Name: "testZone2", LabelKey: "testKey"},
},
},
key: "testKey",
Expand All @@ -399,14 +399,14 @@ func TestGetMdmList(t *testing.T) {
name: "two arrays with multiple zones 2",
connectionInfo: []*ArrayConnectionData{
{
SystemID: "testSystemID1",
Mdm: "192.168.0.10,192.168.0.20",
Zone: ZoneInfo{Name: "testZone1", LabelKey: "testKey"},
SystemID: "testSystemID1",
Mdm: "192.168.0.10,192.168.0.20",
AvailabilityZone: &AvailabilityZone{Name: "testZone1", LabelKey: "testKey"},
},
{
SystemID: "testSystemID2",
Mdm: "192.168.1.10,192.168.1.20",
Zone: ZoneInfo{Name: "testZone2", LabelKey: "testKey"},
SystemID: "testSystemID2",
Mdm: "192.168.1.10,192.168.1.20",
AvailabilityZone: &AvailabilityZone{Name: "testZone2", LabelKey: "testKey"},
},
},
key: "testKey",
Expand All @@ -418,14 +418,14 @@ func TestGetMdmList(t *testing.T) {
name: "two arrays in same zone with different keys 1",
connectionInfo: []*ArrayConnectionData{
{
SystemID: "testSystemID1",
Mdm: "192.168.0.10,192.168.0.20",
Zone: ZoneInfo{Name: "testZone", LabelKey: "testKey1"},
SystemID: "testSystemID1",
Mdm: "192.168.0.10,192.168.0.20",
AvailabilityZone: &AvailabilityZone{Name: "testZone", LabelKey: "testKey1"},
},
{
SystemID: "testSystemID2",
Mdm: "192.168.1.10,192.168.1.20",
Zone: ZoneInfo{Name: "testZone", LabelKey: "testKey2"},
SystemID: "testSystemID2",
Mdm: "192.168.1.10,192.168.1.20",
AvailabilityZone: &AvailabilityZone{Name: "testZone", LabelKey: "testKey2"},
},
},
key: "testKey1",
Expand All @@ -437,14 +437,14 @@ func TestGetMdmList(t *testing.T) {
name: "two arrays in same zone with different keys 2",
connectionInfo: []*ArrayConnectionData{
{
SystemID: "testSystemID1",
Mdm: "192.168.0.10,192.168.0.20",
Zone: ZoneInfo{Name: "testZone", LabelKey: "testKey1"},
SystemID: "testSystemID1",
Mdm: "192.168.0.10,192.168.0.20",
AvailabilityZone: &AvailabilityZone{Name: "testZone", LabelKey: "testKey1"},
},
{
SystemID: "testSystemID2",
Mdm: "192.168.1.10,192.168.1.20",
Zone: ZoneInfo{Name: "testZone", LabelKey: "testKey2"},
SystemID: "testSystemID2",
Mdm: "192.168.1.10,192.168.1.20",
AvailabilityZone: &AvailabilityZone{Name: "testZone", LabelKey: "testKey2"},
},
},
key: "testKey2",
Expand Down Expand Up @@ -498,12 +498,12 @@ func TestGetLabelKey(t *testing.T) {
name: "zone is not empty with different keys",
connectionInfo: []*ArrayConnectionData{
{
SystemID: "testSystemID1",
Zone: ZoneInfo{Name: "testZone", LabelKey: "testKey1"},
SystemID: "testSystemID1",
AvailabilityZone: &AvailabilityZone{Name: "testZone", LabelKey: "testKey1"},
},
{
SystemID: "testSystemID2",
Zone: ZoneInfo{Name: "testZone", LabelKey: "testKey2"},
SystemID: "testSystemID2",
AvailabilityZone: &AvailabilityZone{Name: "testZone", LabelKey: "testKey2"},
},
},
errorExpected: true,
Expand All @@ -516,8 +516,8 @@ func TestGetLabelKey(t *testing.T) {
SystemID: "testSystemID1",
},
{
SystemID: "testSystemID2",
Zone: ZoneInfo{Name: "testZone", LabelKey: "testKey1"},
SystemID: "testSystemID2",
AvailabilityZone: &AvailabilityZone{Name: "testZone", LabelKey: "testKey1"},
},
},
errorExpected: true,
Expand All @@ -527,12 +527,12 @@ func TestGetLabelKey(t *testing.T) {
name: "same key in all zones",
connectionInfo: []*ArrayConnectionData{
{
SystemID: "testSystemID1",
Zone: ZoneInfo{Name: "testZone", LabelKey: "testKey1"},
SystemID: "testSystemID1",
AvailabilityZone: &AvailabilityZone{Name: "testZone", LabelKey: "testKey1"},
},
{
SystemID: "testSystemID2",
Zone: ZoneInfo{Name: "testZone", LabelKey: "testKey1"},
SystemID: "testSystemID2",
AvailabilityZone: &AvailabilityZone{Name: "testZone", LabelKey: "testKey1"},
},
},
errorExpected: false,
Expand All @@ -542,12 +542,12 @@ func TestGetLabelKey(t *testing.T) {
name: "case sensitivity test for key",
connectionInfo: []*ArrayConnectionData{
{
SystemID: "testSystemID1",
Zone: ZoneInfo{Name: "testZone", LabelKey: "testKey1"},
SystemID: "testSystemID1",
AvailabilityZone: &AvailabilityZone{Name: "testZone", LabelKey: "testKey1"},
},
{
SystemID: "testSystemID2",
Zone: ZoneInfo{Name: "testZone", LabelKey: "TestKey1"},
SystemID: "testSystemID2",
AvailabilityZone: &AvailabilityZone{Name: "testZone", LabelKey: "TestKey1"},
},
},
errorExpected: true,
Expand Down

0 comments on commit 160dbc4

Please sign in to comment.