Skip to content

Commit

Permalink
fix(test): TestVolumeLifeCycle
Browse files Browse the repository at this point in the history
longhorn/longhorn-1992

Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
  • Loading branch information
c3y1huang authored and innobead committed Jun 30, 2024
1 parent 521f26c commit ce53ab1
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion controller/volume_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,38 @@ func (s *TestSuite) TestVolumeLifeCycle(c *C) {
tc.nodes[i].Spec.AllowScheduling = false
}
tc.copyCurrentToExpect()
// replicas and engine object would still be created
// replica object would not be created
tc.replicas = nil
// engine object would still be created
tc.engines = nil
for _, r := range tc.expectReplicas {
r.Spec.NodeID = ""
r.Spec.DiskID = ""
r.Spec.DiskPath = ""
r.Spec.DataDirectoryName = ""
}
tc.expectVolume.Status.State = longhorn.VolumeStateCreating
tc.expectVolume.Status.CurrentImage = tc.volume.Spec.Image
tc.expectVolume.Status.Robustness = longhorn.VolumeRobustnessFaulted
testCases["volume create - replica creation failure"] = tc

// unable to create volume because no node to schedule
tc = generateVolumeTestCaseTemplate()
for i := range tc.nodes {
tc.nodes[i].Spec.AllowScheduling = false
}
tc.copyCurrentToExpect()
// engine object would still be created
tc.engines = nil
for _, r := range tc.expectReplicas {
r.Spec.NodeID = ""
r.Spec.DiskID = ""
r.Spec.DiskPath = ""
r.Spec.DataDirectoryName = ""
}
// replica object is already created
tc.replicas = tc.expectReplicas

tc.expectVolume.Status.State = longhorn.VolumeStateCreating
tc.expectVolume.Status.CurrentImage = tc.volume.Spec.Image
tc.expectVolume.Status.Conditions = setVolumeConditionWithoutTimestamp(tc.expectVolume.Status.Conditions,
Expand Down

0 comments on commit ce53ab1

Please sign in to comment.