MCPcopy
hub / github.com/containerd/containerd / setup

Method setup

integration/nri_test.go:682–712  ·  view source on GitHub ↗

setup prepares the test environment, connects all NRI plugins.

()

Source from the content-addressed store, hash-verified

680
681// setup prepares the test environment, connects all NRI plugins.
682func (tc *nriTest) setup() {
683 if tc.name == "" {
684 tc.name = tc.t.Name()
685 }
686 if tc.prefix == "" {
687 tc.prefix = strings.ToLower(tc.name)
688 }
689 if tc.namespace == "" {
690 tc.namespace = tc.prefix + "-" + strconv.Itoa(os.Getpid())
691 }
692
693 tc.sbCfg = make(map[string]*runtime.PodSandboxConfig)
694 tc.runtime = runtimeService
695
696 for idx, p := range tc.plugins {
697 p.namespace = tc.namespace
698
699 if p.logf == nil {
700 p.logf = tc.t.Logf
701 }
702 if p.idx == "" {
703 p.idx = fmt.Sprintf("%02d", idx)
704 }
705
706 err := p.Start()
707 require.NoError(tc.t, err, "start plugin")
708
709 err = p.Wait(PluginSynchronized, time.After(pluginSyncTimeout))
710 require.NoError(tc.t, err, "wait for plugin setup")
711 }
712}
713
714// Connect a new NRI plugin to the runtime.
715func (tc *nriTest) connectNewPlugin(p *mockPlugin) {

Calls 3

NameMethod · 0.65
StartMethod · 0.65
WaitMethod · 0.65

Tested by

no test coverage detected