-
Notifications
You must be signed in to change notification settings - Fork 84
feat : e2e test for Model serving partition revision control #837
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
base: main
Are you sure you want to change the base?
Changes from 4 commits
75ee120
3bf6652
138da5a
189ef64
b1d2fcd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no need to change this part |
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -786,13 +786,13 @@ func (c *ModelServingController) manageRole(ctx context.Context, ms *workloadv1a | |||||||||||
| return fmt.Errorf("cannot get ServingGroup of modelServing: %s from map: %v", ms.GetName(), err) | ||||||||||||
| } | ||||||||||||
| partition := c.getPartition(ms) | ||||||||||||
| for index, servingGroup := range servingGroupList { | ||||||||||||
| for _, servingGroup := range servingGroupList { | ||||||||||||
| if c.store.GetServingGroupStatus(utils.GetNamespaceName(ms), servingGroup.Name) == datastore.ServingGroupDeleting { | ||||||||||||
| // Deleting ServingGroup will be recreated after the deletion is complete, so there is no need to scale the roles | ||||||||||||
| continue | ||||||||||||
| } | ||||||||||||
| _, servingGroupOrdinal := utils.GetParentNameAndOrdinal(servingGroup.Name) | ||||||||||||
| isPartitionProtected := partition > 0 && index < partition | ||||||||||||
| isPartitionProtected := partition > 0 && servingGroupOrdinal < partition | ||||||||||||
|
||||||||||||
| isPartitionProtected := partition > 0 && servingGroupOrdinal < partition | |
| if partition > 0 && servingGroupOrdinal < 0 { | |
| klog.Warningf("manageRole: invalid serving group name %s for partition protection, skipping protected revision logic", servingGroup.Name) | |
| } | |
| isPartitionProtected := partition > 0 && servingGroupOrdinal >= 0 && servingGroupOrdinal < partition |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -20,6 +20,8 @@ import ( | |||||
| "context" | ||||||
| "fmt" | ||||||
| "math/rand" | ||||||
| "strconv" | ||||||
| "strings" | ||||||
| "sync" | ||||||
| "testing" | ||||||
| "time" | ||||||
|
|
@@ -1234,6 +1236,348 @@ func TestLWSAPIBasic(t *testing.T) { | |||||
| t.Log("LWS API basic test passed successfully") | ||||||
| } | ||||||
|
|
||||||
| // TestModelServingPartitionBoundaryProtection verifies partition boundaries during rolling updates. | ||||||
| func TestModelServingPartitionBoundaryProtection(t *testing.T) { | ||||||
| ctx, kthenaClient, kubeClient := setupControllerManagerE2ETest(t) | ||||||
|
|
||||||
| const ( | ||||||
| replicas = int32(5) | ||||||
| partition = int32(3) | ||||||
| ) | ||||||
|
|
||||||
| modelServing := createPartitionedModelServing("test-partition-boundary", replicas, partition) | ||||||
| t.Logf("Creating ModelServing with %d replicas and partition=%d", replicas, partition) | ||||||
| createAndWaitForModelServing(t, ctx, kthenaClient, modelServing) | ||||||
|
|
||||||
| initialMS, err := kthenaClient.WorkloadV1alpha1().ModelServings(testNamespace).Get(ctx, modelServing.Name, metav1.GetOptions{}) | ||||||
| require.NoError(t, err) | ||||||
| initialRevision := initialMS.Status.CurrentRevision | ||||||
| t.Logf("Initial CurrentRevision: %s", initialMS.Status.CurrentRevision) | ||||||
| require.NotEmpty(t, initialRevision, "Initial CurrentRevision should be set") | ||||||
|
|
||||||
| updatedMS := initialMS.DeepCopy() | ||||||
| updatedMS.Spec.Template.Roles[0].EntryTemplate.Spec.Containers[0].Image = nginxAlpineImage | ||||||
| t.Logf("Updating image to %s", nginxAlpineImage) | ||||||
|
|
||||||
| _, err = kthenaClient.WorkloadV1alpha1().ModelServings(testNamespace).Update(ctx, updatedMS, metav1.UpdateOptions{}) | ||||||
| require.NoError(t, err) | ||||||
| utils.WaitForModelServingReady(t, ctx, kthenaClient, testNamespace, modelServing.Name) | ||||||
|
|
||||||
| updateRevision := waitForPartitionState(t, ctx, kthenaClient, kubeClient, modelServing.Name, partition, replicas, initialRevision) | ||||||
| assert.NotEqual(t, initialRevision, updateRevision) | ||||||
| } | ||||||
|
|
||||||
| // TestModelServingPartitionDeletedGroupHistoricalRevision verifies deleted groups | ||||||
| // within partition are rebuilt using historical revision. | ||||||
| func TestModelServingPartitionDeletedGroupHistoricalRevision(t *testing.T) { | ||||||
| ctx, kthenaClient, kubeClient := setupControllerManagerE2ETest(t) | ||||||
|
|
||||||
| const ( | ||||||
| replicas = int32(5) | ||||||
| partition = int32(3) | ||||||
| ) | ||||||
|
|
||||||
| modelServing := createPartitionedModelServing("test-partition-historical", replicas, partition) | ||||||
| modelServing.Spec.RecoveryPolicy = workload.RoleRecreate | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you set RoleRecreate
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because you are testing group partition below |
||||||
| t.Logf("Creating ModelServing with %d replicas and partition=%d", replicas, partition) | ||||||
| createAndWaitForModelServing(t, ctx, kthenaClient, modelServing) | ||||||
|
|
||||||
| initialMS, err := kthenaClient.WorkloadV1alpha1().ModelServings(testNamespace).Get(ctx, modelServing.Name, metav1.GetOptions{}) | ||||||
| require.NoError(t, err) | ||||||
| initialRevision := initialMS.Status.CurrentRevision | ||||||
| t.Logf("Initial CurrentRevision: %s", initialRevision) | ||||||
| require.NotEmpty(t, initialRevision, "Initial CurrentRevision should be set") | ||||||
|
|
||||||
| updatedMS := initialMS.DeepCopy() | ||||||
| updatedMS.Spec.Template.Roles[0].EntryTemplate.Spec.Containers[0].Image = nginxAlpineImage | ||||||
| t.Logf("Updating image to %s", nginxAlpineImage) | ||||||
|
|
||||||
| _, err = kthenaClient.WorkloadV1alpha1().ModelServings(testNamespace).Update(ctx, updatedMS, metav1.UpdateOptions{}) | ||||||
| require.NoError(t, err) | ||||||
| utils.WaitForModelServingReady(t, ctx, kthenaClient, testNamespace, modelServing.Name) | ||||||
|
|
||||||
| updateRevision := waitForPartitionState(t, ctx, kthenaClient, kubeClient, modelServing.Name, partition, replicas, initialRevision) | ||||||
| t.Log("Partitioned update established") | ||||||
|
|
||||||
| targetOrdinal := 1 | ||||||
| targetGroupName := fmt.Sprintf("%s-%d", modelServing.Name, targetOrdinal) | ||||||
| labelSelector := fmt.Sprintf("modelserving.volcano.sh/group-name=%s", targetGroupName) | ||||||
|
||||||
| labelSelector := fmt.Sprintf("modelserving.volcano.sh/group-name=%s", targetGroupName) | |
| labelSelector := fmt.Sprintf("%s=%s", workload.GroupNameLabelKey, targetGroupName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This timed out.
Not sure if this is releated to current PR from @LiZhenCheng9527
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe test manually
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure i understand, if this is fort e2e test, why do you change this file