mirror of
https://github.com/mulgadc/spinifex.git
synced 2026-10-19 10:52:04 +00:00
40f8c4da94
- Rename 36 phaseN_X / phaseIAM_N funcs to runX. - Drop numeric suffix from 7 TestIAMN_X wrappers (TestIAM1_UserCRUD -> TestIAMUserCRUD). - Rewrite harness.Phase log strings "Phase N - X" -> "Single - X" to mirror multinode convention. - Add t.Parallel() to bucket #1: 10 read-only / own-everything top-level Tests (Environment, ClusterStatsCLI, Discovery, SerialConsoleAccess, KeyPairs, Image, TagManagement, AccountScoping, VPCSubnetE2E, RouteTableValidation). Sequential bucket retains source-order singleton lifecycle (InstanceLaunch through FinalClusterStats).
38 lines
1.5 KiB
Go
38 lines
1.5 KiB
Go
//go:build e2e
|
||
|
||
package single
|
||
|
||
import (
|
||
"testing"
|
||
|
||
"github.com/aws/aws-sdk-go/aws"
|
||
"github.com/aws/aws-sdk-go/service/ec2"
|
||
"github.com/mulgadc/spinifex/tests/e2e/harness"
|
||
"github.com/stretchr/testify/require"
|
||
)
|
||
|
||
// runImage rediscovers the architecture-appropriate Ubuntu AMI that
|
||
// bootstrap-install.sh imported from the pre-staged gold-image file
|
||
// (~/images/ubuntu-{26,24}.04.img → `spx admin images import --file`) and
|
||
// stashes the ID on the fixture for Phase 5+. Maps to run-e2e.sh ~233–255.
|
||
func runImage(t *testing.T, fix *Fixture) {
|
||
harness.Phase(t, "Single — Image Management")
|
||
|
||
// Resolve the gold-image AMI via the cluster discovery helper. The first
|
||
// caller pays the DescribeImages + state-poll cost; this and every other
|
||
// AMI consumer hit the memoized ID.
|
||
amiID := needAMI(t, fix)
|
||
require.NotEmpty(t, amiID, "needAMI returned empty AMI ID")
|
||
_, arch := needInstanceTypeArch(t, fix)
|
||
harness.Detail(t, "ami", amiID, "arch", arch)
|
||
|
||
harness.Step(t, "describe-images by AMI ID (verify round-trip)")
|
||
byID, err := fix.AWS.EC2.DescribeImages(&ec2.DescribeImagesInput{
|
||
ImageIds: []*string{aws.String(amiID)},
|
||
})
|
||
require.NoErrorf(t, err, "describe-images %s", amiID)
|
||
require.Lenf(t, byID.Images, 1, "expected exactly 1 image for %s, got %d", amiID, len(byID.Images))
|
||
require.Equal(t, amiID, aws.StringValue(byID.Images[0].ImageId), "round-trip AMI ID mismatch")
|
||
require.NotEmpty(t, aws.StringValue(byID.Images[0].Name), "lookup-by-ID returned empty Name")
|
||
}
|