Skip to content

Commit bcc1d81

Browse files
committed
chore: test shared inmem watch buffer
A testbed for the cosi-project/runtime#674 Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
1 parent 969098c commit bcc1d81

54 files changed

Lines changed: 85 additions & 145 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ replace (
2222
golang.zx2c4.com/wireguard/wgctrl => github.com/siderolabs/wgctrl-go v0.0.0-20251029173431-c4fd5f6a4e72
2323
)
2424

25+
replace github.com/cosi-project/runtime => github.com/smira/os-runtime v0.0.0-20260804181026-d9d407093e3d
26+
2527
// Kubernetes dependencies sharing the same version.
2628
require (
2729
k8s.io/api v0.37.0-beta.0
@@ -192,7 +194,7 @@ require (
192194
golang.org/x/text v0.40.0
193195
golang.org/x/time v0.15.0
194196
golang.zx2c4.com/wireguard/wgctrl v0.0.0-20241231184526-a9ab2273dd10
195-
google.golang.org/grpc v1.82.1
197+
google.golang.org/grpc v1.83.0
196198
google.golang.org/protobuf v1.36.12-0.20260120151049-f2248ac996af
197199
gopkg.in/typ.v4 v4.4.0
198200
k8s.io/klog/v2 v2.140.0

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,6 @@ github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr
194194
github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec=
195195
github.com/coreos/go-systemd/v22 v22.7.0 h1:LAEzFkke61DFROc7zNLX/WA2i5J8gYqe0rSj9KI28KA=
196196
github.com/coreos/go-systemd/v22 v22.7.0/go.mod h1:xNUYtjHu2EDXbsxz1i41wouACIwT7Ybq9o0BQhMwD0w=
197-
github.com/cosi-project/runtime v1.16.2 h1:sgjOMrnaElrja93kkJJJIQYwd45PhpGl9cBci9yqn5c=
198-
github.com/cosi-project/runtime v1.16.2/go.mod h1:+GrSnmJjMfWMe6NubevwwXQf/v7afddDLeCbLonvvps=
199197
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
200198
github.com/cpuguy83/go-md2man/v2 v2.0.7 h1:zbFlGlXEAKlwXpmvle3d8Oe3YnkKIK4xSRTd3sHPnBo=
201199
github.com/cpuguy83/go-md2man/v2 v2.0.7/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
@@ -882,6 +880,8 @@ github.com/sirupsen/logrus v1.9.4 h1:TsZE7l11zFCLZnZ+teH4Umoq5BhEIfIzfRDZ1Uzql2w
882880
github.com/sirupsen/logrus v1.9.4/go.mod h1:ftWc9WdOfJ0a92nsE2jF5u5ZwH8Bv2zdeOC42RjbV2g=
883881
github.com/smira/kobject v0.0.0-20240304111826-49c8d4613389 h1:f/5NRv5IGZxbjBhc5MnlbNmyuXBPxvekhBAUzyKWyLY=
884882
github.com/smira/kobject v0.0.0-20240304111826-49c8d4613389/go.mod h1:+SexPO1ZvdbbWUdUnyXEWv3+4NwHZjKhxOmQqHY4Pqc=
883+
github.com/smira/os-runtime v0.0.0-20260804181026-d9d407093e3d h1:eaVOGQ1RlW5YKVa/PCdmrcts7kUg+s3NYNSeMzHj40Y=
884+
github.com/smira/os-runtime v0.0.0-20260804181026-d9d407093e3d/go.mod h1:rHqlcEfmTZxBdpsXVmfww1Ji0MpmiD/mUWQ+NFaUUP0=
885885
github.com/smira/siv-go v0.0.0-20260706144621-2093d2730928 h1:jLGRk/3hqXLnAjFhChWXFLc+uUbKeyQIvCBciG/CsPs=
886886
github.com/smira/siv-go v0.0.0-20260706144621-2093d2730928/go.mod h1:aI+8yClBW+1uovkHw6HM01YXnYB8vohtB9C83wzx34E=
887887
github.com/soheilhy/cmux v0.1.5 h1:jjzc5WVemNEDTLwv9tlmemhC73tI08BNOIGwBOo10Js=
@@ -1338,8 +1338,8 @@ google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac
13381338
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
13391339
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
13401340
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
1341-
google.golang.org/grpc v1.82.1 h1:NnAxzGRA0677vCa4BUkOAnO5+FfQqVl9iUXeD0IqcGE=
1342-
google.golang.org/grpc v1.82.1/go.mod h1:yzTZ1TB1Z3SG+LIYaI+WiE8D5+PZ3ArnrSp8zF3+/ZA=
1341+
google.golang.org/grpc v1.83.0 h1:JeNZEKJFbQxArAMl+hiytHauacDNqJUllNfmIMmpqnQ=
1342+
google.golang.org/grpc v1.83.0/go.mod h1:kDyl6SKsiHKt0uylY5gtn5cEjkrIOhQOGDgIc4JGwzQ=
13431343
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
13441344
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
13451345
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=

internal/app/machined/pkg/automaton/blockautomaton/volume_mount_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"github.com/cosi-project/runtime/pkg/resource/rtestutils"
1616
"github.com/cosi-project/runtime/pkg/state"
1717
"github.com/cosi-project/runtime/pkg/state/impl/inmem"
18-
"github.com/cosi-project/runtime/pkg/state/impl/namespaced"
1918
"github.com/cosi-project/runtime/pkg/state/owned"
2019
"github.com/stretchr/testify/assert"
2120
"github.com/stretchr/testify/require"
@@ -31,7 +30,7 @@ func TestVolumeMounter(t *testing.T) {
3130
t.Parallel()
3231

3332
logger := zaptest.NewLogger(t)
34-
st := state.WrapCore(namespaced.NewState(inmem.Build))
33+
st := state.WrapCore(inmem.NewState())
3534
ctx, cancel := context.WithTimeout(t.Context(), 10*time.Second)
3635
t.Cleanup(cancel)
3736

@@ -126,7 +125,7 @@ func TestVolumeMounterReadWrite(t *testing.T) {
126125
t.Parallel()
127126

128127
logger := zaptest.NewLogger(t)
129-
st := state.WrapCore(namespaced.NewState(inmem.Build))
128+
st := state.WrapCore(inmem.NewState())
130129
ctx, cancel := context.WithTimeout(t.Context(), 10*time.Second)
131130
t.Cleanup(cancel)
132131

internal/app/machined/pkg/controllers/block/volume_config_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"github.com/cosi-project/runtime/pkg/resource"
1616
"github.com/cosi-project/runtime/pkg/state"
1717
"github.com/cosi-project/runtime/pkg/state/impl/inmem"
18-
"github.com/cosi-project/runtime/pkg/state/impl/namespaced"
1918
"github.com/siderolabs/gen/xslices"
2019
"github.com/stretchr/testify/assert"
2120
"github.com/stretchr/testify/suite"
@@ -65,7 +64,7 @@ func TestVolumeConfigSuite(t *testing.T) {
6564
suite.Require().NoError(f.Truncate(1024 * 1024))
6665
suite.Require().NoError(f.Close())
6766

68-
st := state.WrapCore(namespaced.NewState(inmem.Build))
67+
st := state.WrapCore(inmem.NewState())
6968

7069
m, err := intmeta.New(t.Context(), st, intmeta.WithFixedPath(path))
7170
suite.Require().NoError(err)

internal/app/machined/pkg/controllers/ctest/ctest.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"github.com/cosi-project/runtime/pkg/safe"
1818
"github.com/cosi-project/runtime/pkg/state"
1919
"github.com/cosi-project/runtime/pkg/state/impl/inmem"
20-
"github.com/cosi-project/runtime/pkg/state/impl/namespaced"
2120
"github.com/siderolabs/go-retry/retry"
2221
"github.com/stretchr/testify/assert"
2322
"github.com/stretchr/testify/require"
@@ -52,13 +51,7 @@ func (suite *DefaultSuite) SetupTest() {
5251

5352
suite.ctx, suite.ctxCancel = context.WithTimeout(context.Background(), suite.Timeout)
5453

55-
suite.state = state.WrapCore(namespaced.NewState(
56-
func(ns resource.Namespace) state.CoreState {
57-
return inmem.NewStateWithOptions(
58-
inmem.WithHistoryMaxCapacity(1000),
59-
)(ns)
60-
},
61-
))
54+
suite.state = state.WrapCore(inmem.NewState())
6255

6356
var err error
6457

internal/app/machined/pkg/controllers/runtime/drop_upgrade_fallback_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212

1313
"github.com/cosi-project/runtime/pkg/state"
1414
"github.com/cosi-project/runtime/pkg/state/impl/inmem"
15-
"github.com/cosi-project/runtime/pkg/state/impl/namespaced"
1615
"github.com/siderolabs/go-retry/retry"
1716
"github.com/stretchr/testify/require"
1817
"github.com/stretchr/testify/suite"
@@ -49,7 +48,7 @@ func TestUpgradeFallbackControllerSuite(t *testing.T) {
4948
require.NoError(t, f.Truncate(1024*1024))
5049
require.NoError(t, f.Close())
5150

52-
st := state.WrapCore(namespaced.NewState(inmem.Build))
51+
st := state.WrapCore(inmem.NewState())
5352

5453
m, err := meta.New(t.Context(), st, meta.WithFixedPath(path))
5554
require.NoError(t, err)

internal/app/machined/pkg/controllers/runtime/internal/diagnostics/address_overlap_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212

1313
"github.com/cosi-project/runtime/pkg/state"
1414
"github.com/cosi-project/runtime/pkg/state/impl/inmem"
15-
"github.com/cosi-project/runtime/pkg/state/impl/namespaced"
1615
"github.com/stretchr/testify/require"
1716
"go.uber.org/zap/zaptest"
1817

@@ -83,7 +82,7 @@ func TestAddressOverlapCheck(t *testing.T) {
8382
t.Parallel()
8483

8584
logger := zaptest.NewLogger(t)
86-
st := state.WrapCore(namespaced.NewState(inmem.Build))
85+
st := state.WrapCore(inmem.NewState())
8786

8887
in, err := generate.NewInput("test-cluster", "https://localhost", constants.DefaultKubernetesVersion)
8988
require.NoError(t, err)

internal/app/machined/pkg/runtime/v1alpha1/platform/equinixmetal/equinix_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212

1313
"github.com/cosi-project/runtime/pkg/state"
1414
"github.com/cosi-project/runtime/pkg/state/impl/inmem"
15-
"github.com/cosi-project/runtime/pkg/state/impl/namespaced"
1615
"github.com/stretchr/testify/assert"
1716
"github.com/stretchr/testify/require"
1817
"go.yaml.in/yaml/v4"
@@ -43,7 +42,7 @@ func TestParseMetadata(t *testing.T) {
4342

4443
ctx := t.Context()
4544

46-
st := state.WrapCore(namespaced.NewState(inmem.Build))
45+
st := state.WrapCore(inmem.NewState())
4746

4847
eth1 := network.NewLinkStatus(network.NamespaceName, "eth1")
4948
eth1.TypedSpec().PermanentAddr = nethelpers.HardwareAddr{0x68, 0x05, 0xca, 0xb8, 0xf1, 0xf8}
@@ -71,7 +70,7 @@ func TestParseMetadata2Bonds(t *testing.T) {
7170

7271
ctx := t.Context()
7372

74-
st := state.WrapCore(namespaced.NewState(inmem.Build))
73+
st := state.WrapCore(inmem.NewState())
7574

7675
eth0 := network.NewLinkStatus(network.NamespaceName, "eth0")
7776
eth0.TypedSpec().PermanentAddr = nethelpers.HardwareAddr{0xe4, 0x43, 0x4b, 0xd0, 0x7b, 0x50}

internal/app/machined/pkg/runtime/v1alpha1/platform/metal/metal_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212

1313
"github.com/cosi-project/runtime/pkg/state"
1414
"github.com/cosi-project/runtime/pkg/state/impl/inmem"
15-
"github.com/cosi-project/runtime/pkg/state/impl/namespaced"
1615
"github.com/stretchr/testify/assert"
1716
"github.com/stretchr/testify/require"
1817

@@ -33,7 +32,7 @@ func TestNetworkConfig(t *testing.T) {
3332

3433
ch := make(chan *runtime.PlatformNetworkConfig, 1)
3534

36-
st := state.WrapCore(namespaced.NewState(inmem.Build))
35+
st := state.WrapCore(inmem.NewState())
3736

3837
uuid := hardware.NewSystemInformation(hardware.SystemInformationID)
3938
uuid.TypedSpec().UUID = "0123-4567-89ab-cdef"

internal/app/machined/pkg/runtime/v1alpha1/platform/metal/url/map_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111

1212
"github.com/cosi-project/runtime/pkg/state"
1313
"github.com/cosi-project/runtime/pkg/state/impl/inmem"
14-
"github.com/cosi-project/runtime/pkg/state/impl/namespaced"
1514
"github.com/stretchr/testify/assert"
1615
"github.com/stretchr/testify/require"
1716

@@ -73,7 +72,7 @@ func TestMapValues(t *testing.T) {
7372
t.Run(test.name, func(t *testing.T) {
7473
t.Parallel()
7574

76-
st := state.WrapCore(namespaced.NewState(inmem.Build))
75+
st := state.WrapCore(inmem.NewState())
7776

7877
ctx, cancel := context.WithTimeout(t.Context(), 5*time.Second)
7978
defer cancel()

0 commit comments

Comments
 (0)