mirror of https://github.com/kubernetes/kops.git
Add missing mock functions
This commit is contained in:
parent
f79d2da6f6
commit
65c24a9f3d
|
@ -17,10 +17,12 @@ limitations under the License.
|
||||||
package mockec2
|
package mockec2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
|
"github.com/aws/aws-sdk-go/aws/request"
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
)
|
)
|
||||||
|
@ -43,6 +45,11 @@ func (m *MockEC2) DescribeLaunchTemplatesPages(request *ec2.DescribeLaunchTempla
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DescribeLaunchTemplatesPagesWithContext mocks the describing the launch templates
|
||||||
|
func (m *MockEC2) DescribeLaunchTemplatesPagesWithContext(ctx context.Context, request *ec2.DescribeLaunchTemplatesInput, callback func(*ec2.DescribeLaunchTemplatesOutput, bool) bool, option ...request.Option) error {
|
||||||
|
return m.DescribeLaunchTemplatesPages(request, callback)
|
||||||
|
}
|
||||||
|
|
||||||
// DescribeLaunchTemplates mocks the describing the launch templates
|
// DescribeLaunchTemplates mocks the describing the launch templates
|
||||||
func (m *MockEC2) DescribeLaunchTemplates(request *ec2.DescribeLaunchTemplatesInput) (*ec2.DescribeLaunchTemplatesOutput, error) {
|
func (m *MockEC2) DescribeLaunchTemplates(request *ec2.DescribeLaunchTemplatesInput) (*ec2.DescribeLaunchTemplatesOutput, error) {
|
||||||
m.mutex.Lock()
|
m.mutex.Lock()
|
||||||
|
@ -116,6 +123,11 @@ func (m *MockEC2) DescribeLaunchTemplateVersions(request *ec2.DescribeLaunchTemp
|
||||||
return o, nil
|
return o, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DescribeLaunchTemplateVersionsWithContext mocks the retrieval of launch template versions - we don't use this at the moment so we can just return the template
|
||||||
|
func (m *MockEC2) DescribeLaunchTemplateVersionsWithContext(ctx context.Context, request *ec2.DescribeLaunchTemplateVersionsInput, option ...request.Option) (*ec2.DescribeLaunchTemplateVersionsOutput, error) {
|
||||||
|
return m.DescribeLaunchTemplateVersions(request)
|
||||||
|
}
|
||||||
|
|
||||||
// CreateLaunchTemplate mocks the ec2 create launch template
|
// CreateLaunchTemplate mocks the ec2 create launch template
|
||||||
func (m *MockEC2) CreateLaunchTemplate(request *ec2.CreateLaunchTemplateInput) (*ec2.CreateLaunchTemplateOutput, error) {
|
func (m *MockEC2) CreateLaunchTemplate(request *ec2.CreateLaunchTemplateInput) (*ec2.CreateLaunchTemplateOutput, error) {
|
||||||
m.mutex.Lock()
|
m.mutex.Lock()
|
||||||
|
|
|
@ -26,6 +26,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
|
"github.com/aws/aws-sdk-go/aws/request"
|
||||||
"github.com/aws/aws-sdk-go/service/autoscaling"
|
"github.com/aws/aws-sdk-go/service/autoscaling"
|
||||||
"github.com/aws/aws-sdk-go/service/autoscaling/autoscalingiface"
|
"github.com/aws/aws-sdk-go/service/autoscaling/autoscalingiface"
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
|
@ -949,6 +950,10 @@ func (m *disabledSurgeTest) DetachInstances(input *autoscaling.DetachInstancesIn
|
||||||
return &autoscaling.DetachInstancesOutput{}, nil
|
return &autoscaling.DetachInstancesOutput{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *disabledSurgeTest) DetachInstancesWithContext(ctx context.Context, input *autoscaling.DetachInstancesInput, option ...request.Option) (*autoscaling.DetachInstancesOutput, error) {
|
||||||
|
return m.DetachInstances(input)
|
||||||
|
}
|
||||||
|
|
||||||
func TestRollingUpdateDisabledSurge(t *testing.T) {
|
func TestRollingUpdateDisabledSurge(t *testing.T) {
|
||||||
c, cloud := getTestSetup()
|
c, cloud := getTestSetup()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue