add ut for pkg/version/version.go
What type of PR is this? add ut for pkg/version/version.go
/kind cleanup
What this PR does / why we need it:
Which issue(s) this PR fixes:
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Thanks for contribution
Hi @my-git9, thanks a lot! You can pick the related task as #2579 said.
Hi @my-git9, thanks a lot! You can pick the related task as #2579 said.
OK~~
I made some changes on your patch, please reference:
func TestInfo_String(t *testing.T) { tests := []struct { name string info Info want string }{ { name: "test1", info: Info{ GitVersion: "1.3.0", GitCommit: "da070e68f3318410c8c70ed8186a2bc4736dacbd", GitTreeState: "clean", BuildDate: "2022-08-31T13:09:22Z", GoVersion: "go1.18.3", Compiler: "gc", Platform: "linux/amd64", }, want: `version.Info{GitVersion:"1.3.0", GitCommit:"da070e68f3318410c8c70ed8186a2bc4736dacbd", GitTreeState:"clean", BuildDate:"2022-08-31T13:09:22Z", GoVersion:"go1.18.3", Compiler:"gc", Platform:"linux/amd64"}`, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := tt.info.String(); got != tt.want { t.Errorf("Info.String() = %v, want %v", got, tt.want) } }) } }
Thanks a lot!
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: RainbowMango
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~OWNERS~~ [RainbowMango]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment