Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: supporting automated_failover, automated_failover_duplex policy in SM #2584

Merged
merged 3 commits into from
Jan 17, 2024
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
4 changes: 3 additions & 1 deletion cmd/collectors/commonutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,9 @@ func UpdateProtectedFields(instance *matrix.Instance) {
} else if policyType == "mirror_vault" {
instance.SetLabel("derived_relationship_type", "mirror_vault")
} else if policyType == "automated_failover" {
instance.SetLabel("derived_relationship_type", "sync_mirror")
instance.SetLabel("derived_relationship_type", "automated_failover")
} else if policyType == "automated_failover_duplex" {
instance.SetLabel("derived_relationship_type", "automated_failover_duplex")
} else {
instance.SetLabel("derived_relationship_type", relationshipType)
}
Expand Down
15 changes: 13 additions & 2 deletions cmd/collectors/commonutils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func TestUpdateProtectedFields(t *testing.T) {
testSyncMirror(t, instance)
testMirrorVault(t, instance)
testAutomatedFailover(t, instance)
testAutomatedFailoverDuplex(t, instance)
testOtherPolicyType(t, instance)
testWithNoPolicyType(t, instance)
testWithNoPolicyTypeNoRelationshipType(t, instance)
Expand Down Expand Up @@ -167,8 +168,18 @@ func testAutomatedFailover(t *testing.T, instance *matrix.Instance) {
instance.SetLabel("policy_type", "automated_failover")
UpdateProtectedFields(instance)

if instance.GetLabel("derived_relationship_type") != "sync_mirror" {
t.Errorf("Labels derived_relationship_type= %s, expected: sync_mirror", instance.GetLabel("derived_relationship_type"))
if instance.GetLabel("derived_relationship_type") != "automated_failover" {
t.Errorf("Labels derived_relationship_type= %s, expected: automated_failover", instance.GetLabel("derived_relationship_type"))
}
}

func testAutomatedFailoverDuplex(t *testing.T, instance *matrix.Instance) {
instance.SetLabel("relationship_type", "")
instance.SetLabel("policy_type", "automated_failover_duplex")
UpdateProtectedFields(instance)

if instance.GetLabel("derived_relationship_type") != "automated_failover_duplex" {
t.Errorf("Labels derived_relationship_type= %s, expected: automated_failover_duplex", instance.GetLabel("derived_relationship_type"))
}
}

Expand Down
15 changes: 13 additions & 2 deletions cmd/collectors/zapi/plugins/snapmirror/snapmirror_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func TestProtectedFields(t *testing.T) {
testSyncMirror(t, instance)
testMirrorVault(t, instance)
testAutomatedFailover(t, instance)
testAutomatedFailoverDuplex(t, instance)
testOtherPolicyType(t, instance)
testWithNoPolicyType(t, instance)
}
Expand Down Expand Up @@ -157,8 +158,18 @@ func testAutomatedFailover(t *testing.T, instance *matrix.Instance) {
instance.SetLabel("policy_type", "automated_failover")
collectors.UpdateProtectedFields(instance)

if instance.GetLabel("derived_relationship_type") != "sync_mirror" {
t.Errorf("Labels derived_relationship_type= %s, expected: sync_mirror", instance.GetLabel("derived_relationship_type"))
if instance.GetLabel("derived_relationship_type") != "automated_failover" {
t.Errorf("Labels derived_relationship_type= %s, expected: automated_failover", instance.GetLabel("derived_relationship_type"))
}
}

func testAutomatedFailoverDuplex(t *testing.T, instance *matrix.Instance) {
instance.SetLabel("relationship_type", "")
instance.SetLabel("policy_type", "automated_failover_duplex")
collectors.UpdateProtectedFields(instance)

if instance.GetLabel("derived_relationship_type") != "automated_failover_duplex" {
t.Errorf("Labels derived_relationship_type= %s, expected: automated_failover_duplex", instance.GetLabel("derived_relationship_type"))
}
}

Expand Down
Loading
Loading