MCPcopy
hub / github.com/containerd/containerd / TestNriPluginSynchronization

Function TestNriPluginSynchronization

integration/nri_test.go:102–146  ·  view source on GitHub ↗

Test NRI runtime/plugin state synchronization.

(t *testing.T)

Source from the content-addressed store, hash-verified

100
101// Test NRI runtime/plugin state synchronization.
102func TestNriPluginSynchronization(t *testing.T) {
103 skipNriTestIfNecessary(t)
104
105 t.Log("Test that NRI plugins get properly synchronized with the runtime state.")
106
107 var (
108 tc = &nriTest{
109 t: t,
110 }
111 podCount = 3
112 ctrPerPod = 2
113 )
114
115 tc.setup()
116
117 for i := range podCount {
118 podID := tc.runPod(fmt.Sprintf("pod%d", i))
119 for j := range ctrPerPod {
120 tc.startContainer(podID, fmt.Sprintf("ctr%d", j))
121 }
122 }
123
124 for _, plugin := range []*mockPlugin{{}, {}, {}} {
125 tc.connectNewPlugin(plugin)
126 }
127
128 for _, plugin := range tc.plugins {
129 err := plugin.Wait(PluginSynchronized, time.After(pluginSyncTimeout))
130 require.NoError(t, err, "plugin sync wait")
131 }
132
133 for _, id := range tc.pods {
134 for _, plugin := range tc.plugins {
135 _, ok := plugin.pods[id]
136 require.True(tc.t, ok, "runtime sync of pod "+id)
137 }
138 }
139
140 for _, id := range tc.ctrs {
141 for _, plugin := range tc.plugins {
142 _, ok := plugin.ctrs[id]
143 require.True(t, ok, "runtime sync of container "+id)
144 }
145 }
146}
147
148// Test mount injection into containers by NRI plugins.
149func TestNriMountInjection(t *testing.T) {

Callers

nothing calls this directly

Calls 7

skipNriTestIfNecessaryFunction · 0.85
LogMethod · 0.80
setupMethod · 0.80
runPodMethod · 0.80
startContainerMethod · 0.80
connectNewPluginMethod · 0.80
WaitMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…