Skip to content

Commit

Permalink
Terminate ec2 instance runner after e2e tests (#6713)
Browse files Browse the repository at this point in the history
  • Loading branch information
g-gaston authored Sep 22, 2023
1 parent 75bd195 commit 49e0d2c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion internal/test/e2e/testRunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"strconv"
"time"

"github.com/aws/aws-sdk-go-v2/aws"
aws_ssm "github.com/aws/aws-sdk-go/service/ssm"
"github.com/go-logr/logr"
"gopkg.in/yaml.v2"
Expand Down Expand Up @@ -229,7 +230,13 @@ func (v *VSphereTestRunner) decommInstance(c instanceRunConf) error {
return nil
}

func (v *Ec2TestRunner) decommInstance(c instanceRunConf) error {
func (e *Ec2TestRunner) decommInstance(c instanceRunConf) error {
runnerName := getTestRunnerName(e.logger, c.jobId)
e.logger.V(1).Info("Terminating ec2 Test Runner instance", "instanceID", e.InstanceID, "runner", runnerName)
if err := ec2.TerminateEc2Instances(c.session, aws.StringSlice([]string{e.InstanceID})); err != nil {
return fmt.Errorf("terminating instance %s for runner %s: %w", e.InstanceID, runnerName, err)
}

return nil
}

Expand Down

0 comments on commit 49e0d2c

Please sign in to comment.