Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
This commit is contained in:
ItalyPaleAle 2023-01-21 19:40:52 +00:00
parent 232c8d813f
commit 1fd48dd912
2 changed files with 14 additions and 8 deletions

View File

@ -28,7 +28,7 @@ import (
type azureEventHubsMetadata struct {
ConnectionString string `json:"connectionString" mapstructure:"connectionString"`
EventHubNamespace string `json:"eventHubNamespace" mapstructure:"eventHubNamespace"`
ConsumerGroup string `json:"consumerID" mapstructure:"consumerID"`
ConsumerID string `json:"consumerID" mapstructure:"consumerID"`
StorageConnectionString string `json:"storageConnectionString" mapstructure:"storageConnectionString"`
StorageAccountName string `json:"storageAccountName" mapstructure:"storageAccountName"`
StorageAccountKey string `json:"storageAccountKey" mapstructure:"storageAccountKey"`
@ -40,7 +40,8 @@ type azureEventHubsMetadata struct {
ResourceGroupName string `json:"resourceGroupName" mapstructure:"resourceGroupName"`
// Binding only
EventHub string `json:"eventHub" mapstructure:"eventHub"`
EventHub string `json:"eventHub" mapstructure:"eventHub"`
ConsumerGroup string `json:"consumerGroup" mapstructure:"consumerGroup"` // Alias for ConsumerID
// Internal properties
namespaceName string
@ -67,6 +68,11 @@ func parseEventHubsMetadata(meta map[string]string, isBinding bool, log logger.L
return nil, errors.New("only one of connectionString or eventHubNamespace should be passed")
}
// ConsumerGroup is an alias for ConsumerID
if m.ConsumerID != "" && m.ConsumerGroup == "" {
m.ConsumerGroup = m.ConsumerID
}
// For the binding, we need to have a property "eventHub" which is the topic name unless it's included in the connection string
if isBinding {
if m.ConnectionString == "" {

View File

@ -146,23 +146,23 @@ func ConformanceTests(t *testing.T, props map[string]string, inputBinding bindin
if config.HasOperation("read") {
errInp := bindings.PingInpBinding(inputBinding)
// TODO: Ideally, all stable components should implenment ping function,
// so will only assert assert.Nil(t, err) finally, i.e. when current implementation
// so will only assert assert.NoError(t, err) finally, i.e. when current implementation
// implements ping in existing stable components
if errInp != nil {
assert.EqualError(t, errInp, "ping is not implemented by this input binding")
} else {
assert.Nil(t, errInp)
assert.NoError(t, errInp)
}
}
if config.HasOperation("operations") {
errOut := bindings.PingOutBinding(outputBinding)
// TODO: Ideally, all stable components should implenment ping function,
// so will only assert assert.Nil(t, err) finally, i.e. when current implementation
// so will only assert assert.NoError(t, err) finally, i.e. when current implementation
// implements ping in existing stable components
if errOut != nil {
assert.EqualError(t, errOut, "ping is not implemented by this output binding")
} else {
assert.Nil(t, errOut)
assert.NoError(t, errOut)
}
}
})
@ -233,7 +233,7 @@ func ConformanceTests(t *testing.T, props map[string]string, inputBinding bindin
req := config.createInvokeRequest()
req.Operation = bindings.GetOperation
resp, err := outputBinding.Invoke(context.Background(), &req)
assert.Nil(t, err, "expected no error invoking output binding")
assert.NoError(t, err, "expected no error invoking output binding")
if createPerformed {
assert.Equal(t, req.Data, resp.Data)
}
@ -276,7 +276,7 @@ func ConformanceTests(t *testing.T, props map[string]string, inputBinding bindin
req := config.createInvokeRequest()
req.Operation = bindings.DeleteOperation
_, err := outputBinding.Invoke(context.Background(), &req)
assert.Nil(t, err, "expected no error invoking output binding")
assert.NoError(t, err, "expected no error invoking output binding")
if createPerformed && config.HasOperation(string(bindings.GetOperation)) {
req.Operation = bindings.GetOperation