diff --git a/chaoscenter/graphql/server/pkg/chaos_experiment/handler/handler.go b/chaoscenter/graphql/server/pkg/chaos_experiment/handler/handler.go index ee51be6d05f..11e7f7b18ed 100644 --- a/chaoscenter/graphql/server/pkg/chaos_experiment/handler/handler.go +++ b/chaoscenter/graphql/server/pkg/chaos_experiment/handler/handler.go @@ -1513,7 +1513,7 @@ func (c *ChaosExperimentHandler) StopExperimentRuns(ctx context.Context, project if len(experimentRunsID) == 0 && experiment.CronSyntax == "" { return false, fmt.Errorf("no running or timeout experiments found") } - } else if experimentRunID != nil && *experimentRunID != "" { + } else if *experimentRunID != "" { experimentRunsID = []string{*experimentRunID} } diff --git a/chaoscenter/graphql/server/pkg/environment/handler/handler.go b/chaoscenter/graphql/server/pkg/environment/handler/handler.go index 8cd437ac419..c4032489ea1 100644 --- a/chaoscenter/graphql/server/pkg/environment/handler/handler.go +++ b/chaoscenter/graphql/server/pkg/environment/handler/handler.go @@ -228,7 +228,7 @@ func (e *EnvironmentService) ListEnvironments(projectID string, request *model.L } // Filtering based on given parameters - if request.Filter != nil { + if request != nil && request.Filter != nil { // Filtering based on chaos_infra name if request.Filter.Name != nil && *request.Filter.Name != "" { matchInfraNameStage := bson.D{ @@ -280,7 +280,7 @@ func (e *EnvironmentService) ListEnvironments(projectID string, request *model.L var sortStage bson.D switch { - case request.Sort != nil && request.Sort.Field == model.EnvironmentSortingFieldTime: + case request != nil && request.Sort != nil && request.Sort.Field == model.EnvironmentSortingFieldTime: // Sorting based on created time if request.Sort.Ascending != nil && *request.Sort.Ascending { sortStage = bson.D{ @@ -295,7 +295,7 @@ func (e *EnvironmentService) ListEnvironments(projectID string, request *model.L }}, } } - case request.Sort != nil && request.Sort.Field == model.EnvironmentSortingFieldName: + case request != nil && request.Sort != nil && request.Sort.Field == model.EnvironmentSortingFieldName: // Sorting based on ExperimentName time if request.Sort.Ascending != nil && *request.Sort.Ascending { sortStage = bson.D{ @@ -324,7 +324,7 @@ func (e *EnvironmentService) ListEnvironments(projectID string, request *model.L sortStage, } - if request.Pagination != nil { + if request != nil && request.Pagination != nil { paginationSkipStage := bson.D{ {"$skip", request.Pagination.Page * request.Pagination.Limit}, } diff --git a/chaoscenter/graphql/server/pkg/gitops/service.go b/chaoscenter/graphql/server/pkg/gitops/service.go index 2c19987af22..9ddf4091c50 100644 --- a/chaoscenter/graphql/server/pkg/gitops/service.go +++ b/chaoscenter/graphql/server/pkg/gitops/service.go @@ -621,12 +621,11 @@ func (g *gitOpsService) updateExperiment(ctx context.Context, data, wfID, file s } revID := "" - updateRevision := false input, wfType, err := g.chaosExperimentService.ProcessExperiment(ctx, &experimentData, config.ProjectID, revID) if err != nil { return err } - return g.chaosExperimentService.ProcessExperimentUpdate(input, "git-ops", wfType, revID, updateRevision, config.ProjectID, dataStore.Store) + return g.chaosExperimentService.ProcessExperimentUpdate(input, "git-ops", wfType, revID, false, config.ProjectID, dataStore.Store) } // deleteExperiment helps in deleting experiment from DB during the SyncDBToGit operation