From c33da9d929629d2a6d70493339ac17940c2169c9 Mon Sep 17 00:00:00 2001 From: Xu Xiao Date: Tue, 28 Jul 2020 01:24:17 +0800 Subject: [PATCH] support trial meta injection in trial template rendering (#1259) * support trial meta injection in trial template rendering * use trialSpec.metadata as prefix of trialMeta reference * solve conflicts * add some comments on consts * apply gofmt * refactor * fix mock test * refine --- pkg/controller.v1beta1/consts/const.go | 23 ++++- .../experiment/experiment_controller_test.go | 3 +- .../experiment/experiment_util.go | 10 ++ .../experiment/manifest/generator.go | 99 +++++++++++++++---- .../experiment/manifest/generator_test.go | 37 ++++++- pkg/mock/v1alpha3/api/manager.go | 34 +++---- pkg/mock/v1alpha3/api/suggestion.go | 26 ++--- pkg/mock/v1alpha3/db/db.go | 36 +++---- .../v1alpha3/experiment/manifest/generator.go | 28 +++--- .../experiment/suggestion/suggestion.go | 20 ++-- .../trial/managerclient/katibmanager.go | 26 ++--- .../v1alpha3/util/katibclient/katibclient.go | 64 ++++++------ pkg/mock/v1beta1/api/suggestion.go | 26 ++--- pkg/mock/v1beta1/db/db.go | 36 +++---- .../v1beta1/experiment/manifest/generator.go | 28 +++--- .../experiment/suggestion/suggestion.go | 20 ++-- .../trial/managerclient/katibmanager.go | 26 ++--- .../v1beta1/util/katibclient/katibclient.go | 60 +++++------ .../v1beta1/experiment/validator/validator.go | 6 +- 19 files changed, 362 insertions(+), 246 deletions(-) diff --git a/pkg/controller.v1beta1/consts/const.go b/pkg/controller.v1beta1/consts/const.go index 841828e414a..13df96e8edd 100644 --- a/pkg/controller.v1beta1/consts/const.go +++ b/pkg/controller.v1beta1/consts/const.go @@ -140,12 +140,25 @@ const ( // LabelTrialTemplateConfigMapValue is the label value for the Trial templates configMap LabelTrialTemplateConfigMapValue = "katib-trial-templates" - // TrialTemplateReplaceFormat is the format to make substitution in Trial template from Names in TrialParameters + // TrialTemplateParamReplaceFormat is the format to make substitution in Trial template from Names in TrialParameters // E.g if Name = learningRate, according value in Trial template must be ${trialParameters.learningRate} - TrialTemplateReplaceFormat = "${trialParameters.%v}" - - // TrialTemplateReplaceFormatRegex is the regex for Trial template format - TrialTemplateReplaceFormatRegex = "\\{trialParameters\\..+?\\}" + TrialTemplateParamReplaceFormat = "${trialParameters.%v}" + + // TrialTemplateParamReplaceFormatRegex is the regex for TrialParameters format in Trial template + TrialTemplateParamReplaceFormatRegex = "\\$\\{trialParameters\\..+?\\}" + + // TrialTemplateMetaReplaceFormatRegex is the regex for TrialMetadata format in Trial template + TrialTemplateMetaReplaceFormatRegex = "\\$\\{trialSpec\\.(.+?)\\}" + // TrialTemplateMetaParseFormatRegex is the regex to parse the index of Annotations and Labels from meta key + TrialTemplateMetaParseFormatRegex = "(.+)\\[(.+)]" + + // valid keys of trial metadata which are used to make substitution in Trial template + TrialTemplateMetaKeyOfName = "Name" + TrialTemplateMetaKeyOfNamespace = "Namespace" + TrialTemplateMetaKeyOfKind = "Kind" + TrialTemplateMetaKeyOfAPIVersion = "APIVersion" + TrialTemplateMetaKeyOfAnnotations = "Annotations" + TrialTemplateMetaKeyOfLabels = "Labels" // UnavailableMetricValue is the value when metric was not reported or metric value can't be converted to float64 UnavailableMetricValue = "unavailable" diff --git a/pkg/controller.v1beta1/experiment/experiment_controller_test.go b/pkg/controller.v1beta1/experiment/experiment_controller_test.go index d7382a6c6b4..0587d41de47 100644 --- a/pkg/controller.v1beta1/experiment/experiment_controller_test.go +++ b/pkg/controller.v1beta1/experiment/experiment_controller_test.go @@ -201,8 +201,7 @@ func TestReconcileExperiment(t *testing.T) { if err != nil { t.Errorf("ConvertObjectToUnstructured failed: %v", err) } - generator.EXPECT().GetRunSpecWithHyperParameters(gomock.Any(), gomock.Any(), - gomock.Any(), gomock.Any()).Return( + generator.EXPECT().GetRunSpecWithHyperParameters(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return( returnedUnstructured, nil).AnyTimes() diff --git a/pkg/controller.v1beta1/experiment/experiment_util.go b/pkg/controller.v1beta1/experiment/experiment_util.go index 410a37f880f..d8f29b6cbc7 100644 --- a/pkg/controller.v1beta1/experiment/experiment_util.go +++ b/pkg/controller.v1beta1/experiment/experiment_util.go @@ -2,6 +2,7 @@ package experiment import ( "context" + "github.com/kubeflow/katib/pkg/controller.v1beta1/consts" "k8s.io/apimachinery/pkg/api/errors" @@ -61,6 +62,15 @@ func (r *ReconcileExperiment) createTrialInstance(expInstance *experimentsv1beta } +func buildTrialMetaForRunSpec(trial *trialsv1beta1.Trial) map[string]string { + return map[string]string{ + consts.TrialTemplateMetaKeyOfName: trial.Name, + consts.TrialTemplateMetaKeyOfNamespace: trial.Namespace, + consts.TrialTemplateMetaKeyOfKind: trial.Kind, + consts.TrialTemplateMetaKeyOfAPIVersion: trial.APIVersion, + } +} + func needUpdateFinalizers(exp *experimentsv1beta1.Experiment) (bool, []string) { deleted := !exp.ObjectMeta.DeletionTimestamp.IsZero() pendingFinalizers := exp.GetFinalizers() diff --git a/pkg/controller.v1beta1/experiment/manifest/generator.go b/pkg/controller.v1beta1/experiment/manifest/generator.go index f132db1a71a..ce0d720e881 100644 --- a/pkg/controller.v1beta1/experiment/manifest/generator.go +++ b/pkg/controller.v1beta1/experiment/manifest/generator.go @@ -3,6 +3,7 @@ package manifest import ( "errors" "fmt" + "regexp" "strings" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -12,7 +13,7 @@ import ( commonapiv1beta1 "github.com/kubeflow/katib/pkg/apis/controller/common/v1beta1" experimentsv1beta1 "github.com/kubeflow/katib/pkg/apis/controller/experiments/v1beta1" "github.com/kubeflow/katib/pkg/controller.v1beta1/consts" - util "github.com/kubeflow/katib/pkg/controller.v1beta1/util" + "github.com/kubeflow/katib/pkg/controller.v1beta1/util" "github.com/kubeflow/katib/pkg/util/v1beta1/katibclient" "github.com/kubeflow/katib/pkg/util/v1beta1/katibconfig" ) @@ -62,14 +63,8 @@ func (g *DefaultGenerator) GetSuggestionConfigData(algorithmName string) (map[st // GetRunSpecWithHyperParameters returns the specification for trial with hyperparameters. func (g *DefaultGenerator) GetRunSpecWithHyperParameters(experiment *experimentsv1beta1.Experiment, trialName, trialNamespace string, assignments []commonapiv1beta1.ParameterAssignment) (*unstructured.Unstructured, error) { - // Get string Trial template from Experiment spec - trialTemplate, err := g.GetTrialTemplate(experiment) - if err != nil { - return nil, err - } - // Apply parameters to Trial Template from assignment - replacedTemplate, err := g.applyParameters(trialTemplate, experiment.Spec.TrialTemplate.TrialParameters, assignments) + replacedTemplate, err := g.applyParameters(experiment, trialName, trialNamespace, assignments) if err != nil { return nil, err } @@ -86,26 +81,92 @@ func (g *DefaultGenerator) GetRunSpecWithHyperParameters(experiment *experiments return runSpec, nil } -func (g *DefaultGenerator) applyParameters(trialTemplate string, trialParams []experimentsv1beta1.TrialParameterSpec, assignments []commonapiv1beta1.ParameterAssignment) (string, error) { - // Number of parameters must be equal - if len(assignments) != len(trialParams) { - return "", fmt.Errorf("Number of Trial assignment from Suggestion: %v not equal to number Trial parameters from Experiment: %v", len(assignments), len(trialParams)) +func (g *DefaultGenerator) applyParameters(experiment *experimentsv1beta1.Experiment, trialName, trialNamespace string, assignments []commonapiv1beta1.ParameterAssignment) (string, error) { + // Get string Trial template from Experiment spec + trialTemplate, err := g.GetTrialTemplate(experiment) + if err != nil { + return "", err + } + + trialSpec := experiment.Spec.TrialTemplate.TrialSpec + // If trialSpec is not defined in TrialTemplate, deserialize templateString to fetch it + if trialSpec == nil { + trialSpec, err = util.ConvertStringToUnstructured(trialTemplate) + if err != nil { + return "", fmt.Errorf("ConvertStringToUnstructured failed: %v", err) + } } + // Convert parameter assignment to map key = parameter name, value = parameter value assignmentsMap := make(map[string]string) for _, assignment := range assignments { assignmentsMap[assignment.Name] = assignment.Value } - // Replacing parameters from Trial parameters - for _, parameter := range trialParams { - - if parameterValue, ok := assignmentsMap[parameter.Reference]; ok { - trialTemplate = strings.Replace(trialTemplate, fmt.Sprintf(consts.TrialTemplateReplaceFormat, parameter.Name), parameterValue, -1) - } else { - return "", fmt.Errorf("Unable to find parameter: %v in parameter assignment %v", parameter.Reference, assignmentsMap) + placeHolderToValueMap := make(map[string]string) + var metaRefKey, metaRefIndex string + nonMetaParamCount := 0 + for _, param := range experiment.Spec.TrialTemplate.TrialParameters { + metaMatchRegex := regexp.MustCompile(consts.TrialTemplateMetaReplaceFormatRegex) + sub := metaMatchRegex.FindStringSubmatch(param.Reference) + // handle trial parameters which consume trial assignments + if len(sub) == 0 { + if value, ok := assignmentsMap[param.Reference]; ok { + placeHolderToValueMap[param.Name] = value + nonMetaParamCount += 1 + continue + } else { + return "", fmt.Errorf("Unable to find parameter: %v in parameter assignment %v", param.Reference, assignmentsMap) + } + } + metaRefKey = sub[1] + + // handle trial parameters which consume trial meta data + // extract index (key) of Labels and Annotations if exists + if sub := regexp.MustCompile(consts.TrialTemplateMetaParseFormatRegex).FindStringSubmatch(metaRefKey); len(sub) > 0 { + if len(sub) != 3 { + return "", fmt.Errorf("illegal reference of trial metadata: %v", param.Reference) + } + metaRefKey = sub[1] + metaRefIndex = sub[2] + } + // fetch metadata value + switch metaRefKey { + case consts.TrialTemplateMetaKeyOfName: + placeHolderToValueMap[param.Name] = trialName + case consts.TrialTemplateMetaKeyOfNamespace: + placeHolderToValueMap[param.Name] = trialNamespace + case consts.TrialTemplateMetaKeyOfKind: + placeHolderToValueMap[param.Name] = trialSpec.GetKind() + case consts.TrialTemplateMetaKeyOfAPIVersion: + placeHolderToValueMap[param.Name] = trialSpec.GetAPIVersion() + case consts.TrialTemplateMetaKeyOfAnnotations: + if value, ok := trialSpec.GetAnnotations()[metaRefIndex]; !ok { + return "", fmt.Errorf("illegal reference of trial metadata: %v; failed to fetch Annotation: %v", param.Reference, metaRefIndex) + } else { + placeHolderToValueMap[param.Name] = value + } + case consts.TrialTemplateMetaKeyOfLabels: + if value, ok := trialSpec.GetLabels()[metaRefIndex]; !ok { + return "", fmt.Errorf("illegal reference of trial metadata: %v; failed to fetch Label: %v", param.Reference, metaRefIndex) + } else { + placeHolderToValueMap[param.Name] = value + } + default: + return "", fmt.Errorf("illegal reference of trial metadata: %v", param.Reference) } } + + // Number of parameters must be equal + if len(assignments) != nonMetaParamCount { + return "", fmt.Errorf("Number of TrialAssignment: %v != number of nonMetaTrialParameters in TrialSpec: %v", len(assignments), nonMetaParamCount) + } + + // Replacing placeholders with parameter values + for placeHolder, paramValue := range placeHolderToValueMap { + trialTemplate = strings.Replace(trialTemplate, fmt.Sprintf(consts.TrialTemplateParamReplaceFormat, placeHolder), paramValue, -1) + } + return trialTemplate, nil } diff --git a/pkg/controller.v1beta1/experiment/manifest/generator_test.go b/pkg/controller.v1beta1/experiment/manifest/generator_test.go index df687c53eb4..7f6a0686ed9 100644 --- a/pkg/controller.v1beta1/experiment/manifest/generator_test.go +++ b/pkg/controller.v1beta1/experiment/manifest/generator_test.go @@ -2,6 +2,7 @@ package manifest import ( "errors" + "github.com/kubeflow/katib/pkg/controller.v1beta1/consts" "math" "reflect" "testing" @@ -9,10 +10,10 @@ import ( "github.com/golang/mock/gomock" commonapiv1beta1 "github.com/kubeflow/katib/pkg/apis/controller/common/v1beta1" experimentsv1beta1 "github.com/kubeflow/katib/pkg/apis/controller/experiments/v1beta1" - util "github.com/kubeflow/katib/pkg/controller.v1beta1/util" + "github.com/kubeflow/katib/pkg/controller.v1beta1/util" katibclientmock "github.com/kubeflow/katib/pkg/mock/v1beta1/util/katibclient" batchv1 "k8s.io/api/batch/v1" - v1 "k8s.io/api/core/v1" + "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" ) @@ -50,6 +51,12 @@ func TestGetRunSpecWithHP(t *testing.T) { "--lr=0.05", "--num-layers=5", }, + Env: []v1.EnvVar{ + {Name: consts.TrialTemplateMetaKeyOfName, Value: "trial-name"}, + {Name: consts.TrialTemplateMetaKeyOfNamespace, Value: "trial-namespace"}, + {Name: consts.TrialTemplateMetaKeyOfKind, Value: "Job"}, + {Name: consts.TrialTemplateMetaKeyOfAPIVersion, Value: "batch/v1"}, + }, }, }, }, @@ -330,6 +337,12 @@ func newFakeInstance() *experimentsv1beta1.Experiment { "--lr=${trialParameters.learningRate}", "--num-layers=${trialParameters.numberLayers}", }, + Env: []v1.EnvVar{ + {Name: consts.TrialTemplateMetaKeyOfName, Value: "${trialParameters.trialName}"}, + {Name: consts.TrialTemplateMetaKeyOfNamespace, Value: "${trialParameters.trialNamespace}"}, + {Name: consts.TrialTemplateMetaKeyOfKind, Value: "${trialParameters.jobKind}"}, + {Name: consts.TrialTemplateMetaKeyOfAPIVersion, Value: "${trialParameters.jobAPIVersion}"}, + }, }, }, }, @@ -355,6 +368,26 @@ func newFakeInstance() *experimentsv1beta1.Experiment { Description: "Number of layers", Reference: "num-layers", }, + { + Name: "trialName", + Description: "name of current trial", + Reference: "${trialSpec.Name}", + }, + { + Name: "trialNamespace", + Description: "namespace of current trial", + Reference: "${trialSpec.Namespace}", + }, + { + Name: "jobKind", + Description: "job kind of current trial", + Reference: "${trialSpec.Kind}", + }, + { + Name: "jobAPIVersion", + Description: "job API Version of current trial", + Reference: "${trialSpec.APIVersion}", + }, }, }, }, diff --git a/pkg/mock/v1alpha3/api/manager.go b/pkg/mock/v1alpha3/api/manager.go index cea1810745a..238e6d58a2c 100644 --- a/pkg/mock/v1alpha3/api/manager.go +++ b/pkg/mock/v1alpha3/api/manager.go @@ -7,88 +7,88 @@ package mock import ( context "context" gomock "github.com/golang/mock/gomock" - v1alpha3 "github.com/kubeflow/katib/pkg/apis/manager/v1alpha3" + api_v1_alpha3 "github.com/kubeflow/katib/pkg/apis/manager/v1alpha3" grpc "google.golang.org/grpc" reflect "reflect" ) -// MockManagerClient is a mock of ManagerClient interface +// MockManagerClient is a mock of ManagerClient interface. type MockManagerClient struct { ctrl *gomock.Controller recorder *MockManagerClientMockRecorder } -// MockManagerClientMockRecorder is the mock recorder for MockManagerClient +// MockManagerClientMockRecorder is the mock recorder for MockManagerClient. type MockManagerClientMockRecorder struct { mock *MockManagerClient } -// NewMockManagerClient creates a new mock instance +// NewMockManagerClient creates a new mock instance. func NewMockManagerClient(ctrl *gomock.Controller) *MockManagerClient { mock := &MockManagerClient{ctrl: ctrl} mock.recorder = &MockManagerClientMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockManagerClient) EXPECT() *MockManagerClientMockRecorder { return m.recorder } -// DeleteObservationLog mocks base method -func (m *MockManagerClient) DeleteObservationLog(arg0 context.Context, arg1 *v1alpha3.DeleteObservationLogRequest, arg2 ...grpc.CallOption) (*v1alpha3.DeleteObservationLogReply, error) { +// DeleteObservationLog mocks base method. +func (m *MockManagerClient) DeleteObservationLog(arg0 context.Context, arg1 *api_v1_alpha3.DeleteObservationLogRequest, arg2 ...grpc.CallOption) (*api_v1_alpha3.DeleteObservationLogReply, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0, arg1} for _, a := range arg2 { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "DeleteObservationLog", varargs...) - ret0, _ := ret[0].(*v1alpha3.DeleteObservationLogReply) + ret0, _ := ret[0].(*api_v1_alpha3.DeleteObservationLogReply) ret1, _ := ret[1].(error) return ret0, ret1 } -// DeleteObservationLog indicates an expected call of DeleteObservationLog +// DeleteObservationLog indicates an expected call of DeleteObservationLog. func (mr *MockManagerClientMockRecorder) DeleteObservationLog(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{arg0, arg1}, arg2...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteObservationLog", reflect.TypeOf((*MockManagerClient)(nil).DeleteObservationLog), varargs...) } -// GetObservationLog mocks base method -func (m *MockManagerClient) GetObservationLog(arg0 context.Context, arg1 *v1alpha3.GetObservationLogRequest, arg2 ...grpc.CallOption) (*v1alpha3.GetObservationLogReply, error) { +// GetObservationLog mocks base method. +func (m *MockManagerClient) GetObservationLog(arg0 context.Context, arg1 *api_v1_alpha3.GetObservationLogRequest, arg2 ...grpc.CallOption) (*api_v1_alpha3.GetObservationLogReply, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0, arg1} for _, a := range arg2 { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetObservationLog", varargs...) - ret0, _ := ret[0].(*v1alpha3.GetObservationLogReply) + ret0, _ := ret[0].(*api_v1_alpha3.GetObservationLogReply) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetObservationLog indicates an expected call of GetObservationLog +// GetObservationLog indicates an expected call of GetObservationLog. func (mr *MockManagerClientMockRecorder) GetObservationLog(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{arg0, arg1}, arg2...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetObservationLog", reflect.TypeOf((*MockManagerClient)(nil).GetObservationLog), varargs...) } -// ReportObservationLog mocks base method -func (m *MockManagerClient) ReportObservationLog(arg0 context.Context, arg1 *v1alpha3.ReportObservationLogRequest, arg2 ...grpc.CallOption) (*v1alpha3.ReportObservationLogReply, error) { +// ReportObservationLog mocks base method. +func (m *MockManagerClient) ReportObservationLog(arg0 context.Context, arg1 *api_v1_alpha3.ReportObservationLogRequest, arg2 ...grpc.CallOption) (*api_v1_alpha3.ReportObservationLogReply, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0, arg1} for _, a := range arg2 { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "ReportObservationLog", varargs...) - ret0, _ := ret[0].(*v1alpha3.ReportObservationLogReply) + ret0, _ := ret[0].(*api_v1_alpha3.ReportObservationLogReply) ret1, _ := ret[1].(error) return ret0, ret1 } -// ReportObservationLog indicates an expected call of ReportObservationLog +// ReportObservationLog indicates an expected call of ReportObservationLog. func (mr *MockManagerClientMockRecorder) ReportObservationLog(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{arg0, arg1}, arg2...) diff --git a/pkg/mock/v1alpha3/api/suggestion.go b/pkg/mock/v1alpha3/api/suggestion.go index 5e3e351bad9..8d3d6a102af 100644 --- a/pkg/mock/v1alpha3/api/suggestion.go +++ b/pkg/mock/v1alpha3/api/suggestion.go @@ -7,68 +7,68 @@ package mock import ( context "context" gomock "github.com/golang/mock/gomock" - v1alpha3 "github.com/kubeflow/katib/pkg/apis/manager/v1alpha3" + api_v1_alpha3 "github.com/kubeflow/katib/pkg/apis/manager/v1alpha3" grpc "google.golang.org/grpc" reflect "reflect" ) -// MockSuggestionClient is a mock of SuggestionClient interface +// MockSuggestionClient is a mock of SuggestionClient interface. type MockSuggestionClient struct { ctrl *gomock.Controller recorder *MockSuggestionClientMockRecorder } -// MockSuggestionClientMockRecorder is the mock recorder for MockSuggestionClient +// MockSuggestionClientMockRecorder is the mock recorder for MockSuggestionClient. type MockSuggestionClientMockRecorder struct { mock *MockSuggestionClient } -// NewMockSuggestionClient creates a new mock instance +// NewMockSuggestionClient creates a new mock instance. func NewMockSuggestionClient(ctrl *gomock.Controller) *MockSuggestionClient { mock := &MockSuggestionClient{ctrl: ctrl} mock.recorder = &MockSuggestionClientMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockSuggestionClient) EXPECT() *MockSuggestionClientMockRecorder { return m.recorder } -// GetSuggestions mocks base method -func (m *MockSuggestionClient) GetSuggestions(arg0 context.Context, arg1 *v1alpha3.GetSuggestionsRequest, arg2 ...grpc.CallOption) (*v1alpha3.GetSuggestionsReply, error) { +// GetSuggestions mocks base method. +func (m *MockSuggestionClient) GetSuggestions(arg0 context.Context, arg1 *api_v1_alpha3.GetSuggestionsRequest, arg2 ...grpc.CallOption) (*api_v1_alpha3.GetSuggestionsReply, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0, arg1} for _, a := range arg2 { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetSuggestions", varargs...) - ret0, _ := ret[0].(*v1alpha3.GetSuggestionsReply) + ret0, _ := ret[0].(*api_v1_alpha3.GetSuggestionsReply) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetSuggestions indicates an expected call of GetSuggestions +// GetSuggestions indicates an expected call of GetSuggestions. func (mr *MockSuggestionClientMockRecorder) GetSuggestions(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{arg0, arg1}, arg2...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSuggestions", reflect.TypeOf((*MockSuggestionClient)(nil).GetSuggestions), varargs...) } -// ValidateAlgorithmSettings mocks base method -func (m *MockSuggestionClient) ValidateAlgorithmSettings(arg0 context.Context, arg1 *v1alpha3.ValidateAlgorithmSettingsRequest, arg2 ...grpc.CallOption) (*v1alpha3.ValidateAlgorithmSettingsReply, error) { +// ValidateAlgorithmSettings mocks base method. +func (m *MockSuggestionClient) ValidateAlgorithmSettings(arg0 context.Context, arg1 *api_v1_alpha3.ValidateAlgorithmSettingsRequest, arg2 ...grpc.CallOption) (*api_v1_alpha3.ValidateAlgorithmSettingsReply, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0, arg1} for _, a := range arg2 { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "ValidateAlgorithmSettings", varargs...) - ret0, _ := ret[0].(*v1alpha3.ValidateAlgorithmSettingsReply) + ret0, _ := ret[0].(*api_v1_alpha3.ValidateAlgorithmSettingsReply) ret1, _ := ret[1].(error) return ret0, ret1 } -// ValidateAlgorithmSettings indicates an expected call of ValidateAlgorithmSettings +// ValidateAlgorithmSettings indicates an expected call of ValidateAlgorithmSettings. func (mr *MockSuggestionClientMockRecorder) ValidateAlgorithmSettings(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{arg0, arg1}, arg2...) diff --git a/pkg/mock/v1alpha3/db/db.go b/pkg/mock/v1alpha3/db/db.go index 519914734cb..d530497d724 100644 --- a/pkg/mock/v1alpha3/db/db.go +++ b/pkg/mock/v1alpha3/db/db.go @@ -6,46 +6,46 @@ package mock import ( gomock "github.com/golang/mock/gomock" - v1alpha3 "github.com/kubeflow/katib/pkg/apis/manager/v1alpha3" + api_v1_alpha3 "github.com/kubeflow/katib/pkg/apis/manager/v1alpha3" reflect "reflect" ) -// MockKatibDBInterface is a mock of KatibDBInterface interface +// MockKatibDBInterface is a mock of KatibDBInterface interface. type MockKatibDBInterface struct { ctrl *gomock.Controller recorder *MockKatibDBInterfaceMockRecorder } -// MockKatibDBInterfaceMockRecorder is the mock recorder for MockKatibDBInterface +// MockKatibDBInterfaceMockRecorder is the mock recorder for MockKatibDBInterface. type MockKatibDBInterfaceMockRecorder struct { mock *MockKatibDBInterface } -// NewMockKatibDBInterface creates a new mock instance +// NewMockKatibDBInterface creates a new mock instance. func NewMockKatibDBInterface(ctrl *gomock.Controller) *MockKatibDBInterface { mock := &MockKatibDBInterface{ctrl: ctrl} mock.recorder = &MockKatibDBInterfaceMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockKatibDBInterface) EXPECT() *MockKatibDBInterfaceMockRecorder { return m.recorder } -// DBInit mocks base method +// DBInit mocks base method. func (m *MockKatibDBInterface) DBInit() { m.ctrl.T.Helper() m.ctrl.Call(m, "DBInit") } -// DBInit indicates an expected call of DBInit +// DBInit indicates an expected call of DBInit. func (mr *MockKatibDBInterfaceMockRecorder) DBInit() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DBInit", reflect.TypeOf((*MockKatibDBInterface)(nil).DBInit)) } -// DeleteObservationLog mocks base method +// DeleteObservationLog mocks base method. func (m *MockKatibDBInterface) DeleteObservationLog(arg0 string) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "DeleteObservationLog", arg0) @@ -53,42 +53,42 @@ func (m *MockKatibDBInterface) DeleteObservationLog(arg0 string) error { return ret0 } -// DeleteObservationLog indicates an expected call of DeleteObservationLog +// DeleteObservationLog indicates an expected call of DeleteObservationLog. func (mr *MockKatibDBInterfaceMockRecorder) DeleteObservationLog(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteObservationLog", reflect.TypeOf((*MockKatibDBInterface)(nil).DeleteObservationLog), arg0) } -// GetObservationLog mocks base method -func (m *MockKatibDBInterface) GetObservationLog(arg0, arg1, arg2, arg3 string) (*v1alpha3.ObservationLog, error) { +// GetObservationLog mocks base method. +func (m *MockKatibDBInterface) GetObservationLog(arg0, arg1, arg2, arg3 string) (*api_v1_alpha3.ObservationLog, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetObservationLog", arg0, arg1, arg2, arg3) - ret0, _ := ret[0].(*v1alpha3.ObservationLog) + ret0, _ := ret[0].(*api_v1_alpha3.ObservationLog) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetObservationLog indicates an expected call of GetObservationLog +// GetObservationLog indicates an expected call of GetObservationLog. func (mr *MockKatibDBInterfaceMockRecorder) GetObservationLog(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetObservationLog", reflect.TypeOf((*MockKatibDBInterface)(nil).GetObservationLog), arg0, arg1, arg2, arg3) } -// RegisterObservationLog mocks base method -func (m *MockKatibDBInterface) RegisterObservationLog(arg0 string, arg1 *v1alpha3.ObservationLog) error { +// RegisterObservationLog mocks base method. +func (m *MockKatibDBInterface) RegisterObservationLog(arg0 string, arg1 *api_v1_alpha3.ObservationLog) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "RegisterObservationLog", arg0, arg1) ret0, _ := ret[0].(error) return ret0 } -// RegisterObservationLog indicates an expected call of RegisterObservationLog +// RegisterObservationLog indicates an expected call of RegisterObservationLog. func (mr *MockKatibDBInterfaceMockRecorder) RegisterObservationLog(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterObservationLog", reflect.TypeOf((*MockKatibDBInterface)(nil).RegisterObservationLog), arg0, arg1) } -// SelectOne mocks base method +// SelectOne mocks base method. func (m *MockKatibDBInterface) SelectOne() error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SelectOne") @@ -96,7 +96,7 @@ func (m *MockKatibDBInterface) SelectOne() error { return ret0 } -// SelectOne indicates an expected call of SelectOne +// SelectOne indicates an expected call of SelectOne. func (mr *MockKatibDBInterfaceMockRecorder) SelectOne() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SelectOne", reflect.TypeOf((*MockKatibDBInterface)(nil).SelectOne)) diff --git a/pkg/mock/v1alpha3/experiment/manifest/generator.go b/pkg/mock/v1alpha3/experiment/manifest/generator.go index 0f03d5965fe..3aa0510f82c 100644 --- a/pkg/mock/v1alpha3/experiment/manifest/generator.go +++ b/pkg/mock/v1alpha3/experiment/manifest/generator.go @@ -12,30 +12,30 @@ import ( client "sigs.k8s.io/controller-runtime/pkg/client" ) -// MockGenerator is a mock of Generator interface +// MockGenerator is a mock of Generator interface. type MockGenerator struct { ctrl *gomock.Controller recorder *MockGeneratorMockRecorder } -// MockGeneratorMockRecorder is the mock recorder for MockGenerator +// MockGeneratorMockRecorder is the mock recorder for MockGenerator. type MockGeneratorMockRecorder struct { mock *MockGenerator } -// NewMockGenerator creates a new mock instance +// NewMockGenerator creates a new mock instance. func NewMockGenerator(ctrl *gomock.Controller) *MockGenerator { mock := &MockGenerator{ctrl: ctrl} mock.recorder = &MockGeneratorMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockGenerator) EXPECT() *MockGeneratorMockRecorder { return m.recorder } -// GetMetricsCollectorImage mocks base method +// GetMetricsCollectorImage mocks base method. func (m *MockGenerator) GetMetricsCollectorImage(arg0 v1alpha3.CollectorKind) (string, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetMetricsCollectorImage", arg0) @@ -44,13 +44,13 @@ func (m *MockGenerator) GetMetricsCollectorImage(arg0 v1alpha3.CollectorKind) (s return ret0, ret1 } -// GetMetricsCollectorImage indicates an expected call of GetMetricsCollectorImage +// GetMetricsCollectorImage indicates an expected call of GetMetricsCollectorImage. func (mr *MockGeneratorMockRecorder) GetMetricsCollectorImage(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMetricsCollectorImage", reflect.TypeOf((*MockGenerator)(nil).GetMetricsCollectorImage), arg0) } -// GetRunSpec mocks base method +// GetRunSpec mocks base method. func (m *MockGenerator) GetRunSpec(arg0 *v1alpha30.Experiment, arg1, arg2, arg3 string) (string, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetRunSpec", arg0, arg1, arg2, arg3) @@ -59,13 +59,13 @@ func (m *MockGenerator) GetRunSpec(arg0 *v1alpha30.Experiment, arg1, arg2, arg3 return ret0, ret1 } -// GetRunSpec indicates an expected call of GetRunSpec +// GetRunSpec indicates an expected call of GetRunSpec. func (mr *MockGeneratorMockRecorder) GetRunSpec(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRunSpec", reflect.TypeOf((*MockGenerator)(nil).GetRunSpec), arg0, arg1, arg2, arg3) } -// GetRunSpecWithHyperParameters mocks base method +// GetRunSpecWithHyperParameters mocks base method. func (m *MockGenerator) GetRunSpecWithHyperParameters(arg0 *v1alpha30.Experiment, arg1, arg2, arg3 string, arg4 []v1alpha3.ParameterAssignment) (string, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetRunSpecWithHyperParameters", arg0, arg1, arg2, arg3, arg4) @@ -74,13 +74,13 @@ func (m *MockGenerator) GetRunSpecWithHyperParameters(arg0 *v1alpha30.Experiment return ret0, ret1 } -// GetRunSpecWithHyperParameters indicates an expected call of GetRunSpecWithHyperParameters +// GetRunSpecWithHyperParameters indicates an expected call of GetRunSpecWithHyperParameters. func (mr *MockGeneratorMockRecorder) GetRunSpecWithHyperParameters(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRunSpecWithHyperParameters", reflect.TypeOf((*MockGenerator)(nil).GetRunSpecWithHyperParameters), arg0, arg1, arg2, arg3, arg4) } -// GetSuggestionConfigData mocks base method +// GetSuggestionConfigData mocks base method. func (m *MockGenerator) GetSuggestionConfigData(arg0 string) (map[string]string, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetSuggestionConfigData", arg0) @@ -89,19 +89,19 @@ func (m *MockGenerator) GetSuggestionConfigData(arg0 string) (map[string]string, return ret0, ret1 } -// GetSuggestionConfigData indicates an expected call of GetSuggestionConfigData +// GetSuggestionConfigData indicates an expected call of GetSuggestionConfigData. func (mr *MockGeneratorMockRecorder) GetSuggestionConfigData(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSuggestionConfigData", reflect.TypeOf((*MockGenerator)(nil).GetSuggestionConfigData), arg0) } -// InjectClient mocks base method +// InjectClient mocks base method. func (m *MockGenerator) InjectClient(arg0 client.Client) { m.ctrl.T.Helper() m.ctrl.Call(m, "InjectClient", arg0) } -// InjectClient indicates an expected call of InjectClient +// InjectClient indicates an expected call of InjectClient. func (mr *MockGeneratorMockRecorder) InjectClient(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InjectClient", reflect.TypeOf((*MockGenerator)(nil).InjectClient), arg0) diff --git a/pkg/mock/v1alpha3/experiment/suggestion/suggestion.go b/pkg/mock/v1alpha3/experiment/suggestion/suggestion.go index b07b0bca16a..bff20c922a1 100644 --- a/pkg/mock/v1alpha3/experiment/suggestion/suggestion.go +++ b/pkg/mock/v1alpha3/experiment/suggestion/suggestion.go @@ -11,30 +11,30 @@ import ( reflect "reflect" ) -// MockSuggestion is a mock of Suggestion interface +// MockSuggestion is a mock of Suggestion interface. type MockSuggestion struct { ctrl *gomock.Controller recorder *MockSuggestionMockRecorder } -// MockSuggestionMockRecorder is the mock recorder for MockSuggestion +// MockSuggestionMockRecorder is the mock recorder for MockSuggestion. type MockSuggestionMockRecorder struct { mock *MockSuggestion } -// NewMockSuggestion creates a new mock instance +// NewMockSuggestion creates a new mock instance. func NewMockSuggestion(ctrl *gomock.Controller) *MockSuggestion { mock := &MockSuggestion{ctrl: ctrl} mock.recorder = &MockSuggestionMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockSuggestion) EXPECT() *MockSuggestionMockRecorder { return m.recorder } -// GetOrCreateSuggestion mocks base method +// GetOrCreateSuggestion mocks base method. func (m *MockSuggestion) GetOrCreateSuggestion(arg0 *v1alpha3.Experiment, arg1 int32) (*v1alpha30.Suggestion, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetOrCreateSuggestion", arg0, arg1) @@ -43,13 +43,13 @@ func (m *MockSuggestion) GetOrCreateSuggestion(arg0 *v1alpha3.Experiment, arg1 i return ret0, ret1 } -// GetOrCreateSuggestion indicates an expected call of GetOrCreateSuggestion +// GetOrCreateSuggestion indicates an expected call of GetOrCreateSuggestion. func (mr *MockSuggestionMockRecorder) GetOrCreateSuggestion(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrCreateSuggestion", reflect.TypeOf((*MockSuggestion)(nil).GetOrCreateSuggestion), arg0, arg1) } -// UpdateSuggestion mocks base method +// UpdateSuggestion mocks base method. func (m *MockSuggestion) UpdateSuggestion(arg0 *v1alpha30.Suggestion) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UpdateSuggestion", arg0) @@ -57,13 +57,13 @@ func (m *MockSuggestion) UpdateSuggestion(arg0 *v1alpha30.Suggestion) error { return ret0 } -// UpdateSuggestion indicates an expected call of UpdateSuggestion +// UpdateSuggestion indicates an expected call of UpdateSuggestion. func (mr *MockSuggestionMockRecorder) UpdateSuggestion(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateSuggestion", reflect.TypeOf((*MockSuggestion)(nil).UpdateSuggestion), arg0) } -// UpdateSuggestionStatus mocks base method +// UpdateSuggestionStatus mocks base method. func (m *MockSuggestion) UpdateSuggestionStatus(arg0 *v1alpha30.Suggestion) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UpdateSuggestionStatus", arg0) @@ -71,7 +71,7 @@ func (m *MockSuggestion) UpdateSuggestionStatus(arg0 *v1alpha30.Suggestion) erro return ret0 } -// UpdateSuggestionStatus indicates an expected call of UpdateSuggestionStatus +// UpdateSuggestionStatus indicates an expected call of UpdateSuggestionStatus. func (mr *MockSuggestionMockRecorder) UpdateSuggestionStatus(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateSuggestionStatus", reflect.TypeOf((*MockSuggestion)(nil).UpdateSuggestionStatus), arg0) diff --git a/pkg/mock/v1alpha3/trial/managerclient/katibmanager.go b/pkg/mock/v1alpha3/trial/managerclient/katibmanager.go index f4e4c8d2558..1432dd26a47 100644 --- a/pkg/mock/v1alpha3/trial/managerclient/katibmanager.go +++ b/pkg/mock/v1alpha3/trial/managerclient/katibmanager.go @@ -7,58 +7,58 @@ package mock import ( gomock "github.com/golang/mock/gomock" v1alpha3 "github.com/kubeflow/katib/pkg/apis/controller/trials/v1alpha3" - v1alpha30 "github.com/kubeflow/katib/pkg/apis/manager/v1alpha3" + api_v1_alpha3 "github.com/kubeflow/katib/pkg/apis/manager/v1alpha3" reflect "reflect" ) -// MockManagerClient is a mock of ManagerClient interface +// MockManagerClient is a mock of ManagerClient interface. type MockManagerClient struct { ctrl *gomock.Controller recorder *MockManagerClientMockRecorder } -// MockManagerClientMockRecorder is the mock recorder for MockManagerClient +// MockManagerClientMockRecorder is the mock recorder for MockManagerClient. type MockManagerClientMockRecorder struct { mock *MockManagerClient } -// NewMockManagerClient creates a new mock instance +// NewMockManagerClient creates a new mock instance. func NewMockManagerClient(ctrl *gomock.Controller) *MockManagerClient { mock := &MockManagerClient{ctrl: ctrl} mock.recorder = &MockManagerClientMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockManagerClient) EXPECT() *MockManagerClientMockRecorder { return m.recorder } -// DeleteTrialObservationLog mocks base method -func (m *MockManagerClient) DeleteTrialObservationLog(arg0 *v1alpha3.Trial) (*v1alpha30.DeleteObservationLogReply, error) { +// DeleteTrialObservationLog mocks base method. +func (m *MockManagerClient) DeleteTrialObservationLog(arg0 *v1alpha3.Trial) (*api_v1_alpha3.DeleteObservationLogReply, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "DeleteTrialObservationLog", arg0) - ret0, _ := ret[0].(*v1alpha30.DeleteObservationLogReply) + ret0, _ := ret[0].(*api_v1_alpha3.DeleteObservationLogReply) ret1, _ := ret[1].(error) return ret0, ret1 } -// DeleteTrialObservationLog indicates an expected call of DeleteTrialObservationLog +// DeleteTrialObservationLog indicates an expected call of DeleteTrialObservationLog. func (mr *MockManagerClientMockRecorder) DeleteTrialObservationLog(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteTrialObservationLog", reflect.TypeOf((*MockManagerClient)(nil).DeleteTrialObservationLog), arg0) } -// GetTrialObservationLog mocks base method -func (m *MockManagerClient) GetTrialObservationLog(arg0 *v1alpha3.Trial) (*v1alpha30.GetObservationLogReply, error) { +// GetTrialObservationLog mocks base method. +func (m *MockManagerClient) GetTrialObservationLog(arg0 *v1alpha3.Trial) (*api_v1_alpha3.GetObservationLogReply, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetTrialObservationLog", arg0) - ret0, _ := ret[0].(*v1alpha30.GetObservationLogReply) + ret0, _ := ret[0].(*api_v1_alpha3.GetObservationLogReply) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetTrialObservationLog indicates an expected call of GetTrialObservationLog +// GetTrialObservationLog indicates an expected call of GetTrialObservationLog. func (mr *MockManagerClientMockRecorder) GetTrialObservationLog(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTrialObservationLog", reflect.TypeOf((*MockManagerClient)(nil).GetTrialObservationLog), arg0) diff --git a/pkg/mock/v1alpha3/util/katibclient/katibclient.go b/pkg/mock/v1alpha3/util/katibclient/katibclient.go index ac6ebfc4f44..e42264e1b41 100644 --- a/pkg/mock/v1alpha3/util/katibclient/katibclient.go +++ b/pkg/mock/v1alpha3/util/katibclient/katibclient.go @@ -14,30 +14,30 @@ import ( client "sigs.k8s.io/controller-runtime/pkg/client" ) -// MockClient is a mock of Client interface +// MockClient is a mock of Client interface. type MockClient struct { ctrl *gomock.Controller recorder *MockClientMockRecorder } -// MockClientMockRecorder is the mock recorder for MockClient +// MockClientMockRecorder is the mock recorder for MockClient. type MockClientMockRecorder struct { mock *MockClient } -// NewMockClient creates a new mock instance +// NewMockClient creates a new mock instance. func NewMockClient(ctrl *gomock.Controller) *MockClient { mock := &MockClient{ctrl: ctrl} mock.recorder = &MockClientMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockClient) EXPECT() *MockClientMockRecorder { return m.recorder } -// CreateExperiment mocks base method +// CreateExperiment mocks base method. func (m *MockClient) CreateExperiment(arg0 *v1alpha3.Experiment, arg1 ...string) error { m.ctrl.T.Helper() varargs := []interface{}{arg0} @@ -49,14 +49,14 @@ func (m *MockClient) CreateExperiment(arg0 *v1alpha3.Experiment, arg1 ...string) return ret0 } -// CreateExperiment indicates an expected call of CreateExperiment +// CreateExperiment indicates an expected call of CreateExperiment. func (mr *MockClientMockRecorder) CreateExperiment(arg0 interface{}, arg1 ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{arg0}, arg1...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateExperiment", reflect.TypeOf((*MockClient)(nil).CreateExperiment), varargs...) } -// DeleteExperiment mocks base method +// DeleteExperiment mocks base method. func (m *MockClient) DeleteExperiment(arg0 *v1alpha3.Experiment, arg1 ...string) error { m.ctrl.T.Helper() varargs := []interface{}{arg0} @@ -68,14 +68,14 @@ func (m *MockClient) DeleteExperiment(arg0 *v1alpha3.Experiment, arg1 ...string) return ret0 } -// DeleteExperiment indicates an expected call of DeleteExperiment +// DeleteExperiment indicates an expected call of DeleteExperiment. func (mr *MockClientMockRecorder) DeleteExperiment(arg0 interface{}, arg1 ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{arg0}, arg1...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteExperiment", reflect.TypeOf((*MockClient)(nil).DeleteExperiment), varargs...) } -// GetClient mocks base method +// GetClient mocks base method. func (m *MockClient) GetClient() client.Client { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetClient") @@ -83,13 +83,13 @@ func (m *MockClient) GetClient() client.Client { return ret0 } -// GetClient indicates an expected call of GetClient +// GetClient indicates an expected call of GetClient. func (mr *MockClientMockRecorder) GetClient() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetClient", reflect.TypeOf((*MockClient)(nil).GetClient)) } -// GetConfigMap mocks base method +// GetConfigMap mocks base method. func (m *MockClient) GetConfigMap(arg0 string, arg1 ...string) (map[string]string, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0} @@ -102,14 +102,14 @@ func (m *MockClient) GetConfigMap(arg0 string, arg1 ...string) (map[string]strin return ret0, ret1 } -// GetConfigMap indicates an expected call of GetConfigMap +// GetConfigMap indicates an expected call of GetConfigMap. func (mr *MockClientMockRecorder) GetConfigMap(arg0 interface{}, arg1 ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{arg0}, arg1...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetConfigMap", reflect.TypeOf((*MockClient)(nil).GetConfigMap), varargs...) } -// GetExperiment mocks base method +// GetExperiment mocks base method. func (m *MockClient) GetExperiment(arg0 string, arg1 ...string) (*v1alpha3.Experiment, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0} @@ -122,14 +122,14 @@ func (m *MockClient) GetExperiment(arg0 string, arg1 ...string) (*v1alpha3.Exper return ret0, ret1 } -// GetExperiment indicates an expected call of GetExperiment +// GetExperiment indicates an expected call of GetExperiment. func (mr *MockClientMockRecorder) GetExperiment(arg0 interface{}, arg1 ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{arg0}, arg1...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetExperiment", reflect.TypeOf((*MockClient)(nil).GetExperiment), varargs...) } -// GetExperimentList mocks base method +// GetExperimentList mocks base method. func (m *MockClient) GetExperimentList(arg0 ...string) (*v1alpha3.ExperimentList, error) { m.ctrl.T.Helper() varargs := []interface{}{} @@ -142,13 +142,13 @@ func (m *MockClient) GetExperimentList(arg0 ...string) (*v1alpha3.ExperimentList return ret0, ret1 } -// GetExperimentList indicates an expected call of GetExperimentList +// GetExperimentList indicates an expected call of GetExperimentList. func (mr *MockClientMockRecorder) GetExperimentList(arg0 ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetExperimentList", reflect.TypeOf((*MockClient)(nil).GetExperimentList), arg0...) } -// GetNamespaceList mocks base method +// GetNamespaceList mocks base method. func (m *MockClient) GetNamespaceList() (*v1.NamespaceList, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetNamespaceList") @@ -157,13 +157,13 @@ func (m *MockClient) GetNamespaceList() (*v1.NamespaceList, error) { return ret0, ret1 } -// GetNamespaceList indicates an expected call of GetNamespaceList +// GetNamespaceList indicates an expected call of GetNamespaceList. func (mr *MockClientMockRecorder) GetNamespaceList() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetNamespaceList", reflect.TypeOf((*MockClient)(nil).GetNamespaceList)) } -// GetSuggestion mocks base method +// GetSuggestion mocks base method. func (m *MockClient) GetSuggestion(arg0 string, arg1 ...string) (*v1alpha30.Suggestion, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0} @@ -176,14 +176,14 @@ func (m *MockClient) GetSuggestion(arg0 string, arg1 ...string) (*v1alpha30.Sugg return ret0, ret1 } -// GetSuggestion indicates an expected call of GetSuggestion +// GetSuggestion indicates an expected call of GetSuggestion. func (mr *MockClientMockRecorder) GetSuggestion(arg0 interface{}, arg1 ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{arg0}, arg1...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSuggestion", reflect.TypeOf((*MockClient)(nil).GetSuggestion), varargs...) } -// GetTrial mocks base method +// GetTrial mocks base method. func (m *MockClient) GetTrial(arg0 string, arg1 ...string) (*v1alpha31.Trial, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0} @@ -196,14 +196,14 @@ func (m *MockClient) GetTrial(arg0 string, arg1 ...string) (*v1alpha31.Trial, er return ret0, ret1 } -// GetTrial indicates an expected call of GetTrial +// GetTrial indicates an expected call of GetTrial. func (mr *MockClientMockRecorder) GetTrial(arg0 interface{}, arg1 ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{arg0}, arg1...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTrial", reflect.TypeOf((*MockClient)(nil).GetTrial), varargs...) } -// GetTrialList mocks base method +// GetTrialList mocks base method. func (m *MockClient) GetTrialList(arg0 string, arg1 ...string) (*v1alpha31.TrialList, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0} @@ -216,14 +216,14 @@ func (m *MockClient) GetTrialList(arg0 string, arg1 ...string) (*v1alpha31.Trial return ret0, ret1 } -// GetTrialList indicates an expected call of GetTrialList +// GetTrialList indicates an expected call of GetTrialList. func (mr *MockClientMockRecorder) GetTrialList(arg0 interface{}, arg1 ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{arg0}, arg1...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTrialList", reflect.TypeOf((*MockClient)(nil).GetTrialList), varargs...) } -// GetTrialTemplates mocks base method +// GetTrialTemplates mocks base method. func (m *MockClient) GetTrialTemplates(arg0 ...string) (*v1.ConfigMapList, error) { m.ctrl.T.Helper() varargs := []interface{}{} @@ -236,25 +236,25 @@ func (m *MockClient) GetTrialTemplates(arg0 ...string) (*v1.ConfigMapList, error return ret0, ret1 } -// GetTrialTemplates indicates an expected call of GetTrialTemplates +// GetTrialTemplates indicates an expected call of GetTrialTemplates. func (mr *MockClientMockRecorder) GetTrialTemplates(arg0 ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTrialTemplates", reflect.TypeOf((*MockClient)(nil).GetTrialTemplates), arg0...) } -// InjectClient mocks base method +// InjectClient mocks base method. func (m *MockClient) InjectClient(arg0 client.Client) { m.ctrl.T.Helper() m.ctrl.Call(m, "InjectClient", arg0) } -// InjectClient indicates an expected call of InjectClient +// InjectClient indicates an expected call of InjectClient. func (mr *MockClientMockRecorder) InjectClient(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InjectClient", reflect.TypeOf((*MockClient)(nil).InjectClient), arg0) } -// UpdateConfigMap mocks base method +// UpdateConfigMap mocks base method. func (m *MockClient) UpdateConfigMap(arg0 *v1.ConfigMap) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UpdateConfigMap", arg0) @@ -262,13 +262,13 @@ func (m *MockClient) UpdateConfigMap(arg0 *v1.ConfigMap) error { return ret0 } -// UpdateConfigMap indicates an expected call of UpdateConfigMap +// UpdateConfigMap indicates an expected call of UpdateConfigMap. func (mr *MockClientMockRecorder) UpdateConfigMap(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateConfigMap", reflect.TypeOf((*MockClient)(nil).UpdateConfigMap), arg0) } -// UpdateExperiment mocks base method +// UpdateExperiment mocks base method. func (m *MockClient) UpdateExperiment(arg0 *v1alpha3.Experiment, arg1 ...string) error { m.ctrl.T.Helper() varargs := []interface{}{arg0} @@ -280,7 +280,7 @@ func (m *MockClient) UpdateExperiment(arg0 *v1alpha3.Experiment, arg1 ...string) return ret0 } -// UpdateExperiment indicates an expected call of UpdateExperiment +// UpdateExperiment indicates an expected call of UpdateExperiment. func (mr *MockClientMockRecorder) UpdateExperiment(arg0 interface{}, arg1 ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{arg0}, arg1...) diff --git a/pkg/mock/v1beta1/api/suggestion.go b/pkg/mock/v1beta1/api/suggestion.go index a7fcc01ba06..4d39921bcd6 100644 --- a/pkg/mock/v1beta1/api/suggestion.go +++ b/pkg/mock/v1beta1/api/suggestion.go @@ -7,68 +7,68 @@ package mock import ( context "context" gomock "github.com/golang/mock/gomock" - v1beta1 "github.com/kubeflow/katib/pkg/apis/manager/v1beta1" + api_v1_beta1 "github.com/kubeflow/katib/pkg/apis/manager/v1beta1" grpc "google.golang.org/grpc" reflect "reflect" ) -// MockSuggestionClient is a mock of SuggestionClient interface +// MockSuggestionClient is a mock of SuggestionClient interface. type MockSuggestionClient struct { ctrl *gomock.Controller recorder *MockSuggestionClientMockRecorder } -// MockSuggestionClientMockRecorder is the mock recorder for MockSuggestionClient +// MockSuggestionClientMockRecorder is the mock recorder for MockSuggestionClient. type MockSuggestionClientMockRecorder struct { mock *MockSuggestionClient } -// NewMockSuggestionClient creates a new mock instance +// NewMockSuggestionClient creates a new mock instance. func NewMockSuggestionClient(ctrl *gomock.Controller) *MockSuggestionClient { mock := &MockSuggestionClient{ctrl: ctrl} mock.recorder = &MockSuggestionClientMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockSuggestionClient) EXPECT() *MockSuggestionClientMockRecorder { return m.recorder } -// GetSuggestions mocks base method -func (m *MockSuggestionClient) GetSuggestions(arg0 context.Context, arg1 *v1beta1.GetSuggestionsRequest, arg2 ...grpc.CallOption) (*v1beta1.GetSuggestionsReply, error) { +// GetSuggestions mocks base method. +func (m *MockSuggestionClient) GetSuggestions(arg0 context.Context, arg1 *api_v1_beta1.GetSuggestionsRequest, arg2 ...grpc.CallOption) (*api_v1_beta1.GetSuggestionsReply, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0, arg1} for _, a := range arg2 { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "GetSuggestions", varargs...) - ret0, _ := ret[0].(*v1beta1.GetSuggestionsReply) + ret0, _ := ret[0].(*api_v1_beta1.GetSuggestionsReply) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetSuggestions indicates an expected call of GetSuggestions +// GetSuggestions indicates an expected call of GetSuggestions. func (mr *MockSuggestionClientMockRecorder) GetSuggestions(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{arg0, arg1}, arg2...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSuggestions", reflect.TypeOf((*MockSuggestionClient)(nil).GetSuggestions), varargs...) } -// ValidateAlgorithmSettings mocks base method -func (m *MockSuggestionClient) ValidateAlgorithmSettings(arg0 context.Context, arg1 *v1beta1.ValidateAlgorithmSettingsRequest, arg2 ...grpc.CallOption) (*v1beta1.ValidateAlgorithmSettingsReply, error) { +// ValidateAlgorithmSettings mocks base method. +func (m *MockSuggestionClient) ValidateAlgorithmSettings(arg0 context.Context, arg1 *api_v1_beta1.ValidateAlgorithmSettingsRequest, arg2 ...grpc.CallOption) (*api_v1_beta1.ValidateAlgorithmSettingsReply, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0, arg1} for _, a := range arg2 { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "ValidateAlgorithmSettings", varargs...) - ret0, _ := ret[0].(*v1beta1.ValidateAlgorithmSettingsReply) + ret0, _ := ret[0].(*api_v1_beta1.ValidateAlgorithmSettingsReply) ret1, _ := ret[1].(error) return ret0, ret1 } -// ValidateAlgorithmSettings indicates an expected call of ValidateAlgorithmSettings +// ValidateAlgorithmSettings indicates an expected call of ValidateAlgorithmSettings. func (mr *MockSuggestionClientMockRecorder) ValidateAlgorithmSettings(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{arg0, arg1}, arg2...) diff --git a/pkg/mock/v1beta1/db/db.go b/pkg/mock/v1beta1/db/db.go index f255a16c8b5..6cf2d03bf6e 100644 --- a/pkg/mock/v1beta1/db/db.go +++ b/pkg/mock/v1beta1/db/db.go @@ -6,46 +6,46 @@ package mock import ( gomock "github.com/golang/mock/gomock" - v1beta1 "github.com/kubeflow/katib/pkg/apis/manager/v1beta1" + api_v1_beta1 "github.com/kubeflow/katib/pkg/apis/manager/v1beta1" reflect "reflect" ) -// MockKatibDBInterface is a mock of KatibDBInterface interface +// MockKatibDBInterface is a mock of KatibDBInterface interface. type MockKatibDBInterface struct { ctrl *gomock.Controller recorder *MockKatibDBInterfaceMockRecorder } -// MockKatibDBInterfaceMockRecorder is the mock recorder for MockKatibDBInterface +// MockKatibDBInterfaceMockRecorder is the mock recorder for MockKatibDBInterface. type MockKatibDBInterfaceMockRecorder struct { mock *MockKatibDBInterface } -// NewMockKatibDBInterface creates a new mock instance +// NewMockKatibDBInterface creates a new mock instance. func NewMockKatibDBInterface(ctrl *gomock.Controller) *MockKatibDBInterface { mock := &MockKatibDBInterface{ctrl: ctrl} mock.recorder = &MockKatibDBInterfaceMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockKatibDBInterface) EXPECT() *MockKatibDBInterfaceMockRecorder { return m.recorder } -// DBInit mocks base method +// DBInit mocks base method. func (m *MockKatibDBInterface) DBInit() { m.ctrl.T.Helper() m.ctrl.Call(m, "DBInit") } -// DBInit indicates an expected call of DBInit +// DBInit indicates an expected call of DBInit. func (mr *MockKatibDBInterfaceMockRecorder) DBInit() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DBInit", reflect.TypeOf((*MockKatibDBInterface)(nil).DBInit)) } -// DeleteObservationLog mocks base method +// DeleteObservationLog mocks base method. func (m *MockKatibDBInterface) DeleteObservationLog(arg0 string) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "DeleteObservationLog", arg0) @@ -53,42 +53,42 @@ func (m *MockKatibDBInterface) DeleteObservationLog(arg0 string) error { return ret0 } -// DeleteObservationLog indicates an expected call of DeleteObservationLog +// DeleteObservationLog indicates an expected call of DeleteObservationLog. func (mr *MockKatibDBInterfaceMockRecorder) DeleteObservationLog(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteObservationLog", reflect.TypeOf((*MockKatibDBInterface)(nil).DeleteObservationLog), arg0) } -// GetObservationLog mocks base method -func (m *MockKatibDBInterface) GetObservationLog(arg0, arg1, arg2, arg3 string) (*v1beta1.ObservationLog, error) { +// GetObservationLog mocks base method. +func (m *MockKatibDBInterface) GetObservationLog(arg0, arg1, arg2, arg3 string) (*api_v1_beta1.ObservationLog, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetObservationLog", arg0, arg1, arg2, arg3) - ret0, _ := ret[0].(*v1beta1.ObservationLog) + ret0, _ := ret[0].(*api_v1_beta1.ObservationLog) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetObservationLog indicates an expected call of GetObservationLog +// GetObservationLog indicates an expected call of GetObservationLog. func (mr *MockKatibDBInterfaceMockRecorder) GetObservationLog(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetObservationLog", reflect.TypeOf((*MockKatibDBInterface)(nil).GetObservationLog), arg0, arg1, arg2, arg3) } -// RegisterObservationLog mocks base method -func (m *MockKatibDBInterface) RegisterObservationLog(arg0 string, arg1 *v1beta1.ObservationLog) error { +// RegisterObservationLog mocks base method. +func (m *MockKatibDBInterface) RegisterObservationLog(arg0 string, arg1 *api_v1_beta1.ObservationLog) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "RegisterObservationLog", arg0, arg1) ret0, _ := ret[0].(error) return ret0 } -// RegisterObservationLog indicates an expected call of RegisterObservationLog +// RegisterObservationLog indicates an expected call of RegisterObservationLog. func (mr *MockKatibDBInterfaceMockRecorder) RegisterObservationLog(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterObservationLog", reflect.TypeOf((*MockKatibDBInterface)(nil).RegisterObservationLog), arg0, arg1) } -// SelectOne mocks base method +// SelectOne mocks base method. func (m *MockKatibDBInterface) SelectOne() error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SelectOne") @@ -96,7 +96,7 @@ func (m *MockKatibDBInterface) SelectOne() error { return ret0 } -// SelectOne indicates an expected call of SelectOne +// SelectOne indicates an expected call of SelectOne. func (mr *MockKatibDBInterfaceMockRecorder) SelectOne() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SelectOne", reflect.TypeOf((*MockKatibDBInterface)(nil).SelectOne)) diff --git a/pkg/mock/v1beta1/experiment/manifest/generator.go b/pkg/mock/v1beta1/experiment/manifest/generator.go index 12b8d5ac866..80ad0f54a48 100644 --- a/pkg/mock/v1beta1/experiment/manifest/generator.go +++ b/pkg/mock/v1beta1/experiment/manifest/generator.go @@ -13,30 +13,30 @@ import ( client "sigs.k8s.io/controller-runtime/pkg/client" ) -// MockGenerator is a mock of Generator interface +// MockGenerator is a mock of Generator interface. type MockGenerator struct { ctrl *gomock.Controller recorder *MockGeneratorMockRecorder } -// MockGeneratorMockRecorder is the mock recorder for MockGenerator +// MockGeneratorMockRecorder is the mock recorder for MockGenerator. type MockGeneratorMockRecorder struct { mock *MockGenerator } -// NewMockGenerator creates a new mock instance +// NewMockGenerator creates a new mock instance. func NewMockGenerator(ctrl *gomock.Controller) *MockGenerator { mock := &MockGenerator{ctrl: ctrl} mock.recorder = &MockGeneratorMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockGenerator) EXPECT() *MockGeneratorMockRecorder { return m.recorder } -// GetMetricsCollectorImage mocks base method +// GetMetricsCollectorImage mocks base method. func (m *MockGenerator) GetMetricsCollectorImage(arg0 v1beta1.CollectorKind) (string, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetMetricsCollectorImage", arg0) @@ -45,13 +45,13 @@ func (m *MockGenerator) GetMetricsCollectorImage(arg0 v1beta1.CollectorKind) (st return ret0, ret1 } -// GetMetricsCollectorImage indicates an expected call of GetMetricsCollectorImage +// GetMetricsCollectorImage indicates an expected call of GetMetricsCollectorImage. func (mr *MockGeneratorMockRecorder) GetMetricsCollectorImage(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMetricsCollectorImage", reflect.TypeOf((*MockGenerator)(nil).GetMetricsCollectorImage), arg0) } -// GetRunSpecWithHyperParameters mocks base method +// GetRunSpecWithHyperParameters mocks base method. func (m *MockGenerator) GetRunSpecWithHyperParameters(arg0 *v1beta10.Experiment, arg1, arg2 string, arg3 []v1beta1.ParameterAssignment) (*unstructured.Unstructured, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetRunSpecWithHyperParameters", arg0, arg1, arg2, arg3) @@ -60,13 +60,13 @@ func (m *MockGenerator) GetRunSpecWithHyperParameters(arg0 *v1beta10.Experiment, return ret0, ret1 } -// GetRunSpecWithHyperParameters indicates an expected call of GetRunSpecWithHyperParameters +// GetRunSpecWithHyperParameters indicates an expected call of GetRunSpecWithHyperParameters. func (mr *MockGeneratorMockRecorder) GetRunSpecWithHyperParameters(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRunSpecWithHyperParameters", reflect.TypeOf((*MockGenerator)(nil).GetRunSpecWithHyperParameters), arg0, arg1, arg2, arg3) } -// GetSuggestionConfigData mocks base method +// GetSuggestionConfigData mocks base method. func (m *MockGenerator) GetSuggestionConfigData(arg0 string) (map[string]string, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetSuggestionConfigData", arg0) @@ -75,13 +75,13 @@ func (m *MockGenerator) GetSuggestionConfigData(arg0 string) (map[string]string, return ret0, ret1 } -// GetSuggestionConfigData indicates an expected call of GetSuggestionConfigData +// GetSuggestionConfigData indicates an expected call of GetSuggestionConfigData. func (mr *MockGeneratorMockRecorder) GetSuggestionConfigData(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSuggestionConfigData", reflect.TypeOf((*MockGenerator)(nil).GetSuggestionConfigData), arg0) } -// GetTrialTemplate mocks base method +// GetTrialTemplate mocks base method. func (m *MockGenerator) GetTrialTemplate(arg0 *v1beta10.Experiment) (string, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetTrialTemplate", arg0) @@ -90,19 +90,19 @@ func (m *MockGenerator) GetTrialTemplate(arg0 *v1beta10.Experiment) (string, err return ret0, ret1 } -// GetTrialTemplate indicates an expected call of GetTrialTemplate +// GetTrialTemplate indicates an expected call of GetTrialTemplate. func (mr *MockGeneratorMockRecorder) GetTrialTemplate(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTrialTemplate", reflect.TypeOf((*MockGenerator)(nil).GetTrialTemplate), arg0) } -// InjectClient mocks base method +// InjectClient mocks base method. func (m *MockGenerator) InjectClient(arg0 client.Client) { m.ctrl.T.Helper() m.ctrl.Call(m, "InjectClient", arg0) } -// InjectClient indicates an expected call of InjectClient +// InjectClient indicates an expected call of InjectClient. func (mr *MockGeneratorMockRecorder) InjectClient(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InjectClient", reflect.TypeOf((*MockGenerator)(nil).InjectClient), arg0) diff --git a/pkg/mock/v1beta1/experiment/suggestion/suggestion.go b/pkg/mock/v1beta1/experiment/suggestion/suggestion.go index 7c61ec76617..d0793763fcf 100644 --- a/pkg/mock/v1beta1/experiment/suggestion/suggestion.go +++ b/pkg/mock/v1beta1/experiment/suggestion/suggestion.go @@ -11,30 +11,30 @@ import ( reflect "reflect" ) -// MockSuggestion is a mock of Suggestion interface +// MockSuggestion is a mock of Suggestion interface. type MockSuggestion struct { ctrl *gomock.Controller recorder *MockSuggestionMockRecorder } -// MockSuggestionMockRecorder is the mock recorder for MockSuggestion +// MockSuggestionMockRecorder is the mock recorder for MockSuggestion. type MockSuggestionMockRecorder struct { mock *MockSuggestion } -// NewMockSuggestion creates a new mock instance +// NewMockSuggestion creates a new mock instance. func NewMockSuggestion(ctrl *gomock.Controller) *MockSuggestion { mock := &MockSuggestion{ctrl: ctrl} mock.recorder = &MockSuggestionMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockSuggestion) EXPECT() *MockSuggestionMockRecorder { return m.recorder } -// GetOrCreateSuggestion mocks base method +// GetOrCreateSuggestion mocks base method. func (m *MockSuggestion) GetOrCreateSuggestion(arg0 *v1beta1.Experiment, arg1 int32) (*v1beta10.Suggestion, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetOrCreateSuggestion", arg0, arg1) @@ -43,13 +43,13 @@ func (m *MockSuggestion) GetOrCreateSuggestion(arg0 *v1beta1.Experiment, arg1 in return ret0, ret1 } -// GetOrCreateSuggestion indicates an expected call of GetOrCreateSuggestion +// GetOrCreateSuggestion indicates an expected call of GetOrCreateSuggestion. func (mr *MockSuggestionMockRecorder) GetOrCreateSuggestion(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOrCreateSuggestion", reflect.TypeOf((*MockSuggestion)(nil).GetOrCreateSuggestion), arg0, arg1) } -// UpdateSuggestion mocks base method +// UpdateSuggestion mocks base method. func (m *MockSuggestion) UpdateSuggestion(arg0 *v1beta10.Suggestion) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UpdateSuggestion", arg0) @@ -57,13 +57,13 @@ func (m *MockSuggestion) UpdateSuggestion(arg0 *v1beta10.Suggestion) error { return ret0 } -// UpdateSuggestion indicates an expected call of UpdateSuggestion +// UpdateSuggestion indicates an expected call of UpdateSuggestion. func (mr *MockSuggestionMockRecorder) UpdateSuggestion(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateSuggestion", reflect.TypeOf((*MockSuggestion)(nil).UpdateSuggestion), arg0) } -// UpdateSuggestionStatus mocks base method +// UpdateSuggestionStatus mocks base method. func (m *MockSuggestion) UpdateSuggestionStatus(arg0 *v1beta10.Suggestion) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UpdateSuggestionStatus", arg0) @@ -71,7 +71,7 @@ func (m *MockSuggestion) UpdateSuggestionStatus(arg0 *v1beta10.Suggestion) error return ret0 } -// UpdateSuggestionStatus indicates an expected call of UpdateSuggestionStatus +// UpdateSuggestionStatus indicates an expected call of UpdateSuggestionStatus. func (mr *MockSuggestionMockRecorder) UpdateSuggestionStatus(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateSuggestionStatus", reflect.TypeOf((*MockSuggestion)(nil).UpdateSuggestionStatus), arg0) diff --git a/pkg/mock/v1beta1/trial/managerclient/katibmanager.go b/pkg/mock/v1beta1/trial/managerclient/katibmanager.go index 0a9d81fa544..f9b9772f9f7 100644 --- a/pkg/mock/v1beta1/trial/managerclient/katibmanager.go +++ b/pkg/mock/v1beta1/trial/managerclient/katibmanager.go @@ -7,58 +7,58 @@ package mock import ( gomock "github.com/golang/mock/gomock" v1beta1 "github.com/kubeflow/katib/pkg/apis/controller/trials/v1beta1" - v1beta10 "github.com/kubeflow/katib/pkg/apis/manager/v1beta1" + api_v1_beta1 "github.com/kubeflow/katib/pkg/apis/manager/v1beta1" reflect "reflect" ) -// MockManagerClient is a mock of ManagerClient interface +// MockManagerClient is a mock of ManagerClient interface. type MockManagerClient struct { ctrl *gomock.Controller recorder *MockManagerClientMockRecorder } -// MockManagerClientMockRecorder is the mock recorder for MockManagerClient +// MockManagerClientMockRecorder is the mock recorder for MockManagerClient. type MockManagerClientMockRecorder struct { mock *MockManagerClient } -// NewMockManagerClient creates a new mock instance +// NewMockManagerClient creates a new mock instance. func NewMockManagerClient(ctrl *gomock.Controller) *MockManagerClient { mock := &MockManagerClient{ctrl: ctrl} mock.recorder = &MockManagerClientMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockManagerClient) EXPECT() *MockManagerClientMockRecorder { return m.recorder } -// DeleteTrialObservationLog mocks base method -func (m *MockManagerClient) DeleteTrialObservationLog(arg0 *v1beta1.Trial) (*v1beta10.DeleteObservationLogReply, error) { +// DeleteTrialObservationLog mocks base method. +func (m *MockManagerClient) DeleteTrialObservationLog(arg0 *v1beta1.Trial) (*api_v1_beta1.DeleteObservationLogReply, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "DeleteTrialObservationLog", arg0) - ret0, _ := ret[0].(*v1beta10.DeleteObservationLogReply) + ret0, _ := ret[0].(*api_v1_beta1.DeleteObservationLogReply) ret1, _ := ret[1].(error) return ret0, ret1 } -// DeleteTrialObservationLog indicates an expected call of DeleteTrialObservationLog +// DeleteTrialObservationLog indicates an expected call of DeleteTrialObservationLog. func (mr *MockManagerClientMockRecorder) DeleteTrialObservationLog(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteTrialObservationLog", reflect.TypeOf((*MockManagerClient)(nil).DeleteTrialObservationLog), arg0) } -// GetTrialObservationLog mocks base method -func (m *MockManagerClient) GetTrialObservationLog(arg0 *v1beta1.Trial) (*v1beta10.GetObservationLogReply, error) { +// GetTrialObservationLog mocks base method. +func (m *MockManagerClient) GetTrialObservationLog(arg0 *v1beta1.Trial) (*api_v1_beta1.GetObservationLogReply, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetTrialObservationLog", arg0) - ret0, _ := ret[0].(*v1beta10.GetObservationLogReply) + ret0, _ := ret[0].(*api_v1_beta1.GetObservationLogReply) ret1, _ := ret[1].(error) return ret0, ret1 } -// GetTrialObservationLog indicates an expected call of GetTrialObservationLog +// GetTrialObservationLog indicates an expected call of GetTrialObservationLog. func (mr *MockManagerClientMockRecorder) GetTrialObservationLog(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTrialObservationLog", reflect.TypeOf((*MockManagerClient)(nil).GetTrialObservationLog), arg0) diff --git a/pkg/mock/v1beta1/util/katibclient/katibclient.go b/pkg/mock/v1beta1/util/katibclient/katibclient.go index b9b7779c8a1..025c20391b3 100644 --- a/pkg/mock/v1beta1/util/katibclient/katibclient.go +++ b/pkg/mock/v1beta1/util/katibclient/katibclient.go @@ -15,30 +15,30 @@ import ( client "sigs.k8s.io/controller-runtime/pkg/client" ) -// MockClient is a mock of Client interface +// MockClient is a mock of Client interface. type MockClient struct { ctrl *gomock.Controller recorder *MockClientMockRecorder } -// MockClientMockRecorder is the mock recorder for MockClient +// MockClientMockRecorder is the mock recorder for MockClient. type MockClientMockRecorder struct { mock *MockClient } -// NewMockClient creates a new mock instance +// NewMockClient creates a new mock instance. func NewMockClient(ctrl *gomock.Controller) *MockClient { mock := &MockClient{ctrl: ctrl} mock.recorder = &MockClientMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MockClient) EXPECT() *MockClientMockRecorder { return m.recorder } -// CreateRuntimeObject mocks base method +// CreateRuntimeObject mocks base method. func (m *MockClient) CreateRuntimeObject(arg0 runtime.Object) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CreateRuntimeObject", arg0) @@ -46,13 +46,13 @@ func (m *MockClient) CreateRuntimeObject(arg0 runtime.Object) error { return ret0 } -// CreateRuntimeObject indicates an expected call of CreateRuntimeObject +// CreateRuntimeObject indicates an expected call of CreateRuntimeObject. func (mr *MockClientMockRecorder) CreateRuntimeObject(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRuntimeObject", reflect.TypeOf((*MockClient)(nil).CreateRuntimeObject), arg0) } -// DeleteRuntimeObject mocks base method +// DeleteRuntimeObject mocks base method. func (m *MockClient) DeleteRuntimeObject(arg0 runtime.Object) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "DeleteRuntimeObject", arg0) @@ -60,13 +60,13 @@ func (m *MockClient) DeleteRuntimeObject(arg0 runtime.Object) error { return ret0 } -// DeleteRuntimeObject indicates an expected call of DeleteRuntimeObject +// DeleteRuntimeObject indicates an expected call of DeleteRuntimeObject. func (mr *MockClientMockRecorder) DeleteRuntimeObject(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteRuntimeObject", reflect.TypeOf((*MockClient)(nil).DeleteRuntimeObject), arg0) } -// GetClient mocks base method +// GetClient mocks base method. func (m *MockClient) GetClient() client.Client { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetClient") @@ -74,13 +74,13 @@ func (m *MockClient) GetClient() client.Client { return ret0 } -// GetClient indicates an expected call of GetClient +// GetClient indicates an expected call of GetClient. func (mr *MockClientMockRecorder) GetClient() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetClient", reflect.TypeOf((*MockClient)(nil).GetClient)) } -// GetConfigMap mocks base method +// GetConfigMap mocks base method. func (m *MockClient) GetConfigMap(arg0 string, arg1 ...string) (map[string]string, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0} @@ -93,14 +93,14 @@ func (m *MockClient) GetConfigMap(arg0 string, arg1 ...string) (map[string]strin return ret0, ret1 } -// GetConfigMap indicates an expected call of GetConfigMap +// GetConfigMap indicates an expected call of GetConfigMap. func (mr *MockClientMockRecorder) GetConfigMap(arg0 interface{}, arg1 ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{arg0}, arg1...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetConfigMap", reflect.TypeOf((*MockClient)(nil).GetConfigMap), varargs...) } -// GetExperiment mocks base method +// GetExperiment mocks base method. func (m *MockClient) GetExperiment(arg0 string, arg1 ...string) (*v1beta1.Experiment, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0} @@ -113,14 +113,14 @@ func (m *MockClient) GetExperiment(arg0 string, arg1 ...string) (*v1beta1.Experi return ret0, ret1 } -// GetExperiment indicates an expected call of GetExperiment +// GetExperiment indicates an expected call of GetExperiment. func (mr *MockClientMockRecorder) GetExperiment(arg0 interface{}, arg1 ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{arg0}, arg1...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetExperiment", reflect.TypeOf((*MockClient)(nil).GetExperiment), varargs...) } -// GetExperimentList mocks base method +// GetExperimentList mocks base method. func (m *MockClient) GetExperimentList(arg0 ...string) (*v1beta1.ExperimentList, error) { m.ctrl.T.Helper() varargs := []interface{}{} @@ -133,13 +133,13 @@ func (m *MockClient) GetExperimentList(arg0 ...string) (*v1beta1.ExperimentList, return ret0, ret1 } -// GetExperimentList indicates an expected call of GetExperimentList +// GetExperimentList indicates an expected call of GetExperimentList. func (mr *MockClientMockRecorder) GetExperimentList(arg0 ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetExperimentList", reflect.TypeOf((*MockClient)(nil).GetExperimentList), arg0...) } -// GetNamespaceList mocks base method +// GetNamespaceList mocks base method. func (m *MockClient) GetNamespaceList() (*v1.NamespaceList, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetNamespaceList") @@ -148,13 +148,13 @@ func (m *MockClient) GetNamespaceList() (*v1.NamespaceList, error) { return ret0, ret1 } -// GetNamespaceList indicates an expected call of GetNamespaceList +// GetNamespaceList indicates an expected call of GetNamespaceList. func (mr *MockClientMockRecorder) GetNamespaceList() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetNamespaceList", reflect.TypeOf((*MockClient)(nil).GetNamespaceList)) } -// GetSuggestion mocks base method +// GetSuggestion mocks base method. func (m *MockClient) GetSuggestion(arg0 string, arg1 ...string) (*v1beta10.Suggestion, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0} @@ -167,14 +167,14 @@ func (m *MockClient) GetSuggestion(arg0 string, arg1 ...string) (*v1beta10.Sugge return ret0, ret1 } -// GetSuggestion indicates an expected call of GetSuggestion +// GetSuggestion indicates an expected call of GetSuggestion. func (mr *MockClientMockRecorder) GetSuggestion(arg0 interface{}, arg1 ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{arg0}, arg1...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSuggestion", reflect.TypeOf((*MockClient)(nil).GetSuggestion), varargs...) } -// GetTrial mocks base method +// GetTrial mocks base method. func (m *MockClient) GetTrial(arg0 string, arg1 ...string) (*v1beta11.Trial, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0} @@ -187,14 +187,14 @@ func (m *MockClient) GetTrial(arg0 string, arg1 ...string) (*v1beta11.Trial, err return ret0, ret1 } -// GetTrial indicates an expected call of GetTrial +// GetTrial indicates an expected call of GetTrial. func (mr *MockClientMockRecorder) GetTrial(arg0 interface{}, arg1 ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{arg0}, arg1...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTrial", reflect.TypeOf((*MockClient)(nil).GetTrial), varargs...) } -// GetTrialList mocks base method +// GetTrialList mocks base method. func (m *MockClient) GetTrialList(arg0 string, arg1 ...string) (*v1beta11.TrialList, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0} @@ -207,14 +207,14 @@ func (m *MockClient) GetTrialList(arg0 string, arg1 ...string) (*v1beta11.TrialL return ret0, ret1 } -// GetTrialList indicates an expected call of GetTrialList +// GetTrialList indicates an expected call of GetTrialList. func (mr *MockClientMockRecorder) GetTrialList(arg0 interface{}, arg1 ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{arg0}, arg1...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTrialList", reflect.TypeOf((*MockClient)(nil).GetTrialList), varargs...) } -// GetTrialTemplates mocks base method +// GetTrialTemplates mocks base method. func (m *MockClient) GetTrialTemplates(arg0 ...string) (*v1.ConfigMapList, error) { m.ctrl.T.Helper() varargs := []interface{}{} @@ -227,25 +227,25 @@ func (m *MockClient) GetTrialTemplates(arg0 ...string) (*v1.ConfigMapList, error return ret0, ret1 } -// GetTrialTemplates indicates an expected call of GetTrialTemplates +// GetTrialTemplates indicates an expected call of GetTrialTemplates. func (mr *MockClientMockRecorder) GetTrialTemplates(arg0 ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTrialTemplates", reflect.TypeOf((*MockClient)(nil).GetTrialTemplates), arg0...) } -// InjectClient mocks base method +// InjectClient mocks base method. func (m *MockClient) InjectClient(arg0 client.Client) { m.ctrl.T.Helper() m.ctrl.Call(m, "InjectClient", arg0) } -// InjectClient indicates an expected call of InjectClient +// InjectClient indicates an expected call of InjectClient. func (mr *MockClientMockRecorder) InjectClient(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InjectClient", reflect.TypeOf((*MockClient)(nil).InjectClient), arg0) } -// UpdateRuntimeObject mocks base method +// UpdateRuntimeObject mocks base method. func (m *MockClient) UpdateRuntimeObject(arg0 runtime.Object) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "UpdateRuntimeObject", arg0) @@ -253,7 +253,7 @@ func (m *MockClient) UpdateRuntimeObject(arg0 runtime.Object) error { return ret0 } -// UpdateRuntimeObject indicates an expected call of UpdateRuntimeObject +// UpdateRuntimeObject indicates an expected call of UpdateRuntimeObject. func (mr *MockClientMockRecorder) UpdateRuntimeObject(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateRuntimeObject", reflect.TypeOf((*MockClient)(nil).UpdateRuntimeObject), arg0) diff --git a/pkg/webhook/v1beta1/experiment/validator/validator.go b/pkg/webhook/v1beta1/experiment/validator/validator.go index 5a97cc150e9..75bb2e6c5ba 100644 --- a/pkg/webhook/v1beta1/experiment/validator/validator.go +++ b/pkg/webhook/v1beta1/experiment/validator/validator.go @@ -231,15 +231,15 @@ func (g *DefaultValidator) validateTrialTemplate(instance *experimentsv1beta1.Ex trialParametersRefs[parameter.Reference] = true // Check if trialParameters contains all substitution for Trial template - if strings.Index(trialTemplateStr, fmt.Sprintf(consts.TrialTemplateReplaceFormat, parameter.Name)) == -1 { + if strings.Index(trialTemplateStr, fmt.Sprintf(consts.TrialTemplateParamReplaceFormat, parameter.Name)) == -1 { return fmt.Errorf("Parameter name: %v in spec.trialParameters not found in spec.trialTemplate: %v", parameter.Name, trialTemplateStr) } - trialTemplateStr = strings.Replace(trialTemplateStr, fmt.Sprintf(consts.TrialTemplateReplaceFormat, parameter.Name), "test-value", -1) + trialTemplateStr = strings.Replace(trialTemplateStr, fmt.Sprintf(consts.TrialTemplateParamReplaceFormat, parameter.Name), "test-value", -1) } // Check if Trial template contains all substitution for trialParameters - substitutionRegex := regexp.MustCompile(consts.TrialTemplateReplaceFormatRegex) + substitutionRegex := regexp.MustCompile(consts.TrialTemplateParamReplaceFormatRegex) notReplacedParams := substitutionRegex.FindAllString(trialTemplateStr, -1) if len(notReplacedParams) != 0 { return fmt.Errorf("Parameters: %v in spec.trialTemplate not found in spec.trialParameters: %v", notReplacedParams, trialTemplate.TrialParameters)