Add missing mock functions

This commit is contained in:
Ciprian Hacman 2023-10-22 18:28:22 +03:00 committed by justinsb
parent f79d2da6f6
commit 65c24a9f3d
2 changed files with 17 additions and 0 deletions

View File

@ -17,10 +17,12 @@ limitations under the License.
package mockec2
import (
"context"
"fmt"
"strings"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/ec2"
"k8s.io/klog/v2"
)
@ -43,6 +45,11 @@ func (m *MockEC2) DescribeLaunchTemplatesPages(request *ec2.DescribeLaunchTempla
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
func (m *MockEC2) DescribeLaunchTemplates(request *ec2.DescribeLaunchTemplatesInput) (*ec2.DescribeLaunchTemplatesOutput, error) {
m.mutex.Lock()
@ -116,6 +123,11 @@ func (m *MockEC2) DescribeLaunchTemplateVersions(request *ec2.DescribeLaunchTemp
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
func (m *MockEC2) CreateLaunchTemplate(request *ec2.CreateLaunchTemplateInput) (*ec2.CreateLaunchTemplateOutput, error) {
m.mutex.Lock()

View File

@ -26,6 +26,7 @@ import (
"time"
"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/autoscalingiface"
"github.com/aws/aws-sdk-go/service/ec2"
@ -949,6 +950,10 @@ func (m *disabledSurgeTest) DetachInstances(input *autoscaling.DetachInstancesIn
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) {
c, cloud := getTestSetup()