Skip to content

Commit

Permalink
fix: integration test
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Sukhin <vladislav@kubeshop.io>
  • Loading branch information
vsukhin committed Jul 3, 2024
1 parent be2e7c9 commit c6c4c5c
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 c6c4c5c

Please sign in to comment.