(t *testing.T, reexec bool)
| 1189 | } |
| 1190 | |
| 1191 | func externalKeyTest(t *testing.T, reexec bool) { |
| 1192 | defer netnsutils.SetupTestOSContext(t)() |
| 1193 | controller := newController(t) |
| 1194 | |
| 1195 | n, err := createTestNetwork(controller, bridgeNetType, "testnetwork", options.Generic{ |
| 1196 | netlabel.EnableIPv4: true, |
| 1197 | netlabel.GenericData: map[string]string{ |
| 1198 | bridge.BridgeName: "testnetwork", |
| 1199 | }, |
| 1200 | }, nil, nil) |
| 1201 | assert.NilError(t, err) |
| 1202 | defer func() { |
| 1203 | assert.Check(t, n.Delete()) |
| 1204 | }() |
| 1205 | |
| 1206 | n2, err := createTestNetwork(controller, bridgeNetType, "testnetwork2", options.Generic{ |
| 1207 | netlabel.EnableIPv4: true, |
| 1208 | netlabel.GenericData: map[string]string{ |
| 1209 | bridge.BridgeName: "testnetwork2", |
| 1210 | }, |
| 1211 | }, nil, nil) |
| 1212 | assert.NilError(t, err) |
| 1213 | defer func() { |
| 1214 | assert.Check(t, n2.Delete()) |
| 1215 | }() |
| 1216 | |
| 1217 | ep, err := n.CreateEndpoint(context.Background(), "ep1") |
| 1218 | assert.NilError(t, err) |
| 1219 | defer func() { |
| 1220 | assert.Check(t, ep.Delete(context.Background(), false)) |
| 1221 | }() |
| 1222 | |
| 1223 | ep2, err := n2.CreateEndpoint(context.Background(), "ep2") |
| 1224 | assert.NilError(t, err) |
| 1225 | defer func() { |
| 1226 | assert.Check(t, ep2.Delete(context.Background(), false)) |
| 1227 | }() |
| 1228 | |
| 1229 | cnt, err := controller.NewSandbox(context.Background(), containerID, |
| 1230 | libnetwork.OptionHostname("test"), |
| 1231 | libnetwork.OptionDomainname("example.com"), |
| 1232 | libnetwork.OptionUseExternalKey(), |
| 1233 | libnetwork.OptionExtraHost("web", netip.MustParseAddr("192.168.0.1"))) |
| 1234 | assert.NilError(t, err) |
| 1235 | defer func() { |
| 1236 | assert.Check(t, cnt.Delete(context.Background())) |
| 1237 | }() |
| 1238 | |
| 1239 | // Join endpoint to sandbox before SetKey |
| 1240 | err = ep.Join(context.Background(), cnt) |
| 1241 | assert.NilError(t, err) |
| 1242 | defer func() { |
| 1243 | assert.Check(t, ep.Leave(context.Background(), cnt)) |
| 1244 | }() |
| 1245 | |
| 1246 | sbox := ep.Info().Sandbox() |
| 1247 | assert.Assert(t, sbox != nil, "Expected to have a valid Sandbox") |
| 1248 |
no test coverage detected
searching dependent graphs…