Skip to content

Commit

Permalink
fix: update COSI runtime
Browse files Browse the repository at this point in the history
See: cosi-project/runtime#492

Signed-off-by: Artem Chernyshev <[email protected]>
  • Loading branch information
Unix4ever committed Sep 12, 2024
1 parent f83cf3b commit ce1e7db
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 10 deletions.
4 changes: 2 additions & 2 deletions client/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ replace (
require (
github.com/adrg/xdg v0.5.0
github.com/blang/semver v3.5.1+incompatible
github.com/cosi-project/runtime v0.6.2
github.com/cosi-project/runtime v0.6.3
github.com/dustin/go-humanize v1.0.1
github.com/fatih/color v1.17.0
github.com/gertd/go-pluralize v0.2.1
github.com/google/uuid v1.6.0
Expand Down Expand Up @@ -54,7 +55,6 @@ require (
github.com/containernetworking/cni v1.2.3 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.4 //indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
Expand Down
4 changes: 2 additions & 2 deletions client/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ github.com/containerd/go-cni v1.1.10 h1:c2U73nld7spSWfiJwSh/8W9DK+/qQwYM2rngIhCy
github.com/containerd/go-cni v1.1.10/go.mod h1:/Y/sL8yqYQn1ZG1om1OncJB1W4zN3YmjfP/ShCzG/OY=
github.com/containernetworking/cni v1.2.3 h1:hhOcjNVUQTnzdRJ6alC5XF+wd9mfGIUaj8FuJbEslXM=
github.com/containernetworking/cni v1.2.3/go.mod h1:DuLgF+aPd3DzcTQTtp/Nvl1Kim23oFKdm2okJzBQA5M=
github.com/cosi-project/runtime v0.6.2 h1:GHp/GoJlqAfmVXq69r7CeSIXj31glMNz8z2RM3ugpRU=
github.com/cosi-project/runtime v0.6.2/go.mod h1:2iQ2Wu57UNm89ZksFLoMLGEZnPzUkk5g64+AlWHopo4=
github.com/cosi-project/runtime v0.6.3 h1:nCmEIY1jypCoraRaNsFvaLHkBI/ALYk/X1CGea7Ie1E=
github.com/cosi-project/runtime v0.6.3/go.mod h1:2iQ2Wu57UNm89ZksFLoMLGEZnPzUkk5g64+AlWHopo4=
github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ require (
github.com/blang/semver v3.5.1+incompatible
github.com/blang/semver/v4 v4.0.0
github.com/containers/image/v5 v5.32.2
github.com/cosi-project/runtime v0.6.2
github.com/cosi-project/state-etcd v0.3.1
github.com/cosi-project/runtime v0.6.3
github.com/cosi-project/state-etcd v0.3.2
github.com/crewjam/saml v0.4.14
github.com/dustin/go-humanize v1.0.1
github.com/emicklei/dot v1.6.2
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr
github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec=
github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs=
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/cosi-project/runtime v0.6.2 h1:GHp/GoJlqAfmVXq69r7CeSIXj31glMNz8z2RM3ugpRU=
github.com/cosi-project/runtime v0.6.2/go.mod h1:2iQ2Wu57UNm89ZksFLoMLGEZnPzUkk5g64+AlWHopo4=
github.com/cosi-project/state-etcd v0.3.1 h1:Xeg2YW8k4/tHhJao/SenC+eZiJaIkeavXVB8tHEgaIc=
github.com/cosi-project/state-etcd v0.3.1/go.mod h1:DTYhrWuBJHkkl1ke7Q/L1tQEd2N8p6XfZ+8haev3Tco=
github.com/cosi-project/runtime v0.6.3 h1:nCmEIY1jypCoraRaNsFvaLHkBI/ALYk/X1CGea7Ie1E=
github.com/cosi-project/runtime v0.6.3/go.mod h1:2iQ2Wu57UNm89ZksFLoMLGEZnPzUkk5g64+AlWHopo4=
github.com/cosi-project/state-etcd v0.3.2 h1:8Lnj5dPIUzkv5DYFpKvkP+vX5O9M9sWthXQfoKJrF78=
github.com/cosi-project/state-etcd v0.3.2/go.mod h1:wHp8V3OvGRILYvbJEmhMt0AFuByaGNkxXLDc61/+yFM=
github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,52 @@ func (suite *MachineSetStatusSuite) TestMachineLocks() {
})
}

func (suite *MachineSetStatusSuite) TestMachineIsAddedToAnotherMachineSet() {
ctx, cancel := context.WithTimeout(suite.ctx, time.Second*20)
defer cancel()

clusterName := "cluster-locks"

machines := []string{
"node01",
}

suite.createMachineSet(clusterName, "machine-set-1", machines)

rtestutils.AssertResources(ctx, suite.T(), suite.state, machines, func(*omni.ClusterMachine, *assert.Assertions) {})

_, err := safe.StateUpdateWithConflicts(ctx, suite.state, omni.NewClusterMachine(resources.DefaultNamespace, "node01").Metadata(), func(
res *omni.ClusterMachine,
) error {
res.Metadata().Finalizers().Add("locked")

return nil
}, state.WithUpdateOwner(machineset.ControllerName))

suite.Require().NoError(err)

rtestutils.DestroyAll[*omni.MachineSetNode](ctx, suite.T(), suite.state)

suite.createMachineSet(clusterName, "machine-set-2", machines)

_, err = safe.StateUpdateWithConflicts(ctx, suite.state, omni.NewClusterMachine(resources.DefaultNamespace, "node01").Metadata(), func(
res *omni.ClusterMachine,
) error {
res.Metadata().Finalizers().Remove("locked")

return nil
}, state.WithUpdateOwner(machineset.ControllerName), state.WithExpectedPhaseAny())

suite.Require().NoError(err)

rtestutils.AssertResources(ctx, suite.T(), suite.state, machines, func(cm *omni.ClusterMachine, assert *assert.Assertions) {
machineSetName, ok := cm.Metadata().Labels().Get(omni.LabelMachineSet)

assert.True(ok)
assert.Equal("machine-set-2", machineSetName)
})
}

func (suite *MachineSetStatusSuite) assertLabels(res resource.Resource, labels ...string) error {
if len(labels)%2 != 0 {
return errors.New("the number of label params must be even")
Expand Down

0 comments on commit ce1e7db

Please sign in to comment.