Test NRI runtime/plugin state synchronization.
(t *testing.T)
| 100 | |
| 101 | // Test NRI runtime/plugin state synchronization. |
| 102 | func 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. |
| 149 | func TestNriMountInjection(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…