Skip to content

Change base image used in acceptance tests#658

Merged
anurag5sh merged 4 commits intomainfrom
acc_test_baseimage
Apr 6, 2026
Merged

Change base image used in acceptance tests#658
anurag5sh merged 4 commits intomainfrom
acc_test_baseimage

Conversation

@anurag5sh
Copy link
Copy Markdown
Collaborator

Description

Replace test AMIs with HC-base images and fix nil pointer issues

Changes:

  • Replaced several test AMIs with HashiCorp-compliant base images (hc-base-ubuntu-2204)
  • Fixed nil pointer dereferences in checkSnapshotsDeleted() and related AWS API helper functions
  • Added proper error handling for AWS SDK v2 calls (DescribeSnapshots, DescribeImages, DescribeImageAttribute)
  • Updated checkSnapshotsDeleted() to handle AWS SDK v2 behavior where deleted snapshots return InvalidSnapshot.NotFound error

Future Work

Replace all remaining acceptance tests with HashiCorp-compliant base images for consistent test behavior across all builders.

improve error handling during acc test
this is a temp vm created for a very short duration to test if private key ssh login works
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates Amazon EBS acceptance tests to use newer base images and hardens AWS SDK v2 interactions to avoid nil dereferences and improve error handling.

Changes:

  • Swaps several hard-coded source_ami values to HashiCorp base Ubuntu 22.04 images for more consistent acceptance test behavior.
  • Adds error handling for testEC2Conn failures and nil/empty responses from DescribeImages.
  • Updates snapshot deletion verification to account for AWS SDK v2’s InvalidSnapshot.NotFound behavior.
Comments suppressed due to low confidence (1)

builder/ebs/builder_acc_test.go:2231

  • The provisioning command pipes credentials into chpasswd but also passes ubuntu as a positional argument (chpasswd [file]), which will make chpasswd try to read from a file named ubuntu and likely ignore stdin / fail. This will prevent the user account password from being set. Drop the extra argument so the password comes from stdin (or explicitly target the intended user).
				"sudo sed -i 's/^#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config",
				"sudo useradd -m -s /bin/bash user",
				"echo 'Setting up password for user'",
				"echo 'user:password' | sudo chpasswd ubuntu",
				"sudo usermod -aG sudo user",

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread builder/ebs/builder_acc_test.go
Comment thread builder/ebs/builder_acc_test.go
@anurag5sh anurag5sh merged commit 0a2935b into main Apr 6, 2026
16 checks passed
@anurag5sh anurag5sh deleted the acc_test_baseimage branch April 6, 2026 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants