Skip to content

Instantly share code, notes, and snippets.

@niski84
Created February 28, 2023 03:37
Show Gist options
  • Save niski84/4c11df77247495e1a5ef8cbf0e5d3846 to your computer and use it in GitHub Desktop.
Save niski84/4c11df77247495e1a5ef8cbf0e5d3846 to your computer and use it in GitHub Desktop.
test cases for EB pause and resume
package awsapi
import (
"testing"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
)
func TestPauseEnvironment(t *testing.T) {
// Create a new AWS session
sess := session.Must(session.NewSession(&aws.Config{
Region: aws.String("us-west-2"),
}))
// Create an instance of the struct
instance := Instance{AwsSession: sess}
// Test the PauseEnvironment function
err := PauseEnvironment(instance, "my-environment")
if err != nil {
t.Errorf("failed to pause environment: %v", err)
}
}
func TestResumeEnvironment(t *testing.T) {
// Create a new AWS session
sess := session.Must(session.NewSession(&aws.Config{
Region: aws.String("us-west-2"),
}))
// Create an instance of the struct
instance := Instance{AwsSession: sess}
// Test the ResumeEnvironment function
err := ResumeEnvironment(instance, "my-environment")
if err != nil {
t.Errorf("failed to resume environment: %v", err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment