Skip to content

Commit

Permalink
fix: integration test
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Sukhin <[email protected]>
  • Loading branch information
vsukhin committed Jul 2, 2024
1 parent 8f14515 commit 21fe239
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions cmd/testworkflow-toolkit/commands/artifacts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"testing"

"github.com/kubeshop/testkube/pkg/cloud/data/testworkflow"
"github.com/kubeshop/testkube/pkg/mapper/cdevents"
"github.com/kubeshop/testkube/pkg/utils/test"

"github.com/golang/mock/gomock"
Expand Down Expand Up @@ -37,6 +38,10 @@ func TestRun_Integration(t *testing.T) {
w.WriteHeader(http.StatusOK)
return
}
if r.Method == http.MethodPost {
w.WriteHeader(http.StatusOK)
return
}
http.NotFound(w, r)
})

Expand Down Expand Up @@ -66,9 +71,15 @@ func TestRun_Integration(t *testing.T) {
return filesystem.NewMockFile(path[1:], b), nil
})
postProcessor := artifacts.NewJUnitPostProcessor(mockFs, mockClient, "/", "")
handler := artifacts.NewHandler(uploader, processor, artifacts.WithPostProcessor(postProcessor))
handler := artifacts.NewHandler(uploader, processor, artifacts.WithPostProcessor(postProcessor),
artifacts.WithCDEventsTarget(server.URL), artifacts.WithCDEventsArtifactParameters(cdevents.CDEventsArtifactParameters{
Id: "1",
Name: "test-1",
WorkflowName: "test",
ClusterID: "12345",
}))

run(handler, walker, testDataFixtures)

assert.Equal(t, 2, httpRequestCount)
assert.Equal(t, 4, httpRequestCount)
}

0 comments on commit 21fe239

Please sign in to comment.