Fixes
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
This commit is contained in:
parent
232c8d813f
commit
1fd48dd912
|
@ -28,7 +28,7 @@ import (
|
||||||
type azureEventHubsMetadata struct {
|
type azureEventHubsMetadata struct {
|
||||||
ConnectionString string `json:"connectionString" mapstructure:"connectionString"`
|
ConnectionString string `json:"connectionString" mapstructure:"connectionString"`
|
||||||
EventHubNamespace string `json:"eventHubNamespace" mapstructure:"eventHubNamespace"`
|
EventHubNamespace string `json:"eventHubNamespace" mapstructure:"eventHubNamespace"`
|
||||||
ConsumerGroup string `json:"consumerID" mapstructure:"consumerID"`
|
ConsumerID string `json:"consumerID" mapstructure:"consumerID"`
|
||||||
StorageConnectionString string `json:"storageConnectionString" mapstructure:"storageConnectionString"`
|
StorageConnectionString string `json:"storageConnectionString" mapstructure:"storageConnectionString"`
|
||||||
StorageAccountName string `json:"storageAccountName" mapstructure:"storageAccountName"`
|
StorageAccountName string `json:"storageAccountName" mapstructure:"storageAccountName"`
|
||||||
StorageAccountKey string `json:"storageAccountKey" mapstructure:"storageAccountKey"`
|
StorageAccountKey string `json:"storageAccountKey" mapstructure:"storageAccountKey"`
|
||||||
|
@ -41,6 +41,7 @@ type azureEventHubsMetadata struct {
|
||||||
|
|
||||||
// Binding only
|
// 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
|
// Internal properties
|
||||||
namespaceName string
|
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")
|
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
|
// 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 isBinding {
|
||||||
if m.ConnectionString == "" {
|
if m.ConnectionString == "" {
|
||||||
|
|
|
@ -146,23 +146,23 @@ func ConformanceTests(t *testing.T, props map[string]string, inputBinding bindin
|
||||||
if config.HasOperation("read") {
|
if config.HasOperation("read") {
|
||||||
errInp := bindings.PingInpBinding(inputBinding)
|
errInp := bindings.PingInpBinding(inputBinding)
|
||||||
// TODO: Ideally, all stable components should implenment ping function,
|
// 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
|
// implements ping in existing stable components
|
||||||
if errInp != nil {
|
if errInp != nil {
|
||||||
assert.EqualError(t, errInp, "ping is not implemented by this input binding")
|
assert.EqualError(t, errInp, "ping is not implemented by this input binding")
|
||||||
} else {
|
} else {
|
||||||
assert.Nil(t, errInp)
|
assert.NoError(t, errInp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if config.HasOperation("operations") {
|
if config.HasOperation("operations") {
|
||||||
errOut := bindings.PingOutBinding(outputBinding)
|
errOut := bindings.PingOutBinding(outputBinding)
|
||||||
// TODO: Ideally, all stable components should implenment ping function,
|
// 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
|
// implements ping in existing stable components
|
||||||
if errOut != nil {
|
if errOut != nil {
|
||||||
assert.EqualError(t, errOut, "ping is not implemented by this output binding")
|
assert.EqualError(t, errOut, "ping is not implemented by this output binding")
|
||||||
} else {
|
} 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 := config.createInvokeRequest()
|
||||||
req.Operation = bindings.GetOperation
|
req.Operation = bindings.GetOperation
|
||||||
resp, err := outputBinding.Invoke(context.Background(), &req)
|
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 {
|
if createPerformed {
|
||||||
assert.Equal(t, req.Data, resp.Data)
|
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 := config.createInvokeRequest()
|
||||||
req.Operation = bindings.DeleteOperation
|
req.Operation = bindings.DeleteOperation
|
||||||
_, err := outputBinding.Invoke(context.Background(), &req)
|
_, 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)) {
|
if createPerformed && config.HasOperation(string(bindings.GetOperation)) {
|
||||||
req.Operation = bindings.GetOperation
|
req.Operation = bindings.GetOperation
|
||||||
|
|
Loading…
Reference in New Issue