Allow to tap multiple function services at one time (#1434)
The router taps function service one by one which is inefficient and increases the burden of executor. This PR aggregates all requests into one to solve the problem mentioned above.
This commit is contained in:
@@ -32,12 +32,12 @@ import (
|
||||
|
||||
func TestRouter(t *testing.T) {
|
||||
// metadata for a fake function
|
||||
fn := &metav1.ObjectMeta{Name: "foo", Namespace: metav1.NamespaceDefault}
|
||||
fnMeta := metav1.ObjectMeta{Name: "foo", Namespace: metav1.NamespaceDefault}
|
||||
|
||||
// and a reference to it
|
||||
fr := fv1.FunctionReference{
|
||||
Type: types.FunctionReferenceTypeFunctionName,
|
||||
Name: fn.Name,
|
||||
Name: fnMeta.Name,
|
||||
}
|
||||
|
||||
// start a fake service
|
||||
@@ -49,7 +49,7 @@ func TestRouter(t *testing.T) {
|
||||
|
||||
// set up the cache with this fake service
|
||||
fmap := makeFunctionServiceMap(logger, 0)
|
||||
fmap.assign(fn, testServiceUrl)
|
||||
fmap.assign(&fnMeta, testServiceUrl)
|
||||
|
||||
// HTTP trigger set with a trigger for this function
|
||||
triggers, _, _ := makeHTTPTriggerSet(logger, fmap, nil, nil, nil, nil,
|
||||
@@ -81,12 +81,14 @@ func TestRouter(t *testing.T) {
|
||||
triggerResourceVersion: "1234",
|
||||
}
|
||||
|
||||
fnMetaMap := make(map[string]*metav1.ObjectMeta, 1)
|
||||
fnMetaMap[fn.Name] = fn
|
||||
fnMetaMap := make(map[string]*fv1.Function, 1)
|
||||
fnMetaMap[fnMeta.Name] = &fv1.Function{
|
||||
Metadata: fnMeta,
|
||||
}
|
||||
|
||||
rr := resolveResult{
|
||||
resolveResultType: resolveResultSingleFunction,
|
||||
functionMetadataMap: fnMetaMap,
|
||||
resolveResultType: resolveResultSingleFunction,
|
||||
functionMap: fnMetaMap,
|
||||
}
|
||||
frr.refCache.Set(nfr, rr)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user