Skip to content

Commit

Permalink
fixed couple issues
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Brunko <timmyb32r@gmail.com>
  • Loading branch information
timmyb32r committed Dec 12, 2023
1 parent 9ccd339 commit 41e80f7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion binding/format/protobuf/v2/protobuf.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func ToProto(e *event.Event) (*pb.CloudEvent, error) {
dataSchemaStr := e.DataSchema()
uri, err := url.Parse(dataSchemaStr)
if err != nil {
return nil, fmt.Errorf("failed to url.Parse %s: %s", dataSchemaStr, err)
return nil, fmt.Errorf("failed to url.Parse %s: %w", dataSchemaStr, err)
}
container.Attributes[dataschema], _ = attributeFor(uri)
}
Expand Down
12 changes: 6 additions & 6 deletions binding/format/protobuf/v2/protobuf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func TestFromProto(t *testing.T) {
Type: "some.type",
Attributes: map[string]*pb.CloudEventAttributeValue{
"datacontenttype": {Attr: &pb.CloudEventAttributeValue_CeString{CeString: "application/json"}},
"dataschema": {Attr: &pb.CloudEventAttributeValue_CeUri{CeUri: "link"}},
"dataschema": {Attr: &pb.CloudEventAttributeValue_CeUri{CeUri: "https://example-data-schema.com"}},
"extra1": {Attr: &pb.CloudEventAttributeValue_CeString{CeString: "extra1 value"}},
"extra2": {Attr: &pb.CloudEventAttributeValue_CeInteger{CeInteger: 2}},
"extra3": {Attr: &pb.CloudEventAttributeValue_CeBoolean{CeBoolean: true}},
Expand All @@ -125,7 +125,7 @@ func TestFromProto(t *testing.T) {
out.SetSource("/source")
out.SetType("some.type")
_ = out.SetData("application/json", map[string]interface{}{"unit": "test"})
out.SetDataSchema("link")
out.SetDataSchema("https://example-data-schema.com")
out.SetExtension("extra1", "extra1 value")
out.SetExtension("extra2", 2)
out.SetExtension("extra3", true)
Expand All @@ -142,7 +142,7 @@ func TestFromProto(t *testing.T) {
Type: "some.type",
Attributes: map[string]*pb.CloudEventAttributeValue{
"datacontenttype": {Attr: &pb.CloudEventAttributeValue_CeString{CeString: "text/plain"}},
"dataschema": {Attr: &pb.CloudEventAttributeValue_CeUri{CeUri: "link"}},
"dataschema": {Attr: &pb.CloudEventAttributeValue_CeUri{CeUri: "https://example-data-schema.com"}},
"extra1": {Attr: &pb.CloudEventAttributeValue_CeString{CeString: "extra1 value"}},
"extra2": {Attr: &pb.CloudEventAttributeValue_CeInteger{CeInteger: 2}},
"extra3": {Attr: &pb.CloudEventAttributeValue_CeBoolean{CeBoolean: true}},
Expand All @@ -158,7 +158,7 @@ func TestFromProto(t *testing.T) {
out.SetSource("/source")
out.SetType("some.type")
_ = out.SetData("text/plain", `this is some text with a "quote"`)
out.SetDataSchema("link")
out.SetDataSchema("https://example-data-schema.com")
out.SetExtension("extra1", "extra1 value")
out.SetExtension("extra2", 2)
out.SetExtension("extra3", true)
Expand All @@ -175,7 +175,7 @@ func TestFromProto(t *testing.T) {
Type: "some.type",
Attributes: map[string]*pb.CloudEventAttributeValue{
"datacontenttype": {Attr: &pb.CloudEventAttributeValue_CeString{CeString: "application/json"}},
"dataschema": {Attr: &pb.CloudEventAttributeValue_CeUri{CeUri: "link"}},
"dataschema": {Attr: &pb.CloudEventAttributeValue_CeUri{CeUri: "https://example-data-schema.com"}},
"extra1": {Attr: &pb.CloudEventAttributeValue_CeString{CeString: "extra1 value"}},
"extra2": {Attr: &pb.CloudEventAttributeValue_CeInteger{CeInteger: 2}},
"extra3": {Attr: &pb.CloudEventAttributeValue_CeBoolean{CeBoolean: true}},
Expand All @@ -191,7 +191,7 @@ func TestFromProto(t *testing.T) {
out.SetSource("/source")
out.SetType("some.type")
_ = out.SetData("application/json", `{"unit":"test"}`)
out.SetDataSchema("link")
out.SetDataSchema("https://example-data-schema.com")
out.SetExtension("extra1", "extra1 value")
out.SetExtension("extra2", 2)
out.SetExtension("extra3", true)
Expand Down

0 comments on commit 41e80f7

Please sign in to comment.