未验证 提交 0c8292c5 编写于 作者: L Loong Dai 提交者: GitHub

Merge pull request #6439 from Taction/fix_wasm_binding

Fix wasm binding register
......@@ -714,16 +714,24 @@ func (a *DaprRuntime) buildAppHTTPPipeline() (httpMiddleware.Pipeline, error) {
}
func (a *DaprRuntime) initBinding(c componentsV1alpha1.Component) error {
found := false
if a.bindingsRegistry.HasOutputBinding(c.Spec.Type, c.Spec.Version) {
if err := a.initOutputBinding(c); err != nil {
return err
}
found = true
}
if a.bindingsRegistry.HasInputBinding(c.Spec.Type, c.Spec.Version) {
if err := a.initInputBinding(c); err != nil {
return err
}
found = true
}
if !found {
diag.DefaultMonitoring.ComponentInitFailed(c.Spec.Type, "creation", c.ObjectMeta.Name)
return fmt.Errorf("couldn't find binding %s/%s", c.Spec.Type, c.Spec.Version)
}
return nil
}
......
......@@ -5082,6 +5082,19 @@ func TestInitBindings(t *testing.T) {
err = r.initBinding(output)
assert.NoError(t, err)
})
t.Run("one not exist binding", func(t *testing.T) {
r := NewDaprRuntime(&Config{}, &config.Configuration{}, &config.AccessControlList{}, resiliency.New(logger.NewLogger("test")))
r.bindingsRegistry = bindingsLoader.NewRegistry()
defer stopRuntime(t, r)
// no binding registered, just try to init a not exist binding
c := componentsV1alpha1.Component{}
c.ObjectMeta.Name = "testNotExistBinding"
c.Spec.Type = "bindings.testNotExistBinding"
err := r.initBinding(c)
assert.Error(t, err)
})
}
func TestBindingTracingHttp(t *testing.T) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册