Permalink
Browse files

Fixed Failed Tests.

  • Loading branch information...
gopherstein committed Jul 7, 2017
1 parent 4dd10ba commit 42611fc5d74311de76cfc197f47be26d13e21372
Showing with 217 additions and 0 deletions.
  1. +32 −0 pkg/provider/aws/create_kube_test.go
  2. +11 −0 pkg/provider/aws/delete_kube_test.go
  3. +174 −0 test/fake_aws_provider/fake_efs.go
@@ -8,6 +8,8 @@ import (
awssdk "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go/service/ec2/ec2iface"
"github.com/aws/aws-sdk-go/service/efs"
"github.com/aws/aws-sdk-go/service/efs/efsiface"
"github.com/aws/aws-sdk-go/service/elb"
"github.com/aws/aws-sdk-go/service/elb/elbiface"
"github.com/aws/aws-sdk-go/service/iam"
@@ -52,6 +54,9 @@ func TestAWSProviderCreateKube(t *testing.T) {
mockDeleteObjectError error
mockPutObjectError error
mockDeleteBucketError error
mockCreateFileSystem error
mockCreateMountTarget error
mockDescribeMountTargets error
// Expectations
err error
}{
@@ -497,6 +502,33 @@ func TestAWSProviderCreateKube(t *testing.T) {
},
}
},
EFS: func(kube *model.Kube) efsiface.EFSAPI {
return &fake_aws_provider.EFS{
CreateFileSystemfn: func(input *efs.CreateFileSystemInput) (*efs.FileSystemDescription, error) {
output := &efs.FileSystemDescription{
FileSystemId: awssdk.String("cheese"),
}
return output, nil
},
CreateMountTargetfn: func(input *efs.CreateMountTargetInput) (*efs.MountTargetDescription, error) {
output := &efs.MountTargetDescription{
FileSystemId: awssdk.String("cheese"),
}
return output, nil
},
DescribeMountTargetsfn: func(input *efs.DescribeMountTargetsInput) (*efs.DescribeMountTargetsOutput, error) {
output := &efs.DescribeMountTargetsOutput{
MountTargets: []*efs.MountTargetDescription{
&efs.MountTargetDescription{
LifeCycleState: awssdk.String("available"),
},
},
}
return output, nil
},
}
},
}
action := &core.Action{Status: new(model.ActionStatus)}
@@ -8,6 +8,8 @@ import (
awssdk "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go/service/ec2/ec2iface"
"github.com/aws/aws-sdk-go/service/efs"
"github.com/aws/aws-sdk-go/service/efs/efsiface"
"github.com/aws/aws-sdk-go/service/elb"
"github.com/aws/aws-sdk-go/service/elb/elbiface"
"github.com/aws/aws-sdk-go/service/s3"
@@ -46,6 +48,7 @@ func TestAWSProviderDeleteKube(t *testing.T) {
mockPutObjectError error
mockDeleteBucketError error
mockDeleteLoadBalancerError error
mockDeleteMountTargetError error
// Expectations
err error
}{
@@ -332,6 +335,14 @@ func TestAWSProviderDeleteKube(t *testing.T) {
},
}
},
EFS: func(kube *model.Kube) efsiface.EFSAPI {
return &fake_aws_provider.EFS{
DeleteMountTargetfn: func(input *efs.DeleteMountTargetInput) (*efs.DeleteMountTargetOutput, error) {
output := &efs.DeleteMountTargetOutput{}
return output, item.mockDeleteMountTargetError
},
}
},
}
action := &core.Action{Status: new(model.ActionStatus)}
@@ -0,0 +1,174 @@
package fake_aws_provider
import (
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/efs"
)
type EFS struct {
CreateFileSystemfn func(*efs.CreateFileSystemInput) (*efs.FileSystemDescription, error)
CreateFileSystemRequestfn func(*efs.CreateFileSystemInput) (*request.Request, *efs.FileSystemDescription)
CreateMountTargetfn func(*efs.CreateMountTargetInput) (*efs.MountTargetDescription, error)
CreateMountTargetRequestfn func(*efs.CreateMountTargetInput) (*request.Request, *efs.MountTargetDescription)
CreateTagsfn func(*efs.CreateTagsInput) (*efs.CreateTagsOutput, error)
CreateTagsRequestfn func(*efs.CreateTagsInput) (*request.Request, *efs.CreateTagsOutput)
DeleteFileSystemfn func(*efs.DeleteFileSystemInput) (*efs.DeleteFileSystemOutput, error)
DeleteFileSystemRequestfn func(*efs.DeleteFileSystemInput) (*request.Request, *efs.DeleteFileSystemOutput)
DeleteMountTargetfn func(*efs.DeleteMountTargetInput) (*efs.DeleteMountTargetOutput, error)
DeleteMountTargetRequestfn func(*efs.DeleteMountTargetInput) (*request.Request, *efs.DeleteMountTargetOutput)
DeleteTagsfn func(*efs.DeleteTagsInput) (*efs.DeleteTagsOutput, error)
DeleteTagsRequestfn func(*efs.DeleteTagsInput) (*request.Request, *efs.DeleteTagsOutput)
DescribeFileSystemsfn func(*efs.DescribeFileSystemsInput) (*efs.DescribeFileSystemsOutput, error)
DescribeFileSystemsRequestfn func(*efs.DescribeFileSystemsInput) (*request.Request, *efs.DescribeFileSystemsOutput)
DescribeMountTargetSecurityGroupsfn func(*efs.DescribeMountTargetSecurityGroupsInput) (*efs.DescribeMountTargetSecurityGroupsOutput, error)
DescribeMountTargetSecurityGroupsRequestfn func(*efs.DescribeMountTargetSecurityGroupsInput) (*request.Request, *efs.DescribeMountTargetSecurityGroupsOutput)
DescribeMountTargetsfn func(*efs.DescribeMountTargetsInput) (*efs.DescribeMountTargetsOutput, error)
DescribeMountTargetsRequestfn func(*efs.DescribeMountTargetsInput) (*request.Request, *efs.DescribeMountTargetsOutput)
DescribeTagsfn func(*efs.DescribeTagsInput) (*efs.DescribeTagsOutput, error)
DescribeTagsRequestfn func(*efs.DescribeTagsInput) (*request.Request, *efs.DescribeTagsOutput)
ModifyMountTargetSecurityGroupsfn func(*efs.ModifyMountTargetSecurityGroupsInput) (*efs.ModifyMountTargetSecurityGroupsOutput, error)
ModifyMountTargetSecurityGroupsRequestfn func(*efs.ModifyMountTargetSecurityGroupsInput) (*request.Request, *efs.ModifyMountTargetSecurityGroupsOutput)
}
func (f *EFS) CreateFileSystem(input *efs.CreateFileSystemInput) (*efs.FileSystemDescription, error) {
if f.CreateFileSystemfn == nil {
return nil, nil
}
return f.CreateFileSystemfn(input)
}
func (f *EFS) CreateFileSystemRequest(input *efs.CreateFileSystemInput) (*request.Request, *efs.FileSystemDescription) {
if f.CreateFileSystemRequestfn == nil {
return nil, nil
}
return f.CreateFileSystemRequestfn(input)
}
func (f *EFS) CreateMountTarget(input *efs.CreateMountTargetInput) (*efs.MountTargetDescription, error) {
if f.CreateMountTargetfn == nil {
return nil, nil
}
return f.CreateMountTargetfn(input)
}
func (f *EFS) CreateMountTargetRequest(input *efs.CreateMountTargetInput) (*request.Request, *efs.MountTargetDescription) {
if f.CreateMountTargetRequestfn == nil {
return nil, nil
}
return f.CreateMountTargetRequestfn(input)
}
func (f *EFS) CreateTags(input *efs.CreateTagsInput) (*efs.CreateTagsOutput, error) {
if f.CreateTagsfn == nil {
return nil, nil
}
return f.CreateTagsfn(input)
}
func (f *EFS) CreateTagsRequest(input *efs.CreateTagsInput) (*request.Request, *efs.CreateTagsOutput) {
if f.CreateTagsRequestfn == nil {
return nil, nil
}
return f.CreateTagsRequestfn(input)
}
func (f *EFS) DeleteFileSystem(input *efs.DeleteFileSystemInput) (*efs.DeleteFileSystemOutput, error) {
if f.DeleteFileSystemfn == nil {
return nil, nil
}
return f.DeleteFileSystemfn(input)
}
func (f *EFS) DeleteFileSystemRequest(input *efs.DeleteFileSystemInput) (*request.Request, *efs.DeleteFileSystemOutput) {
if f.DeleteFileSystemRequestfn == nil {
return nil, nil
}
return f.DeleteFileSystemRequestfn(input)
}
func (f *EFS) DeleteMountTarget(input *efs.DeleteMountTargetInput) (*efs.DeleteMountTargetOutput, error) {
if f.DeleteMountTargetfn == nil {
return nil, nil
}
return f.DeleteMountTargetfn(input)
}
func (f *EFS) DeleteMountTargetRequest(input *efs.DeleteMountTargetInput) (*request.Request, *efs.DeleteMountTargetOutput) {
if f.DeleteMountTargetRequestfn == nil {
return nil, nil
}
return f.DeleteMountTargetRequestfn(input)
}
func (f *EFS) DeleteTags(input *efs.DeleteTagsInput) (*efs.DeleteTagsOutput, error) {
if f.DeleteTagsfn == nil {
return nil, nil
}
return f.DeleteTagsfn(input)
}
func (f *EFS) DeleteTagsRequest(input *efs.DeleteTagsInput) (*request.Request, *efs.DeleteTagsOutput) {
if f.DeleteTagsRequestfn == nil {
return nil, nil
}
return f.DeleteTagsRequestfn(input)
}
func (f *EFS) DescribeFileSystems(input *efs.DescribeFileSystemsInput) (*efs.DescribeFileSystemsOutput, error) {
if f.DescribeFileSystemsfn == nil {
return nil, nil
}
return f.DescribeFileSystemsfn(input)
}
func (f *EFS) DescribeFileSystemsRequest(input *efs.DescribeFileSystemsInput) (*request.Request, *efs.DescribeFileSystemsOutput) {
if f.DescribeFileSystemsRequestfn == nil {
return nil, nil
}
return f.DescribeFileSystemsRequestfn(input)
}
func (f *EFS) DescribeMountTargetSecurityGroups(input *efs.DescribeMountTargetSecurityGroupsInput) (*efs.DescribeMountTargetSecurityGroupsOutput, error) {
if f.DescribeMountTargetSecurityGroupsfn == nil {
return nil, nil
}
return f.DescribeMountTargetSecurityGroupsfn(input)
}
func (f *EFS) DescribeMountTargetSecurityGroupsRequest(input *efs.DescribeMountTargetSecurityGroupsInput) (*request.Request, *efs.DescribeMountTargetSecurityGroupsOutput) {
if f.DescribeMountTargetSecurityGroupsRequestfn == nil {
return nil, nil
}
return f.DescribeMountTargetSecurityGroupsRequestfn(input)
}
func (f *EFS) DescribeMountTargets(input *efs.DescribeMountTargetsInput) (*efs.DescribeMountTargetsOutput, error) {
if f.DescribeMountTargetsfn == nil {
return nil, nil
}
return f.DescribeMountTargetsfn(input)
}
func (f *EFS) DescribeMountTargetsRequest(input *efs.DescribeMountTargetsInput) (*request.Request, *efs.DescribeMountTargetsOutput) {
if f.DescribeMountTargetsRequestfn == nil {
return nil, nil
}
return f.DescribeMountTargetsRequestfn(input)
}
func (f *EFS) DescribeTags(input *efs.DescribeTagsInput) (*efs.DescribeTagsOutput, error) {
if f.DescribeTagsfn == nil {
return nil, nil
}
return f.DescribeTagsfn(input)
}
func (f *EFS) DescribeTagsRequest(input *efs.DescribeTagsInput) (*request.Request, *efs.DescribeTagsOutput) {
if f.DescribeTagsRequestfn == nil {
return nil, nil
}
return f.DescribeTagsRequestfn(input)
}
func (f *EFS) ModifyMountTargetSecurityGroups(input *efs.ModifyMountTargetSecurityGroupsInput) (*efs.ModifyMountTargetSecurityGroupsOutput, error) {
if f.ModifyMountTargetSecurityGroupsfn == nil {
return nil, nil
}
return f.ModifyMountTargetSecurityGroupsfn(input)
}
func (f *EFS) ModifyMountTargetSecurityGroupsRequest(input *efs.ModifyMountTargetSecurityGroupsInput) (*request.Request, *efs.ModifyMountTargetSecurityGroupsOutput) {
if f.ModifyMountTargetSecurityGroupsRequestfn == nil {
return nil, nil
}
return f.ModifyMountTargetSecurityGroupsRequestfn(input)
}

0 comments on commit 42611fc

Please sign in to comment.