Skip to content

Commit e30ccec

Browse files
authored
Merge pull request #290 from sipsma/nonetiface
Only use runtime config w/ default network ifaces in one test.
2 parents 6f2d561 + 8668dbc commit e30ccec

File tree

5 files changed

+35
-9
lines changed

5 files changed

+35
-9
lines changed

runtime/cni_integ_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ func TestCNISupport_Isolated(t *testing.T) {
135135

136136
func TestAutomaticCNISupport_Isolated(t *testing.T) {
137137
internal.RequiresIsolation(t)
138+
useDefaultNetworkInterfaceRuntimeConfig(t)
138139

139140
testTimeout := 120 * time.Second
140141
ctx, cancel := context.WithTimeout(namespaces.WithNamespace(context.Background(), defaultNamespace), testTimeout)
@@ -355,6 +356,16 @@ func writeCNIConf(path, chainedPluginName, networkName, nameserver string) error
355356
}`, networkName, nameserver, chainedPluginName)), 0644)
356357
}
357358

359+
func useDefaultNetworkInterfaceRuntimeConfig(t *testing.T) {
360+
t.Helper()
361+
362+
err := os.RemoveAll(runtimeConfigPath)
363+
require.NoError(t, err, "failed to remove existing firecracker containerd runtime config file")
364+
365+
err = os.Symlink(defaultNetworkInterfaceRuntimeConfigPath, runtimeConfigPath)
366+
require.NoError(t, err, "failed to symlink default network interface runtime config")
367+
}
368+
358369
func runCommand(ctx context.Context, t *testing.T, name string, args ...string) {
359370
t.Helper()
360371
output, err := exec.CommandContext(ctx, name, args...).CombinedOutput()

runtime/service_integ_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ const (
6363
defaultVMRootfsPath = "/var/lib/firecracker-containerd/runtime/default-rootfs.img"
6464
defaultVMNetDevName = "eth0"
6565
varRunDir = "/run/firecracker-containerd"
66+
67+
runtimeConfigPath = "/etc/containerd/firecracker-runtime.json"
68+
defaultNetworkInterfaceRuntimeConfigPath = "/etc/containerd/firecracker-runtime-defaultnetwork.json"
6669
)
6770

6871
// Images are presumed by the isolated tests to have already been pulled

tools/docker/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ RUN make -C /firecracker-containerd/internal test-bridged-tap && \
165165
chmod a+x /firecracker-containerd/internal/test-bridged-tap
166166

167167
COPY tools/docker/firecracker-runtime.json /etc/containerd/firecracker-runtime.json
168+
COPY tools/docker/firecracker-runtime-defaultnetwork.json /etc/containerd/firecracker-runtime-defaultnetwork.json
168169
COPY tools/docker/naive-snapshotter/entrypoint.sh /entrypoint
169170

170171
ENTRYPOINT ["/entrypoint"]
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"firecracker_binary_path": "/usr/local/bin/firecracker",
3+
"kernel_image_path": "/var/lib/firecracker-containerd/runtime/default-vmlinux.bin",
4+
"kernel_args": "ro console=ttyS0 noapic reboot=k panic=1 pci=off nomodules systemd.journald.forward_to_console systemd.unit=firecracker.target init=/sbin/overlay-init",
5+
"root_drive": "/var/lib/firecracker-containerd/runtime/default-rootfs.img",
6+
"cpu_count": 1,
7+
"cpu_template": "T2",
8+
"log_fifo": "/tmp/fc-logs.fifo",
9+
"log_level": "Debug",
10+
"metrics_fifo": "/tmp/fc-metrics.fifo",
11+
"default_network_interfaces": [
12+
{
13+
"CNIConfig": {
14+
"NetworkName": "fcnet",
15+
"InterfaceName": "veth0"
16+
}
17+
}
18+
]
19+
}

tools/docker/firecracker-runtime.json

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,5 @@
77
"cpu_template": "T2",
88
"log_fifo": "/tmp/fc-logs.fifo",
99
"log_level": "Debug",
10-
"metrics_fifo": "/tmp/fc-metrics.fifo",
11-
"default_network_interfaces": [
12-
{
13-
"CNIConfig": {
14-
"NetworkName": "fcnet",
15-
"InterfaceName": "veth0"
16-
}
17-
}
18-
]
10+
"metrics_fifo": "/tmp/fc-metrics.fifo"
1911
}

0 commit comments

Comments
 (0)