Skip to content

Commit

Permalink
chore: small fixes
Browse files Browse the repository at this point in the history
https://github.com/siderolabs/omni/actions/runs/9412691342/job/25928064700?pr=336 failed for some reason but output like:

```
#63 60.86         	Error Trace:	/src/internal/backend/runtime/omni/controllers/omni/machine_set_status_test.go:652
#63 60.86         	            				/src/internal/backend/runtime/omni/controllers/omni/machine_set_status_test.go:661
#63 60.86         	Error:      	unexpected event
#63 60.86         	Test:       	TestMachineSetStatusSuite/TestConfigUpdateWithMaxParallelism
#63 60.86         	Messages:   	got event {event:{Resource:0xc0023486e0 Old:0xc0016bfe40 Error:<nil> Type:1}}
```

Is not saying much, so lets format event output.

Also update github.com/cosi-project/runtime in client module, so editors aside from VS Code do not go crazy.

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
  • Loading branch information
DmitriyMV committed Jun 7, 2024
1 parent a6c8b47 commit b7d48aa
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 16 deletions.
10 changes: 5 additions & 5 deletions client/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ replace (
require (
github.com/adrg/xdg v0.4.0
github.com/blang/semver v3.5.1+incompatible
github.com/cosi-project/runtime v0.4.3
github.com/cosi-project/runtime v0.4.4-0.20240604111456-15e9d678159d
github.com/fatih/color v1.17.0
github.com/google/uuid v1.6.0
github.com/gosuri/uiprogress v0.0.1
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0
github.com/hashicorp/go-multierror v1.1.1
github.com/hexops/gotextdiff v1.0.3
github.com/mattn/go-isatty v0.0.20
github.com/planetscale/vtprotobuf v0.6.0
github.com/sergi/go-diff v1.3.1
github.com/siderolabs/gen v0.4.8
github.com/siderolabs/gen v0.5.0
github.com/siderolabs/go-api-signature v0.3.2
github.com/siderolabs/go-kubeconfig v0.1.0
github.com/siderolabs/go-pointer v1.0.0
Expand Down Expand Up @@ -81,8 +81,8 @@ require (
github.com/siderolabs/protoenc v0.2.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/oauth2 v0.20.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
Expand Down
20 changes: 10 additions & 10 deletions client/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ github.com/containerd/go-cni v1.1.9 h1:ORi7P1dYzCwVM6XPN4n3CbkuOx/NZ2DOqy+SHRdo9
github.com/containerd/go-cni v1.1.9/go.mod h1:XYrZJ1d5W6E2VOvjffL3IZq0Dz6bsVlERHbekNK90PM=
github.com/containernetworking/cni v1.1.2 h1:wtRGZVv7olUHMOqouPpn3cXJWpJgM6+EUl31EQbXALQ=
github.com/containernetworking/cni v1.1.2/go.mod h1:sDpYKmGVENF3s6uvMvGgldDWeG8dMxakj/u+i9ht9vw=
github.com/cosi-project/runtime v0.4.3 h1:00vBrQwXw/+p4g+XlRC9CnQlMxfbKMGqSKr1q41iD/c=
github.com/cosi-project/runtime v0.4.3/go.mod h1:eXVAHf9QzzSVblLUtHHPFOZ7JBuz+GypHbao1vw+SdQ=
github.com/cosi-project/runtime v0.4.4-0.20240604111456-15e9d678159d h1:dkIccz+KRXeiOQYJGGRWKAFkgWT7vp5GTit4MKeUs1I=
github.com/cosi-project/runtime v0.4.4-0.20240604111456-15e9d678159d/go.mod h1:fucT88LYFzORKoXQ1SzITQ11nq0HlR10RAXW5jkPWHQ=
github.com/cpuguy83/go-md2man/v2 v2.0.3 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM=
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down Expand Up @@ -92,8 +92,8 @@ github.com/gosuri/uilive v0.0.4 h1:hUEBpQDj8D8jXgtCdBu7sWsy5sbW/5GhuO8KBwJ2jyY=
github.com/gosuri/uilive v0.0.4/go.mod h1:V/epo5LjjlDE5RJUcqx8dbw+zc93y5Ya3yg8tfZ74VI=
github.com/gosuri/uiprogress v0.0.1 h1:0kpv/XY/qTmFWl/SkaJykZXrBBzwwadmW8fRb7RJSxw=
github.com/gosuri/uiprogress v0.0.1/go.mod h1:C1RTYn4Sc7iEyf6j8ft5dyoZ4212h8G1ol9QQluh5+0=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 h1:/c3QmbOGMGTOumP2iT/rCwB7b0QDGLKzqOmktBjT+Is=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1/go.mod h1:5SN9VR2LTsRFsrEC6FHgRbTWrTHu6tqPeKxEQv15giM=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
Expand Down Expand Up @@ -182,8 +182,8 @@ github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I=
github.com/siderolabs/crypto v0.4.4 h1:Q6EDBMR2Ub2oAZW5Xl8lrKB27bM3Sn8Gkfw3rngco5U=
github.com/siderolabs/crypto v0.4.4/go.mod h1:hsR3tJ3aaeuhCChsLF4dBd9vlJVPvmhg4vvx2ez4aD4=
github.com/siderolabs/gen v0.4.8 h1:VNpbmDLhkXp7qcSEkKk1Ee7vU2afs3xvHrWLGR2UuiY=
github.com/siderolabs/gen v0.4.8/go.mod h1:7ROKVHHB68R3Amrd4a1ZXz/oMrXWF3Mg3lSEgnkJY5c=
github.com/siderolabs/gen v0.5.0 h1:Afdjx+zuZDf53eH5DB+E+T2JeCwBXGinV66A6osLgQI=
github.com/siderolabs/gen v0.5.0/go.mod h1:1GUMBNliW98Xeq8GPQeVMYqQE09LFItE8enR3wgMh3Q=
github.com/siderolabs/go-api-signature v0.3.2 h1:blqrZF1GM7TWgq7mY7CsR+yQ93u6az0Kf0mfsw+hvf0=
github.com/siderolabs/go-api-signature v0.3.2/go.mod h1:punhUOaXa7LELYBRCUhfgUGH6ieVz68GrP98apCKXj8=
github.com/siderolabs/go-blockdevice v0.4.7 h1:2bk4WpEEflGxjrNwp57ye24Pr+cYgAiAeNMWiQOuWbQ=
Expand Down Expand Up @@ -232,8 +232,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2 h1:Jvc7gsqn21cJHCmAWx0LiimpP18LZmUxkT5Mp7EZ1mI=
golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
Expand All @@ -252,8 +252,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo=
golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ import (
"github.com/cosi-project/runtime/pkg/state"
"github.com/siderolabs/gen/pair"
"github.com/siderolabs/gen/xslices"
"github.com/siderolabs/gen/xtesting/must"
"github.com/siderolabs/go-retry/retry"
"github.com/siderolabs/talos/pkg/machinery/config"
talossecrets "github.com/siderolabs/talos/pkg/machinery/config/generate/secrets"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
"golang.org/x/sync/errgroup"
"gopkg.in/yaml.v3"

"github.com/siderolabs/omni/client/api/omni/specs"
"github.com/siderolabs/omni/client/pkg/omni/resources"
Expand Down Expand Up @@ -649,7 +651,7 @@ func (suite *MachineSetStatusSuite) TestConfigUpdateWithMaxParallelism() {
case <-suite.ctx.Done():
suite.Require().NoError(suite.ctx.Err())
case event := <-watchCh:
suite.Failf("unexpected event", "got event %+v", event)
suite.Failf("unexpected event", "got event %s", formatEvent[*omni.ClusterMachineConfigPatches](suite.T(), &event))
case <-timer.C:
}
}
Expand Down Expand Up @@ -678,6 +680,28 @@ func (suite *MachineSetStatusSuite) TestConfigUpdateWithMaxParallelism() {
expectEvents(2)
}

type event[T resource.Resource] interface {
Resource() (T, error)
Old() (T, error)
Type() state.EventType
Error() error
}

func formatEvent[T resource.Resource](t *testing.T, event event[T]) string {
newRes := must.Value(event.Resource())(t)
oldRes := must.Value(event.Old())(t)
newResYaml := must.Value(resource.MarshalYAML(newRes))(t)
oldResYaml := must.Value(resource.MarshalYAML(oldRes))(t)

return fmt.Sprintf(
"\ntype:\n%s\n------\nerror:\n%s\n------\nnew:\n%s\n------\nold:\n%s",
event.Type(),
event.Error(),
string(must.Value(yaml.Marshal(newResYaml))(t)),
string(must.Value(yaml.Marshal(oldResYaml))(t)),
)
}

func (suite *MachineSetStatusSuite) TestTeardown() {
machines := []string{
"n1",
Expand Down

0 comments on commit b7d48aa

Please sign in to comment.