refactor(main): add operator interface #3048
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🤖 Generated by Copilot at a0606ce
Summary
🚚🧪🔒
Refactored the test code to use a single
operators.FakeClient
type that embeds fake interfaces for cluster, image, run, and cert operations. Renamed and reorganized thecluster
andrun
packages tocheckers
andoperators
respectively. Added and deleted some test files to reflect the new structure and functionality.Walkthrough
operators.FakeClient
type that embeds the fake interfaces for executing commands and verifying cluster states (link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link,link)fakeRunInterface.Apply
method calls withfakeClient.Cluster.Apply
in theapply_test.go
file (link,link,link,link,link,link,link,link)cluster.NewFakeGroupClient
function calls withcheckers.NewFakeGroupClient
in theapply_test.go
andrun_test.go
files (link,link,link,link,link,link,link,link,link)fakeImageInterface.BuildImage
method calls withfakeClient.Image.BuildImage
in theapply_test.go
,image_cri_shim_test.go
,images_test.go
, andrun_test.go
files (link,link,link,link,link,link,link,link)fakeRunInterface.Run
method calls withfakeClient.Cluster.Run
in theimage_cri_shim_test.go
,images_test.go
, andrun_test.go
files (link,link,link,link,link,link,link)fakeImageInterface.ListImages
method calls withfakeClient.Image.ListImages
in theimages_test.go
file (link)fakeImageInterface.PullImage
method calls withfakeClient.Image.PullImage
in theinspect_test.go
andrun_test.go
files (link,link,link)fakeInspectInterface.LocalImage
method calls withfakeClient.Inspect.LocalImage
in theinspect_test.go
file (link)fakeImageInterface.DockerArchiveImage
andfakeImageInterface.OCIArchiveImage
method calls withfakeClient.Image.DockerArchiveImage
andfakeClient.Image.OCIArchiveImage
in theinspect_test.go
file (link)fakeImageInterface.SaveImage
method calls withfakeClient.Image.SaveImage
in therun_test.go
file (link)fakeImageInterface.TagImage
method calls withfakeClient.Image.TagImage
in therun_test.go
file (link)cert.go
file to theoperators
package to provide the fake implementation of theoperators.FakeCertInterface
for executing certificate commands (link)loadYaml
method toloadInitConfig
and add theloadUpdateConfig
method in thefake.go
file to load the initial and updated cluster configurations (link,link,link)CertDomain
field to theFakeOpts
type and thefakeCertSansUpdateClient
to the list of fake implementations in thefake.go
file to verify the certificate domain update (link,link)clusterName
parameter to have a default value of "default" in thefake.go
file to avoid errors when loading the cluster configuration (link)