Skip to content

Only use runtime config w/ default network ifaces in one test. #290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions runtime/cni_integ_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ func TestCNISupport_Isolated(t *testing.T) {

func TestAutomaticCNISupport_Isolated(t *testing.T) {
internal.RequiresIsolation(t)
useDefaultNetworkInterfaceRuntimeConfig(t)

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

func useDefaultNetworkInterfaceRuntimeConfig(t *testing.T) {
t.Helper()

err := os.RemoveAll(runtimeConfigPath)
require.NoError(t, err, "failed to remove existing firecracker containerd runtime config file")

err = os.Symlink(defaultNetworkInterfaceRuntimeConfigPath, runtimeConfigPath)
require.NoError(t, err, "failed to symlink default network interface runtime config")
}

func runCommand(ctx context.Context, t *testing.T, name string, args ...string) {
t.Helper()
output, err := exec.CommandContext(ctx, name, args...).CombinedOutput()
Expand Down
3 changes: 3 additions & 0 deletions runtime/service_integ_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ const (
defaultVMRootfsPath = "/var/lib/firecracker-containerd/runtime/default-rootfs.img"
defaultVMNetDevName = "eth0"
varRunDir = "/run/firecracker-containerd"

runtimeConfigPath = "/etc/containerd/firecracker-runtime.json"
defaultNetworkInterfaceRuntimeConfigPath = "/etc/containerd/firecracker-runtime-defaultnetwork.json"
)

// Images are presumed by the isolated tests to have already been pulled
Expand Down
1 change: 1 addition & 0 deletions tools/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ RUN make -C /firecracker-containerd/internal test-bridged-tap && \
chmod a+x /firecracker-containerd/internal/test-bridged-tap

COPY tools/docker/firecracker-runtime.json /etc/containerd/firecracker-runtime.json
COPY tools/docker/firecracker-runtime-defaultnetwork.json /etc/containerd/firecracker-runtime-defaultnetwork.json
COPY tools/docker/naive-snapshotter/entrypoint.sh /entrypoint

ENTRYPOINT ["/entrypoint"]
Expand Down
19 changes: 19 additions & 0 deletions tools/docker/firecracker-runtime-defaultnetwork.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"firecracker_binary_path": "/usr/local/bin/firecracker",
"kernel_image_path": "/var/lib/firecracker-containerd/runtime/default-vmlinux.bin",
"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",
"root_drive": "/var/lib/firecracker-containerd/runtime/default-rootfs.img",
"cpu_count": 1,
"cpu_template": "T2",
"log_fifo": "/tmp/fc-logs.fifo",
"log_level": "Debug",
"metrics_fifo": "/tmp/fc-metrics.fifo",
"default_network_interfaces": [
{
"CNIConfig": {
"NetworkName": "fcnet",
"InterfaceName": "veth0"
}
}
]
}
10 changes: 1 addition & 9 deletions tools/docker/firecracker-runtime.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,5 @@
"cpu_template": "T2",
"log_fifo": "/tmp/fc-logs.fifo",
"log_level": "Debug",
"metrics_fifo": "/tmp/fc-metrics.fifo",
"default_network_interfaces": [
{
"CNIConfig": {
"NetworkName": "fcnet",
"InterfaceName": "veth0"
}
}
]
"metrics_fifo": "/tmp/fc-metrics.fifo"
}