Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdoherty4 committed Jan 10, 2023
1 parent e7a441e commit 2bc83b8
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ issues:
linters:
- noctx
# local to tink: kubebuilder needs the stdlib invalid `inline` json struct tag
- path: pkg/apis/.*
text: "struct-tag"
- path: api/.*
text: "struct-tag: unknown option 'inline'"
- path: main\.go
linters:
- noctx
Expand Down
8 changes: 4 additions & 4 deletions internal/server/kubernetes_api_workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ func (s *KubernetesBackedServer) getCurrentAssignedNonTerminalWorkflowsForWorker
}

func (s *KubernetesBackedServer) getWorkflowByName(ctx context.Context, workflowID, namespace string) (*v1alpha1.Workflow, error) {
workflow := &v1alpha1.Workflow{}
err := s.ClientFunc().Get(ctx, types.NamespacedName{Name: workflowID, Namespace: namespace}, workflow)
wflw := &v1alpha1.Workflow{}
err := s.ClientFunc().Get(ctx, types.NamespacedName{Name: workflowID, Namespace: namespace}, wflw)
if err != nil {
s.logger.With("workflow", workflowID).Error(err)
return nil, err
}
return workflow, nil
return wflw, nil
}

// The following APIs are used by the worker.
Expand Down Expand Up @@ -90,7 +90,7 @@ func (s *KubernetesBackedServer) GetWorkflowActions(ctx context.Context, req *pr
if err != nil {
return nil, err
}
return workflow.WorkflowActionListCRDToProto(wf), nil
return workflow.ActionListCRDToProto(wf), nil
}

// Modifies a workflow for a given workflowContext.
Expand Down
2 changes: 1 addition & 1 deletion internal/workflow/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func (c *Controller) processNewWorkflow(ctx context.Context, logger logr.Logger,
}

// populate Task and Action data
stored.Status = *WorkflowYAMLToStatus(tinkWf)
stored.Status = *YAMLToStatus(tinkWf)

stored.Status.State = v1alpha1.WorkflowStatePending
return reconcile.Result{}, nil
Expand Down
6 changes: 3 additions & 3 deletions internal/workflow/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/tinkerbell/tink/internal/proto"
)

func WorkflowToWorkflowContext(wf *v1alpha1.Workflow) *proto.WorkflowContext {
func ToWorkflowContext(wf *v1alpha1.Workflow) *proto.WorkflowContext {
if wf == nil {
return nil
}
Expand All @@ -23,7 +23,7 @@ func WorkflowToWorkflowContext(wf *v1alpha1.Workflow) *proto.WorkflowContext {
}
}

func WorkflowYAMLToStatus(wf *Workflow) *v1alpha1.WorkflowStatus {
func YAMLToStatus(wf *Workflow) *v1alpha1.WorkflowStatus {
if wf == nil {
return nil
}
Expand Down Expand Up @@ -56,7 +56,7 @@ func WorkflowYAMLToStatus(wf *Workflow) *v1alpha1.WorkflowStatus {
}
}

func WorkflowActionListCRDToProto(wf *v1alpha1.Workflow) *proto.WorkflowActionList {
func ActionListCRDToProto(wf *v1alpha1.Workflow) *proto.WorkflowActionList {
if wf == nil {
return nil
}
Expand Down
12 changes: 6 additions & 6 deletions internal/workflow/convert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

var convertTestTime = testtime.NewFrozenTimeUnix(1637361794)

func TestWorkflowToWorkflowContext(t *testing.T) {
func TestToWorkflowContext(t *testing.T) {
cases := []struct {
name string
input *v1alpha1.Workflow
Expand Down Expand Up @@ -82,15 +82,15 @@ func TestWorkflowToWorkflowContext(t *testing.T) {

for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
got := WorkflowToWorkflowContext(tc.input)
got := ToWorkflowContext(tc.input)
if !reflect.DeepEqual(got, tc.want) {
t.Errorf("Unexpedted response: wanted\n\t%#v\ngot\n\t%#v", tc.want, got)
}
})
}
}

func TestWorkflowActionListCRDToProto(t *testing.T) {
func TestActionListCRDToProto(t *testing.T) {
cases := []struct {
name string
input *v1alpha1.Workflow
Expand Down Expand Up @@ -229,15 +229,15 @@ func TestWorkflowActionListCRDToProto(t *testing.T) {

for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
got := WorkflowActionListCRDToProto(tc.input)
got := ActionListCRDToProto(tc.input)
if diff := cmp.Diff(tc.want, got, protocmp.Transform()); diff != "" {
t.Errorf("unexpected difference:\n%v", diff)
}
})
}
}

func TestWorkflowYAMLToStatus(t *testing.T) {
func TestYAMLToStatus(t *testing.T) {
cases := []struct {
name string
inputWf *Workflow
Expand Down Expand Up @@ -315,7 +315,7 @@ func TestWorkflowYAMLToStatus(t *testing.T) {

for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
got := WorkflowYAMLToStatus(tc.inputWf)
got := YAMLToStatus(tc.inputWf)
if diff := cmp.Diff(got, tc.want, protocmp.Transform()); diff != "" {
t.Errorf("unexpected difference:\n%v", diff)
}
Expand Down

0 comments on commit 2bc83b8

Please sign in to comment.