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 golint failures on e2e/[..]/(aws|azure) #74312

Merged
merged 1 commit into from
Feb 21, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions hack/.golint_failures
Original file line number Diff line number Diff line change
Expand Up @@ -674,8 +674,6 @@ test/e2e/cloud
test/e2e/common
test/e2e/framework
test/e2e/framework/ingress
test/e2e/framework/providers/aws
test/e2e/framework/providers/azure
test/e2e/framework/providers/gce
test/e2e/framework/providers/kubemark
test/e2e/instrumentation
Expand Down
12 changes: 10 additions & 2 deletions test/e2e/framework/providers/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,28 @@ import (
)

func init() {
framework.RegisterProvider("aws", NewProvider)
framework.RegisterProvider("aws", newProvider)
}

func NewProvider() (framework.ProviderInterface, error) {
func newProvider() (framework.ProviderInterface, error) {
if framework.TestContext.CloudConfig.Zone == "" {
return nil, fmt.Errorf("gce-zone must be specified for AWS")
}
return &Provider{}, nil
}

// Provider is a structure to handle AWS clouds for e2e testing
type Provider struct {
framework.NullProvider
}

// ResizeGroup resizes an instance group
func (p *Provider) ResizeGroup(group string, size int32) error {
client := autoscaling.New(session.New())
return awscloud.ResizeInstanceGroup(client, group, int(size))
}

// GroupSize returns the size of an instance group
func (p *Provider) GroupSize(group string) (int, error) {
client := autoscaling.New(session.New())
instanceGroup, err := awscloud.DescribeInstanceGroup(client, group)
Expand All @@ -63,6 +66,7 @@ func (p *Provider) GroupSize(group string) (int, error) {
return instanceGroup.CurrentSize()
}

// DeleteNode deletes a node which is specified as the argument
func (p *Provider) DeleteNode(node *v1.Node) error {
client := newAWSClient("")

Expand All @@ -80,6 +84,7 @@ func (p *Provider) DeleteNode(node *v1.Node) error {
return err
}

// CreatePD creates a persistent volume on the specified availability zone
func (p *Provider) CreatePD(zone string) (string, error) {
client := newAWSClient(zone)
request := &ec2.CreateVolumeInput{}
Expand All @@ -98,6 +103,7 @@ func (p *Provider) CreatePD(zone string) (string, error) {
return volumeName, nil
}

// DeletePD deletes a persistent volume
func (p *Provider) DeletePD(pdName string) error {
client := newAWSClient("")

Expand All @@ -116,6 +122,7 @@ func (p *Provider) DeletePD(pdName string) error {
return nil
}

// CreatePVSource creates a persistent volume source
func (p *Provider) CreatePVSource(zone, diskName string) (*v1.PersistentVolumeSource, error) {
return &v1.PersistentVolumeSource{
AWSElasticBlockStore: &v1.AWSElasticBlockStoreVolumeSource{
Expand All @@ -125,6 +132,7 @@ func (p *Provider) CreatePVSource(zone, diskName string) (*v1.PersistentVolumeSo
}, nil
}

// DeletePVSource deletes a persistent volume source
func (p *Provider) DeletePVSource(pvSource *v1.PersistentVolumeSource) error {
return framework.DeletePDWithRetry(pvSource.AWSElasticBlockStore.VolumeID)
}
Expand Down
9 changes: 7 additions & 2 deletions test/e2e/framework/providers/azure/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ import (
)

func init() {
framework.RegisterProvider("azure", NewProvider)
framework.RegisterProvider("azure", newProvider)
}

func NewProvider() (framework.ProviderInterface, error) {
func newProvider() (framework.ProviderInterface, error) {
if framework.TestContext.CloudConfig.ConfigFile == "" {
return nil, fmt.Errorf("config-file must be specified for Azure")
}
Expand All @@ -47,16 +47,19 @@ func NewProvider() (framework.ProviderInterface, error) {
}, err
}

//Provider is a structure to handle Azure clouds for e2e testing
type Provider struct {
framework.NullProvider

azureCloud *azure.Cloud
}

// DeleteNode deletes a node which is specified as the argument
func (p *Provider) DeleteNode(node *v1.Node) error {
return errors.New("not implemented yet")
}

// CreatePD creates a persistent volume
func (p *Provider) CreatePD(zone string) (string, error) {
pdName := fmt.Sprintf("%s-%s", framework.TestContext.Prefix, string(uuid.NewUUID()))
_, diskURI, _, err := p.azureCloud.CreateVolume(pdName, "" /* account */, "" /* sku */, "" /* location */, 1 /* sizeGb */)
Expand All @@ -66,6 +69,7 @@ func (p *Provider) CreatePD(zone string) (string, error) {
return diskURI, nil
}

// DeletePD deletes a persistent volume
func (p *Provider) DeletePD(pdName string) error {
if err := p.azureCloud.DeleteVolume(pdName); err != nil {
framework.Logf("failed to delete Azure volume %q: %v", pdName, err)
Expand All @@ -74,6 +78,7 @@ func (p *Provider) DeletePD(pdName string) error {
return nil
}

// EnableAndDisableInternalLB returns functions for both enabling and disabling internal Load Balancer
func (p *Provider) EnableAndDisableInternalLB() (enable, disable func(svc *v1.Service)) {
enable = func(svc *v1.Service) {
svc.ObjectMeta.Annotations = map[string]string{azure.ServiceAnnotationLoadBalancerInternal: "true"}
Expand Down