This repo holds some automation scripts that create an AWS EC2 instance using CloudFormation and prepares it to run DC/OS e2e tests.
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 thataws 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 parsingaws
output. - For Enterprise DC/OS: Have an SSH private key in
$HOME/.ssh/id_rsa
that can be used to pull themesosphere/dcos-enterprise
repo. - For Enterprise DC/OS: Have a
license.txt
file that contains a proper DC/OS Enterprise license.
Configuration is provided using the config.sh
file. You will also need an SSH
key pair for accessing your EC2 instance.
- Create an EC2 key pair and download the private key. https://console.aws.amazon.com/ec2/v2/home#KeyPairs
- Prepare your shell to access AWS services using the CLI. https://aws.amazon.com/cli/
- 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
. - 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. - Run
./stack status
to see whether everything is prepared. It should tell you that no stack with the given name exists, yet. - Create your CloudFormation stack:
./stack create
- When everything's worked fine, you'll find yourself SSH'd into the machine after some minutes.
- Type
cd e2e/dcos/test-e2e
and then run a test, e.g.pytest test_service_account.py
The stack
command has several sub-commands:
Creates the CloudFormation stack, prepares an e2e test environment and logs you into the machine.
Deletes the CloudFormation stack completely.
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
).
Lists all the outputs from the CloudFormation stack such as the public IPv4 address.
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.
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