@@ -431,6 +431,30 @@ func TestGetNetworkContainerByOrchestratorContext(t *testing.T) {
431431 t .Fatal (err )
432432 }
433433
434+ mnma := & fakes.NMAgentClientFake {
435+ PutNetworkContainerF : func (_ context.Context , _ * nmagent.PutNetworkContainerRequest ) error {
436+ return nil
437+ },
438+ JoinNetworkF : func (_ context.Context , _ nmagent.JoinNetworkRequest ) error {
439+ return nil
440+ },
441+ }
442+
443+ cleanup := setMockNMAgent (svc , mnma )
444+ defer cleanup ()
445+
446+ mnma .GetNCVersionListF = func (_ context.Context ) (nmagent.NCVersionList , error ) {
447+ return nmagent.NCVersionList {
448+ Containers : []nmagent.NCVersion {
449+ {
450+ // Must set it as params.ncID without cns.SwiftPrefix to mock real nmagent nc format.
451+ NetworkContainerID : params .ncID ,
452+ Version : params .ncVersion ,
453+ },
454+ },
455+ }, nil
456+ }
457+
434458 fmt .Println ("Now calling getNetworkContainerByContext" )
435459 resp , err := getNetworkContainerByContext (params )
436460 if err != nil {
@@ -554,7 +578,8 @@ func TestGetNetworkContainerVersionStatus(t *testing.T) {
554578 return nmagent.NCVersionList {
555579 Containers : []nmagent.NCVersion {
556580 {
557- NetworkContainerID : cns .SwiftPrefix + params .ncID ,
581+ // Must set it as params.ncID without cns.SwiftPrefix to mock real nmagent nc format.
582+ NetworkContainerID : params .ncID ,
558583 Version : params .ncVersion ,
559584 },
560585 },
@@ -596,7 +621,8 @@ func TestGetNetworkContainerVersionStatus(t *testing.T) {
596621 return nmagent.NCVersionList {
597622 Containers : []nmagent.NCVersion {
598623 {
599- NetworkContainerID : cns .SwiftPrefix + params .ncID ,
624+ // Must set it as params.ncID without cns.SwiftPrefix to mock real nmagent nc format.
625+ NetworkContainerID : params .ncID ,
600626 Version : "0" ,
601627 },
602628 },
0 commit comments