cloud/aws: move maintenance calls to separate file
This commit is contained in:
parent
66c2c31a1c
commit
8fc91d1c6d
4 changed files with 95 additions and 75 deletions
|
|
@ -5,7 +5,6 @@ import (
|
|||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
ec2types "github.com/aws/aws-sdk-go-v2/service/ec2/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/cloud/awscloud"
|
||||
|
|
@ -78,27 +77,6 @@ func TestEC2CopyImage(t *testing.T) {
|
|||
require.Equal(t, 2, m.calledFn["CreateTags"])
|
||||
}
|
||||
|
||||
func TestEC2RemoveSnapshotAndDeregisterImage(t *testing.T) {
|
||||
m := newEc2Mock(t)
|
||||
aws := awscloud.NewForTest(m, nil, &s3mock{t, "bucket", "object-key"}, nil, nil)
|
||||
require.NotNil(t, aws)
|
||||
|
||||
err := aws.RemoveSnapshotAndDeregisterImage(&ec2types.Image{
|
||||
ImageId: &m.imageId,
|
||||
State: ec2types.ImageStateAvailable,
|
||||
BlockDeviceMappings: []ec2types.BlockDeviceMapping{
|
||||
{
|
||||
Ebs: &ec2types.EbsBlockDevice{
|
||||
SnapshotId: &m.snapshotId,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 1, m.calledFn["DeleteSnapshot"])
|
||||
require.Equal(t, 1, m.calledFn["DeregisterImage"])
|
||||
}
|
||||
|
||||
func TestEC2Regions(t *testing.T) {
|
||||
m := newEc2Mock(t)
|
||||
aws := awscloud.NewForTest(m, nil, &s3mock{t, "bucket", "object-key"}, nil, nil)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue