Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(main): add operator interface #3048

Merged
merged 1 commit into from
May 7, 2023
Merged

Conversation

cuisongliu
Copy link
Collaborator

@cuisongliu cuisongliu commented May 7, 2023

🤖 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 the cluster and run packages to checkers and operators respectively. Added and deleted some test files to reflect the new structure and functionality.

We are the operators, we fake the commands
We are the checkers, we verify the lands
We refactor and rename, we simplify the tests
We are the metal coders, we rock the pull requests

Walkthrough

  • Refactor the test suites to use a single 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)
  • Replace the fakeRunInterface.Apply method calls with fakeClient.Cluster.Apply in the apply_test.go file (link,link,link,link,link,link,link,link)
  • Replace the cluster.NewFakeGroupClient function calls with checkers.NewFakeGroupClient in the apply_test.go and run_test.go files (link,link,link,link,link,link,link,link,link)
  • Replace the fakeImageInterface.BuildImage method calls with fakeClient.Image.BuildImage in the apply_test.go, image_cri_shim_test.go, images_test.go, and run_test.go files (link,link,link,link,link,link,link,link)
  • Replace the fakeRunInterface.Run method calls with fakeClient.Cluster.Run in the image_cri_shim_test.go, images_test.go, and run_test.go files (link,link,link,link,link,link,link)
  • Replace the fakeImageInterface.ListImages method calls with fakeClient.Image.ListImages in the images_test.go file (link)
  • Replace the fakeImageInterface.PullImage method calls with fakeClient.Image.PullImage in the inspect_test.go and run_test.go files (link,link,link)
  • Replace the fakeInspectInterface.LocalImage method calls with fakeClient.Inspect.LocalImage in the inspect_test.go file (link)
  • Replace the fakeImageInterface.DockerArchiveImage and fakeImageInterface.OCIArchiveImage method calls with fakeClient.Image.DockerArchiveImage and fakeClient.Image.OCIArchiveImage in the inspect_test.go file (link)
  • Replace the fakeImageInterface.SaveImage method calls with fakeClient.Image.SaveImage in the run_test.go file (link)
  • Replace the fakeImageInterface.TagImage method calls with fakeClient.Image.TagImage in the run_test.go file (link)
  • Add the cert.go file to the operators package to provide the fake implementation of the operators.FakeCertInterface for executing certificate commands (link)
  • Rename the loadYaml method to loadInitConfig and add the loadUpdateConfig method in the fake.go file to load the initial and updated cluster configurations (link,link,link)
  • Add the CertDomain field to the FakeOpts type and the fakeCertSansUpdateClient to the list of fake implementations in the fake.go file to verify the certificate domain update (link,link)
  • Change the clusterName parameter to have a default value of "default" in the fake.go file to avoid errors when loading the cluster configuration (link)

@codecov
Copy link

codecov bot commented May 7, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (8f94803) 72.30% compared to head (ec6c675) 72.30%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3048   +/-   ##
=======================================
  Coverage   72.30%   72.30%           
=======================================
  Files           8        8           
  Lines         603      603           
=======================================
  Hits          436      436           
  Misses        132      132           
  Partials       35       35           

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Signed-off-by: cuisongliu <cuisongliu@qq.com>
@zzjin zzjin merged commit a3dd077 into labring:main May 7, 2023
54 checks passed
@cuisongliu cuisongliu deleted the e2e_ref branch May 7, 2023 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants