Skip to content

Commit

Permalink
Remove appContext
Browse files Browse the repository at this point in the history
Signed-off-by: Luiz Carvalho <lucarval@redhat.com>
  • Loading branch information
lcarva committed Sep 6, 2023
1 parent 436fd2f commit c6069f5
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions pkg/chains/formats/slsa/v1/intotoite6_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func TestTaskRunCreatePayload1(t *testing.T) {
},
},
}
i, _ := NewFormatter(appContext(), cfg)
i, _ := NewFormatter(context.Background(), cfg)

got, err := i.CreatePayload(ctx, objects.NewTaskRunObject(tr))

Expand Down Expand Up @@ -360,7 +360,7 @@ func TestPipelineRunCreatePayload(t *testing.T) {
pro.AppendTaskRun(tr1)
pro.AppendTaskRun(tr2)

i, _ := NewFormatter(appContext(), cfg)
i, _ := NewFormatter(context.Background(), cfg)

got, err := i.CreatePayload(ctx, pro)
if err != nil {
Expand Down Expand Up @@ -578,7 +578,7 @@ func TestPipelineRunCreatePayloadChildRefs(t *testing.T) {
pro.AppendTaskRun(tr1)
pro.AppendTaskRun(tr2)

i, _ := NewFormatter(appContext(), cfg)
i, _ := NewFormatter(context.Background(), cfg)
got, err := i.CreatePayload(ctx, pro)
if err != nil {
t.Errorf("unexpected error: %s", err.Error())
Expand Down Expand Up @@ -653,7 +653,7 @@ func TestTaskRunCreatePayload2(t *testing.T) {
},
},
}
i, _ := NewFormatter(appContext(), cfg)
i, _ := NewFormatter(context.Background(), cfg)
got, err := i.CreatePayload(ctx, objects.NewTaskRunObject(tr))

if err != nil {
Expand Down Expand Up @@ -724,7 +724,7 @@ func TestMultipleSubjects(t *testing.T) {
},
}

i, _ := NewFormatter(appContext(), cfg)
i, _ := NewFormatter(context.Background(), cfg)
got, err := i.CreatePayload(ctx, objects.NewTaskRunObject(tr))
if err != nil {
t.Errorf("unexpected error: %s", err.Error())
Expand All @@ -741,7 +741,7 @@ func TestNewFormatter(t *testing.T) {
ID: "testid",
},
}
f, err := NewFormatter(appContext(), cfg)
f, err := NewFormatter(context.Background(), cfg)
if f == nil {
t.Error("Failed to create formatter")
}
Expand All @@ -759,7 +759,7 @@ func TestCreatePayloadError(t *testing.T) {
ID: "testid",
},
}
f, _ := NewFormatter(appContext(), cfg)
f, _ := NewFormatter(context.Background(), cfg)

t.Run("Invalid type", func(t *testing.T) {
p, err := f.CreatePayload(ctx, "not a task ref")
Expand All @@ -784,7 +784,3 @@ func TestCorrectPayloadType(t *testing.T) {
t.Errorf("Invalid type returned: %s", i.Type())
}
}

func appContext() context.Context {
return context.Background()
}

0 comments on commit c6069f5

Please sign in to comment.