Skip to content

Quickly create an AWS EC2 instance ready to run e2e tests

Notifications You must be signed in to change notification settings

mesosphere/dcos-e2e-infra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DC/OS E2E environment preparation

This repo holds some automation scripts that create an AWS EC2 instance using CloudFormation and prepares it to run DC/OS e2e tests.

What you'll need

On your machine make sure to meet all of these requirements:

  • Have an AWS account
  • Have the aws CLI installed and properly configured. Make sure that aws sts get-caller-identity returns a proper identity.
  • Bash: The stack script will only run in Bash so be sure to have that installed.
  • Have jq installed. This is used for parsing aws output.
  • For Enterprise DC/OS: Have an SSH private key in $HOME/.ssh/id_rsa that can be used to pull the mesosphere/dcos-enterprise repo.
  • For Enterprise DC/OS: Have a license.txt file that contains a proper DC/OS Enterprise license.

How to use

Configuration is provided using the config.sh file. You will also need an SSH key pair for accessing your EC2 instance.

  1. Create an EC2 key pair and download the private key. https://console.aws.amazon.com/ec2/v2/home#KeyPairs
  2. Prepare your shell to access AWS services using the CLI. https://aws.amazon.com/cli/
  3. Clone this repo and put the EC2 private key in the same folder as the rest of the files from this repo. The name of the file must be ssh-key.pem.
  4. Create the file config.sh and provide a complete configuration (see example below). The file must reside in the folder containing this repo's contents.
  5. Run ./stack status to see whether everything is prepared. It should tell you that no stack with the given name exists, yet.
  6. Create your CloudFormation stack: ./stack create
  7. When everything's worked fine, you'll find yourself SSH'd into the machine after some minutes.
  8. Type cd e2e/dcos/test-e2e and then run a test, e.g. pytest test_service_account.py

Command reference

The stack command has several sub-commands:

./stack create

Creates the CloudFormation stack, prepares an e2e test environment and logs you into the machine.

./stack delete

Deletes the CloudFormation stack completely.

./stack status [-f]

Checks the status of the CloudFormation stack. If the -f flag is provided, queries the status every 500ms until a final status is returned (a status is treated as final when it doesn't end with _IN_PROGRESS).

./stack outputs

Lists all the outputs from the CloudFormation stack such as the public IPv4 address.

./stack ssh

Opens an SSH session on the EC2 machine. This way you don't have to find out the machine's IP address and/or user name.

Example configuration

Here's a sample config.sh file:

# This is the name of the CloudFormation stack created for you
STACK_NAME=makkes-e2e
# This is the name of the key pair used for the EC2 instance. This key pair
# must exist prior to creating the CloudFormation stack. The private key must
# reside in a file called `ssh-key.pem` in the current directory.
KEYPAIR_NAME=makkes-e2e
# Do you want to test Open Source DC/OS or Enterprise? 'open' or 'ee'
VARIANT=ee
# Owner of the stack. This is used to tag all the AWS resources properly
OWNER=makkes

About

Quickly create an AWS EC2 instance ready to run e2e tests

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages