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

fix: error when generating mocks #414

Merged
merged 1 commit into from
Nov 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 0 additions & 108 deletions internal/hcapi2/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package hcapi2
import (
"sync"

"github.com/golang/mock/gomock"
"github.com/hetznercloud/hcloud-go/hcloud"
)

Expand Down Expand Up @@ -206,110 +205,3 @@ func (c *client) PlacementGroup() PlacementGroupClient {
defer c.mu.Unlock()
return c.placementGroupClient
}

type MockClient struct {
CertificateClient *MockCertificateClient
DatacenterClient *MockDatacenterClient
FirewallClient *MockFirewallClient
FloatingIPClient *MockFloatingIPClient
PrimaryIPClient *MockPrimaryIPClient
ImageClient *MockImageClient
LocationClient *MockLocationClient
LoadBalancerClient *MockLoadBalancerClient
LoadBalancerTypeClient *MockLoadBalancerTypeClient
NetworkClient *MockNetworkClient
ServerClient *MockServerClient
ServerTypeClient *MockServerTypeClient
SSHKeyClient *MockSSHKeyClient
VolumeClient *MockVolumeClient
ISOClient *MockISOClient
PlacementGroupClient *MockPlacementGroupClient
RDNSClient *MockRDNSClient
}

func NewMockClient(ctrl *gomock.Controller) *MockClient {
return &MockClient{
CertificateClient: NewMockCertificateClient(ctrl),
DatacenterClient: NewMockDatacenterClient(ctrl),
FirewallClient: NewMockFirewallClient(ctrl),
FloatingIPClient: NewMockFloatingIPClient(ctrl),
PrimaryIPClient: NewMockPrimaryIPClient(ctrl),
ImageClient: NewMockImageClient(ctrl),
LocationClient: NewMockLocationClient(ctrl),
LoadBalancerClient: NewMockLoadBalancerClient(ctrl),
LoadBalancerTypeClient: NewMockLoadBalancerTypeClient(ctrl),
NetworkClient: NewMockNetworkClient(ctrl),
ServerClient: NewMockServerClient(ctrl),
ServerTypeClient: NewMockServerTypeClient(ctrl),
SSHKeyClient: NewMockSSHKeyClient(ctrl),
VolumeClient: NewMockVolumeClient(ctrl),
ISOClient: NewMockISOClient(ctrl),
PlacementGroupClient: NewMockPlacementGroupClient(ctrl),
RDNSClient: NewMockRDNSClient(ctrl),
}
}
func (c *MockClient) Certificate() CertificateClient {
return c.CertificateClient
}
func (c *MockClient) Datacenter() DatacenterClient {
return c.DatacenterClient
}

func (c *MockClient) Firewall() FirewallClient {
return c.FirewallClient
}

func (c *MockClient) FloatingIP() FloatingIPClient {
return c.FloatingIPClient
}

func (c *MockClient) PrimaryIP() PrimaryIPClient {
return c.PrimaryIPClient
}

func (c *MockClient) Image() ImageClient {
return c.ImageClient
}

func (c *MockClient) ISO() ISOClient {
return c.ISOClient
}

func (c *MockClient) Location() LocationClient {
return c.LocationClient
}

func (c *MockClient) LoadBalancer() LoadBalancerClient {
return c.LoadBalancerClient
}

func (c *MockClient) LoadBalancerType() LoadBalancerTypeClient {
return c.LoadBalancerTypeClient
}

func (c *MockClient) Network() NetworkClient {
return c.NetworkClient
}

func (c *MockClient) Server() ServerClient {
return c.ServerClient
}

func (c *MockClient) ServerType() ServerTypeClient {
return c.ServerTypeClient
}

func (c *MockClient) SSHKey() SSHKeyClient {
return c.SSHKeyClient
}

func (c *MockClient) Volume() VolumeClient {
return c.VolumeClient
}
func (c *MockClient) RDNS() RDNSClient {
return c.RDNSClient
}

func (c *MockClient) PlacementGroup() PlacementGroupClient {
return c.PlacementGroupClient
}
113 changes: 113 additions & 0 deletions internal/hcapi2/mock/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
package hcapi2_mock

import (
"github.com/golang/mock/gomock"
"github.com/hetznercloud/cli/internal/hcapi2"
)

type MockClient struct {
CertificateClient *MockCertificateClient
DatacenterClient *MockDatacenterClient
FirewallClient *MockFirewallClient
FloatingIPClient *MockFloatingIPClient
PrimaryIPClient *MockPrimaryIPClient
ImageClient *MockImageClient
LocationClient *MockLocationClient
LoadBalancerClient *MockLoadBalancerClient
LoadBalancerTypeClient *MockLoadBalancerTypeClient
NetworkClient *MockNetworkClient
ServerClient *MockServerClient
ServerTypeClient *MockServerTypeClient
SSHKeyClient *MockSSHKeyClient
VolumeClient *MockVolumeClient
ISOClient *MockISOClient
PlacementGroupClient *MockPlacementGroupClient
RDNSClient *MockRDNSClient
}

func NewMockClient(ctrl *gomock.Controller) *MockClient {
return &MockClient{
CertificateClient: NewMockCertificateClient(ctrl),
DatacenterClient: NewMockDatacenterClient(ctrl),
FirewallClient: NewMockFirewallClient(ctrl),
FloatingIPClient: NewMockFloatingIPClient(ctrl),
PrimaryIPClient: NewMockPrimaryIPClient(ctrl),
ImageClient: NewMockImageClient(ctrl),
LocationClient: NewMockLocationClient(ctrl),
LoadBalancerClient: NewMockLoadBalancerClient(ctrl),
LoadBalancerTypeClient: NewMockLoadBalancerTypeClient(ctrl),
NetworkClient: NewMockNetworkClient(ctrl),
ServerClient: NewMockServerClient(ctrl),
ServerTypeClient: NewMockServerTypeClient(ctrl),
SSHKeyClient: NewMockSSHKeyClient(ctrl),
VolumeClient: NewMockVolumeClient(ctrl),
ISOClient: NewMockISOClient(ctrl),
PlacementGroupClient: NewMockPlacementGroupClient(ctrl),
RDNSClient: NewMockRDNSClient(ctrl),
}
}
func (c *MockClient) Certificate() hcapi2.CertificateClient {
return c.CertificateClient
}
func (c *MockClient) Datacenter() hcapi2.DatacenterClient {
return c.DatacenterClient
}

func (c *MockClient) Firewall() hcapi2.FirewallClient {
return c.FirewallClient
}

func (c *MockClient) FloatingIP() hcapi2.FloatingIPClient {
return c.FloatingIPClient
}

func (c *MockClient) PrimaryIP() hcapi2.PrimaryIPClient {
return c.PrimaryIPClient
}

func (c *MockClient) Image() hcapi2.ImageClient {
return c.ImageClient
}

func (c *MockClient) ISO() hcapi2.ISOClient {
return c.ISOClient
}

func (c *MockClient) Location() hcapi2.LocationClient {
return c.LocationClient
}

func (c *MockClient) LoadBalancer() hcapi2.LoadBalancerClient {
return c.LoadBalancerClient
}

func (c *MockClient) LoadBalancerType() hcapi2.LoadBalancerTypeClient {
return c.LoadBalancerTypeClient
}

func (c *MockClient) Network() hcapi2.NetworkClient {
return c.NetworkClient
}

func (c *MockClient) Server() hcapi2.ServerClient {
return c.ServerClient
}

func (c *MockClient) ServerType() hcapi2.ServerTypeClient {
return c.ServerTypeClient
}

func (c *MockClient) SSHKey() hcapi2.SSHKeyClient {
return c.SSHKeyClient
}

func (c *MockClient) Volume() hcapi2.VolumeClient {
return c.VolumeClient
}
func (c *MockClient) RDNS() hcapi2.RDNSClient {
return c.RDNSClient
}

func (c *MockClient) PlacementGroup() hcapi2.PlacementGroupClient {
return c.PlacementGroupClient
}
19 changes: 19 additions & 0 deletions internal/hcapi2/mock/mock_gen.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package hcapi2_mock

//go:generate mockgen -package hcapi2_mock -destination zz_certificate_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 CertificateClient
//go:generate mockgen -package hcapi2_mock -destination zz_datacenter_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 DatacenterClient
//go:generate mockgen -package hcapi2_mock -destination zz_image_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 ImageClient
//go:generate mockgen -package hcapi2_mock -destination zz_iso_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 ISOClient
//go:generate mockgen -package hcapi2_mock -destination zz_firewall_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 FirewallClient
//go:generate mockgen -package hcapi2_mock -destination zz_floating_ip_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 FloatingIPClient
//go:generate mockgen -package hcapi2_mock -destination zz_primary_ip_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 PrimaryIPClient
//go:generate mockgen -package hcapi2_mock -destination zz_location_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 LocationClient
//go:generate mockgen -package hcapi2_mock -destination zz_loadbalancer_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 LoadBalancerClient
//go:generate mockgen -package hcapi2_mock -destination zz_loadbalancer_type_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 LoadBalancerTypeClient
//go:generate mockgen -package hcapi2_mock -destination zz_network_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 NetworkClient
//go:generate mockgen -package hcapi2_mock -destination zz_server_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 ServerClient
//go:generate mockgen -package hcapi2_mock -destination zz_server_type_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 ServerTypeClient
//go:generate mockgen -package hcapi2_mock -destination zz_ssh_key_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 SSHKeyClient
//go:generate mockgen -package hcapi2_mock -destination zz_volume_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 VolumeClient
//go:generate mockgen -package hcapi2_mock -destination zz_placement_group_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 PlacementGroupClient
//go:generate mockgen -package hcapi2_mock -destination zz_rdns_client_mock.go github.com/hetznercloud/cli/internal/hcapi2 RDNSClient

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading