@@ -35,6 +35,7 @@ import (
3535 "github.com/hyperledger/firefly-common/pkg/httpserver"
3636 "github.com/hyperledger/firefly-common/pkg/i18n"
3737 "github.com/hyperledger/firefly/internal/coreconfig"
38+ "github.com/hyperledger/firefly/internal/coremsgs"
3839 "github.com/hyperledger/firefly/internal/metrics"
3940 "github.com/hyperledger/firefly/mocks/apiservermocks"
4041 "github.com/hyperledger/firefly/mocks/contractmocks"
@@ -56,6 +57,9 @@ func newTestServer() (*namespacemocks.Manager, *orchestratormocks.Orchestrator,
5657 mgr .On ("Orchestrator" , "default" ).Return (o ).Maybe ()
5758 mgr .On ("Orchestrator" , "mynamespace" ).Return (o ).Maybe ()
5859 mgr .On ("Orchestrator" , "ns1" ).Return (o ).Maybe ()
60+ mgr .On ("Orchestrator" , mock .Anything , "default" ).Return (o , nil ).Maybe ()
61+ mgr .On ("Orchestrator" , mock .Anything , "mynamespace" ).Return (o , nil ).Maybe ()
62+ mgr .On ("Orchestrator" , mock .Anything , "ns1" ).Return (o , nil ).Maybe ()
5963 as := & apiServer {
6064 apiTimeout : 5 * time .Second ,
6165 maxFilterLimit : 100 ,
@@ -369,7 +373,7 @@ func TestContractAPISwaggerJSONBadNamespace(t *testing.T) {
369373 s := httptest .NewServer (r )
370374 defer s .Close ()
371375
372- mgr .On ("Orchestrator" , "BAD" ).Return (nil )
376+ mgr .On ("Orchestrator" , mock . Anything , "BAD" ).Return (nil , i18n . NewError ( context . Background (), coremsgs . MsgUnknownNamespace ) )
373377
374378 res , err := http .Get (fmt .Sprintf ("http://%s/api/v1/namespaces/BAD/apis/my-api/api/swagger.json" , s .Listener .Addr ()))
375379 assert .NoError (t , err )
@@ -395,7 +399,7 @@ func TestJSONBadNamespace(t *testing.T) {
395399 s := httptest .NewServer (r )
396400 defer s .Close ()
397401
398- mgr .On ("Orchestrator" , "BAD" ).Return (nil )
402+ mgr .On ("Orchestrator" , mock . Anything , "BAD" ).Return (nil , i18n . NewError ( context . Background (), coremsgs . MsgUnknownNamespace ) )
399403
400404 var b bytes.Buffer
401405 req := httptest .NewRequest ("GET" , "/api/v1/namespaces/BAD/apis" , & b )
@@ -413,7 +417,7 @@ func TestFormDataBadNamespace(t *testing.T) {
413417 s := httptest .NewServer (r )
414418 defer s .Close ()
415419
416- mgr .On ("Orchestrator" , "BAD" ).Return (nil )
420+ mgr .On ("Orchestrator" , mock . Anything , "BAD" ).Return (nil , i18n . NewError ( context . Background (), coremsgs . MsgUnknownNamespace ) )
417421
418422 var b bytes.Buffer
419423 w := multipart .NewWriter (& b )
@@ -471,3 +475,8 @@ func TestFormDataDisabledRoute(t *testing.T) {
471475
472476 assert .Equal (t , 400 , res .Result ().StatusCode )
473477}
478+
479+ func TestGetOrchestratorMissingTag (t * testing.T ) {
480+ _ , err := getOrchestrator (context .Background (), & namespacemocks.Manager {}, "" , nil )
481+ assert .Regexp (t , "FF10436" , err )
482+ }
0 commit comments