Skip to content

Commit

Permalink
update testCase with correct event type
Browse files Browse the repository at this point in the history
Signed-off-by: Jalander Ramagiri <[email protected]>
  • Loading branch information
Jalander Ramagiri committed Aug 14, 2024
1 parent eaa4fa7 commit 89be5f9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/cdevents/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ SPDX-License-Identifier: Apache-2.0
package cdevents

import (
"github.com/stretchr/testify/assert"
"os"
"path/filepath"
"testing"

"github.com/stretchr/testify/assert"
)

func TestLoadTranslator_PluginsConfig(t *testing.T) {
Expand Down Expand Up @@ -78,7 +79,7 @@ func TestValidate_InValidURL(t *testing.T) {
}

func TestSendCDEvent(t *testing.T) {
eventToSend := "{\n \"context\": {\n \"version\": \"0.3.0\",\n \"id\": \"eb175ff7-2fda-44c5-bdb4-17b1c7342fc0\",\n \"source\": \"http://dev.cdevents\",\n \"type\": \"dev.cdevents.pipelinerun.finished.0.1.1\",\n \"timestamp\": \"2024-02-29T15:23:09Z\"\n },\n \"subject\": {\n \"id\": \"/dev/pipeline/run/subject\",\n \"source\": \"/dev/pipeline/run/subject\",\n \"type\": \"pipelineRun\",\n \"content\": {\n \"pipelineName\": \"Name-pipeline\",\n \"url\": \"http://dev/pipeline/url\",\n \"outcome\": \"success\",\n \"errors\": \"errors to place\"\n }\n },\n \"customData\": {\n },\n \"customDataContentType\": \"application/json\"\n}"
eventToSend := "{\n \"context\": {\n \"version\": \"0.3.0\",\n \"id\": \"eb175ff7-2fda-44c5-bdb4-17b1c7342fc0\",\n \"source\": \"http://dev.cdevents\",\n \"type\": \"dev.cdevents.pipelinerun.finished.0.2.0\",\n \"timestamp\": \"2024-02-29T15:23:09Z\"\n },\n \"subject\": {\n \"id\": \"/dev/pipeline/run/subject\",\n \"source\": \"/dev/pipeline/run/subject\",\n \"type\": \"pipelineRun\",\n \"content\": {\n \"pipelineName\": \"Name-pipeline\",\n \"url\": \"http://dev/pipeline/url\",\n \"outcome\": \"success\",\n \"errors\": \"errors to place\"\n }\n },\n \"customData\": {\n },\n \"customDataContentType\": \"application/json\"\n}"

err := SendCDEvent(eventToSend, "http://cdevents.message.com/default/events-broker")
assert.Error(t, err, "Expected an error")
Expand Down

0 comments on commit 89be5f9

Please sign in to comment.