Skip to content

Commit

Permalink
enrich existing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shaowei su committed Nov 30, 2022
1 parent dfea589 commit f354fdd
Showing 1 changed file with 88 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,14 @@ func newFakeTrials() []trialsv1beta1.Trial {
Type: trialsv1beta1.TrialSucceeded,
},
}

fakeEarlyStoppedConditions := []trialsv1beta1.TrialCondition{
{
Type: trialsv1beta1.TrialEarlyStopped,
Status: corev1.ConditionTrue,
},
}

return []trialsv1beta1.Trial{
{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -870,6 +878,54 @@ func newFakeTrials() []trialsv1beta1.Trial {
},
},
},
{
ObjectMeta: metav1.ObjectMeta{
Name: "trial4-name",
Namespace: "namespace",
},
Spec: trialsv1beta1.TrialSpec{
Objective: newFakeObjective(),
ParameterAssignments: []commonapiv1beta1.ParameterAssignment{
{
Name: "param1-name",
Value: "4",
},
{
Name: "param2-name",
Value: "0.4",
},
},
Labels: map[string]string{},
},
Status: trialsv1beta1.TrialStatus{
Conditions: fakeEarlyStoppedConditions,
Observation: nil,
},
},
{
ObjectMeta: metav1.ObjectMeta{
Name: "trial5-name",
Namespace: "namespace",
},
Spec: trialsv1beta1.TrialSpec{
Objective: newFakeObjective(),
ParameterAssignments: []commonapiv1beta1.ParameterAssignment{
{
Name: "param1-name",
Value: "5",
},
{
Name: "param2-name",
Value: "0.5",
},
},
Labels: map[string]string{},
},
Status: trialsv1beta1.TrialStatus{
Conditions: fakeEarlyStoppedConditions,
Observation: newFakeSuggestionTrialObservation(),
},
},
}
}

Expand Down Expand Up @@ -1020,6 +1076,38 @@ func newFakeRequest() *suggestionapi.GetSuggestionsRequest {
},
},
},
{
Name: "trial5-name",
Spec: &suggestionapi.TrialSpec{
Objective: fakeObjective,
ParameterAssignments: &suggestionapi.TrialSpec_ParameterAssignments{
Assignments: []*suggestionapi.ParameterAssignment{
{
Name: "param1-name",
Value: "5",
},
{
Name: "param2-name",
Value: "0.5",
},
},
},
Labels: fakeLabels,
},
Status: &suggestionapi.TrialStatus{
StartTime: "",
CompletionTime: "",
Condition: suggestionapi.TrialStatus_EARLYSTOPPED,
Observation: &suggestionapi.Observation{
Metrics: []*suggestionapi.Metric{
{
Name: "metric1-name",
Value: "0.95",
},
},
},
},
},
},
CurrentRequestNumber: 2,
TotalRequestNumber: 6,
Expand Down

0 comments on commit f354fdd

Please sign in to comment.