Skip to content
Open
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
- '**.md'
workflow_dispatch:
env:
GO_VERSION: '1.23.8'
GO_VERSION: '1.24.6'
GOLANGCI_LINT_VERSION: '1.64.8'
jobs:
git-secrets:
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
strategy:
matrix:
containerd: ["1.7.27", "2.1.3"]
nerdctl: ["2.1.2", "2.1.3"]
nerdctl: ["2.1.5", "2.1.6"]
fail-fast: false
timeout-minutes: 10
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/finch-vm-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
- '**.md'
workflow_dispatch:
env:
GO_VERSION: '1.24.x'
GO_VERSION: '1.24.6'
jobs:
mac-test-e2e:
runs-on: codebuild-finch-daemon-arm64-2-instance-${{ github.run_id }}-${{ github.run_attempt }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-automation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
workflow_dispatch:
workflow_call:
env:
GO_VERSION: '1.23.8'
GO_VERSION: '1.24.6'
permissions:
contents: write
deployments: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/samcli-direct.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
workflow_dispatch:

env:
GO_VERSION: '1.24.x'
GO_VERSION: '1.24.6'
CONTAINERD_VERSION: '2.0.x'

permissions:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/samcli-vm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
workflow_dispatch:

env:
GO_VERSION: '1.24.x'
GO_VERSION: '1.24.6'
PYTHON_VERSION: '3.11'
PYTHON_BINARY: 'python3.11'
AWS_DEFAULT_REGION: "${{ secrets.REGION }}"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

GINKGO = go run github.com/onsi/ginkgo/v2/ginkgo
# Common ginkgo options: -v for verbose mode, --focus="test name" for running single tests
GFLAGS ?= --race --randomize-all --randomize-suites
GFLAGS ?= -v --race --randomize-all --randomize-suites
BIN = $(PWD)/bin
FINCH_DAEMON_PROJECT_ROOT ?= $(shell pwd)

Expand Down
123 changes: 23 additions & 100 deletions e2e/tests/container_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"github.com/moby/moby/api/types/blkiodev"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/opencontainers/runtime-spec/specs-go"
"github.com/runfinch/common-tests/command"
"github.com/runfinch/common-tests/ffs"
"github.com/runfinch/common-tests/option"
Expand Down Expand Up @@ -842,20 +841,21 @@ func ContainerCreate(opt *option.Option, pOpt util.NewOpt) {
}

// Create dummy device paths
dummyDev1 := "/dev/dummy-zero1"
dummyDev2 := "/dev/dummy-zero2"

// Create dummy devices (major number 1 for char devices)
mknodOpt1, _ := pOpt([]string{"mknod", dummyDev1, "c", "1", "5"})
command.Run(mknodOpt1)
mknodOpt2, _ := pOpt([]string{"mknod", dummyDev2, "c", "1", "6"})
command.Run(mknodOpt2)

// Cleanup dummy devices after test
tmpFileOpt, _ := pOpt([]string{"touch", "/tmp/loopdev"})
command.Run(tmpFileOpt)
defer func() {
rmOpt, _ := pOpt([]string{"rm", "-f", dummyDev1, dummyDev2})
rmOpt, _ := pOpt([]string{"rm", "-f", "/tmp/loopdev"})
command.Run(rmOpt)
}()
ddOpt, _ := pOpt([]string{"dd", "if=/dev/zero", "of=/tmp/loopdev", "bs=4096", "count=1"})
command.Run(ddOpt)
loopDevOpt, _ := pOpt([]string{"losetup", "-f", "--show", "/tmp/loopdev"})
loopDev := command.StdoutStr(loopDevOpt)
Expect(loopDev).ShouldNot(BeEmpty())
defer func() {
detachOpt, _ := pOpt([]string{"losetup", "-d", loopDev})
command.Run(detachOpt)
}()

// define options
options.Cmd = []string{"sleep", "Infinity"}
Expand All @@ -864,40 +864,36 @@ func ContainerCreate(opt *option.Option, pOpt util.NewOpt) {
// Create WeightDevice objects for input
weightDevices := []*blkiodev.WeightDevice{
{
Path: dummyDev1,
Path: loopDev,
Weight: 400,
},
{
Path: dummyDev2,
Weight: 300,
},
}

// Create ThrottleDevice objects for input
readBpsDevices := []*blkiodev.ThrottleDevice{
{
Path: dummyDev1,
Path: loopDev,
Rate: 1048576, // 1MB/s
},
}

writeBpsDevices := []*blkiodev.ThrottleDevice{
{
Path: dummyDev1,
Path: loopDev,
Rate: 2097152, // 2MB/s
},
}

readIopsDevices := []*blkiodev.ThrottleDevice{
{
Path: dummyDev1,
Path: loopDev,
Rate: 1000,
},
}

writeIopsDevices := []*blkiodev.ThrottleDevice{
{
Path: dummyDev1,
Path: loopDev,
Rate: 2000,
},
}
Expand Down Expand Up @@ -925,88 +921,15 @@ func ContainerCreate(opt *option.Option, pOpt util.NewOpt) {
Expect(inspect).Should(HaveLen(1))

// Verify blkio settings in LinuxBlkioSettings
blkioSettings := inspect[0].HostConfig.LinuxBlkioSettings
blkioSettings := inspect[0].HostConfig.BlkioSettings
// Verify BlkioWeight
Expect(blkioSettings.BlkioWeight).Should(Equal(options.HostConfig.BlkioWeight))

// Helper function to map major/minor to device path
devicePathFromMajorMinor := func(major, minor int64) string {
if major == 1 && minor == 5 {
return dummyDev1
}
if major == 1 && minor == 6 {
return dummyDev2
}
return fmt.Sprintf("/dev/unknown-%d-%d", major, minor)
}

// Helper function to convert specs.LinuxWeightDevice to blkiodev.WeightDevice
convertWeightDevice := func(wd *specs.LinuxWeightDevice) *blkiodev.WeightDevice {
if wd == nil || wd.Weight == nil {
return nil
}
return &blkiodev.WeightDevice{
Path: devicePathFromMajorMinor(wd.Major, wd.Minor),
Weight: *wd.Weight,
}
}

// Helper function to convert specs.LinuxThrottleDevice to blkiodev.ThrottleDevice
convertThrottleDevice := func(td *specs.LinuxThrottleDevice) *blkiodev.ThrottleDevice {
if td == nil {
return nil
}
return &blkiodev.ThrottleDevice{
Path: devicePathFromMajorMinor(td.Major, td.Minor),
Rate: td.Rate,
}
}

// Convert response devices to blkiodev types
responseWeightDevices := make([]*blkiodev.WeightDevice, 0, len(blkioSettings.BlkioWeightDevice))
for _, d := range blkioSettings.BlkioWeightDevice {
if converted := convertWeightDevice(d); converted != nil {
responseWeightDevices = append(responseWeightDevices, converted)
}
}

responseReadBpsDevices := make([]*blkiodev.ThrottleDevice, 0, len(blkioSettings.BlkioDeviceReadBps))
for _, d := range blkioSettings.BlkioDeviceReadBps {
if converted := convertThrottleDevice(d); converted != nil {
responseReadBpsDevices = append(responseReadBpsDevices, converted)
}
}

responseWriteBpsDevices := make([]*blkiodev.ThrottleDevice, 0, len(blkioSettings.BlkioDeviceWriteBps))
for _, d := range blkioSettings.BlkioDeviceWriteBps {
if converted := convertThrottleDevice(d); converted != nil {
responseWriteBpsDevices = append(responseWriteBpsDevices, converted)
}
}

responseReadIopsDevices := make([]*blkiodev.ThrottleDevice, 0, len(blkioSettings.BlkioDeviceReadIOps))
for _, d := range blkioSettings.BlkioDeviceReadIOps {
if converted := convertThrottleDevice(d); converted != nil {
responseReadIopsDevices = append(responseReadIopsDevices, converted)
}
}

responseWriteIopsDevices := make([]*blkiodev.ThrottleDevice, 0, len(blkioSettings.BlkioDeviceWriteIOps))
for _, d := range blkioSettings.BlkioDeviceWriteIOps {
if converted := convertThrottleDevice(d); converted != nil {
responseWriteIopsDevices = append(responseWriteIopsDevices, converted)
}
}

// Compare string representations
for i, wd := range weightDevices {
Expect(responseWeightDevices[i].String()).Should(Equal(wd.String()))
}

Expect(responseReadBpsDevices[0].String()).Should(Equal(readBpsDevices[0].String()))
Expect(responseWriteBpsDevices[0].String()).Should(Equal(writeBpsDevices[0].String()))
Expect(responseReadIopsDevices[0].String()).Should(Equal(readIopsDevices[0].String()))
Expect(responseWriteIopsDevices[0].String()).Should(Equal(writeIopsDevices[0].String()))
Expect(blkioSettings.BlkioWeightDevice[0].String()).Should(Equal(weightDevices[0].String()))
Expect(blkioSettings.BlkioDeviceReadBps[0].String()).Should(Equal(readBpsDevices[0].String()))
Expect(blkioSettings.BlkioDeviceWriteBps[0].String()).Should(Equal(writeBpsDevices[0].String()))
Expect(blkioSettings.BlkioDeviceReadIOps[0].String()).Should(Equal(readIopsDevices[0].String()))
Expect(blkioSettings.BlkioDeviceWriteIOps[0].String()).Should(Equal(writeIopsDevices[0].String()))
})

It("should create container with volumes from another container", func() {
Expand Down
47 changes: 24 additions & 23 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/runfinch/finch-daemon

go 1.23.8
go 1.24.6

require (
github.com/containerd/cgroups/v3 v3.0.5
Expand All @@ -10,16 +10,16 @@ require (
github.com/containerd/fifo v1.1.0
github.com/containerd/go-cni v1.1.13
github.com/containerd/log v0.1.0
github.com/containerd/nerdctl/v2 v2.1.3
github.com/containerd/nerdctl/v2 v2.1.6
github.com/containerd/platforms v1.0.0-rc.1
github.com/containerd/typeurl/v2 v2.2.3
github.com/containernetworking/cni v1.3.0
github.com/coreos/go-iptables v0.8.0
github.com/coreos/go-systemd/v22 v22.5.0
github.com/coreos/go-systemd/v22 v22.6.0
github.com/distribution/reference v0.6.0
github.com/docker/cli v28.3.3+incompatible
github.com/docker/docker v28.3.3+incompatible
github.com/docker/go-connections v0.5.0
github.com/docker/cli v28.4.0+incompatible
github.com/docker/docker v28.4.0+incompatible
github.com/docker/go-connections v0.6.0
github.com/docker/go-units v0.5.0
github.com/getlantern/httptest v0.0.0-20161025015934-4b40f4c7e590
github.com/gofrs/flock v0.12.1
Expand All @@ -29,7 +29,7 @@ require (
github.com/moby/moby v28.3.3+incompatible
github.com/moby/sys/user v0.4.0
github.com/onsi/ginkgo/v2 v2.25.1
github.com/onsi/gomega v1.37.0
github.com/onsi/gomega v1.38.1
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/image-spec v1.1.1
github.com/opencontainers/runtime-spec v1.2.1
Expand All @@ -39,13 +39,13 @@ require (
github.com/shirou/gopsutil/v3 v3.24.5
github.com/sirupsen/logrus v1.9.3
github.com/spf13/afero v1.14.0
github.com/spf13/cobra v1.9.1
github.com/spf13/cobra v1.10.1
github.com/stretchr/testify v1.10.0
github.com/vishvananda/netlink v1.3.1
github.com/vishvananda/netns v0.0.5
go.uber.org/mock v0.5.2
golang.org/x/net v0.43.0
golang.org/x/sys v0.35.0
go.uber.org/mock v0.6.0
golang.org/x/net v0.44.0
golang.org/x/sys v0.36.0
google.golang.org/protobuf v1.36.8
)

Expand Down Expand Up @@ -79,6 +79,7 @@ require (
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/otel/sdk v1.37.0 // indirect
go.yaml.in/yaml/v2 v2.4.2 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
sigs.k8s.io/yaml v1.6.0 // indirect
)

Expand All @@ -94,21 +95,21 @@ require (
github.com/containerd/errdefs/pkg v0.3.0 // indirect
github.com/containerd/go-runc v1.1.0 // indirect
github.com/containerd/imgcrypt/v2 v2.0.1 // indirect
github.com/containerd/nydus-snapshotter v0.15.2 // indirect
github.com/containerd/nydus-snapshotter v0.15.4 // indirect
github.com/containerd/plugin v1.0.0 // indirect
github.com/containerd/stargz-snapshotter v0.16.3 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.16.3 // indirect
github.com/containerd/stargz-snapshotter/ipfs v0.16.3 // indirect
github.com/containerd/stargz-snapshotter v0.17.0 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.17.0 // indirect
github.com/containerd/stargz-snapshotter/ipfs v0.17.0 // indirect
github.com/containerd/ttrpc v1.2.7 // indirect
github.com/containernetworking/plugins v1.7.1 // indirect
github.com/containernetworking/plugins v1.8.0 // indirect
github.com/containers/ocicrypt v1.2.1 // indirect
github.com/cyphar/filepath-securejoin v0.4.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/djherbis/times v1.6.0 // indirect
github.com/docker/docker-credential-helpers v0.9.3
github.com/fahedouch/go-logrotate v0.3.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fluent/fluent-logger-golang v1.10.0 // indirect
github.com/fluent/fluent-logger-golang v1.10.1 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/getlantern/mockconn v0.0.0-20200818071412-cb30d065a848 // indirect
github.com/go-jose/go-jose/v4 v4.1.1 // indirect
Expand All @@ -121,7 +122,7 @@ require (
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/pprof v0.0.0-20250630185457-6e76a2b096b5 // indirect
github.com/google/pprof v0.0.0-20250820193118-f64d9cf942d6 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/ipfs/go-cid v0.5.0 // indirect
github.com/klauspost/compress v1.18.0 // indirect
Expand Down Expand Up @@ -160,7 +161,7 @@ require (
github.com/sasha-s/go-deadlock v0.3.5 // indirect
github.com/smallstep/pkcs7 v0.2.1 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/pflag v1.0.7 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/stefanberger/go-pkcs11uri v0.0.0-20230803200340-78284954bff6 // indirect
github.com/tinylib/msgp v1.3.0 // indirect
github.com/vbatts/tar-split v0.12.1 // indirect
Expand All @@ -171,12 +172,12 @@ require (
go.opentelemetry.io/otel/metric v1.37.0 // indirect
go.opentelemetry.io/otel/trace v1.37.0 // indirect
go.uber.org/automaxprocs v1.6.0 // indirect
golang.org/x/crypto v0.41.0 // indirect
golang.org/x/crypto v0.42.0 // indirect
golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b // indirect
golang.org/x/mod v0.27.0 // indirect
golang.org/x/sync v0.16.0 // indirect
golang.org/x/term v0.34.0 // indirect
golang.org/x/text v0.28.0 // indirect
golang.org/x/sync v0.17.0 // indirect
golang.org/x/term v0.35.0 // indirect
golang.org/x/text v0.29.0 // indirect
golang.org/x/time v0.12.0 // indirect
golang.org/x/tools v0.36.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250707201910-8d1bb00bc6a7 // indirect
Expand Down
Loading
Loading