Giter Site home page Giter Site logo

dcos-test-utils's Introduction

dcos-test-utils

This module is the backend for the dcos_api_session object used as a test harness in the DC/OS integration tests. More specifically, this module provides utilities that allow:

  • Storing common URL elements repeated between requests to the same service
  • Providing a DC/OS-authenticated API Client that can be wrapped and composed with API Mixins
  • Helper methods for managing Marathon and other DC/OS services

To read more about how to use this library, Read the Docs

System Requirements

  • python 3.5
  • local SSH client at /usr/bin/ssh

Using the library interactively

python3.5 -m venv env
. env/bin/activate
pip3 install -r requirements.txt
python setup.py develop

Running Unit Tests with tox

Simply run tox and the following will be executed:

  • flake8 for style errors
  • pytest for unit tests

Note: these can be triggered individually by supplying the -e option to tox

Running Integration Tests with Tox

Integration tests are not run by default as they require a real DC/OS cluster which is externally provided.

To launch a cluster, check out dcos-launch, which can be used like so (on a GNU/Linux system):

#!/bin/bash
wget https://downloads.dcos.io/dcos-launch/bin/linux/dcos-launch
chmod +x dcos-launch
cat <<EOF > config.yaml
---
launch_config_version: 1
deployment_name: YOUR-DEPLOYMENT-NAME-HERE
template_url: https://s3.amazonaws.com/downloads.dcos.io/dcos/testing/master/cloudformation/single-master.cloudformation.json
provider: aws
aws_region: us-west-2
key_helper: true
template_parameters:
    AdminLocation: 0.0.0.0/0
    PublicSlaveInstanceCount: 1
    SlaveInstanceCount: 1
ssh_user: core
EOF

dcos-launch create

dcos-launch wait

export DCOS_DNS_ADDRESS=http://`dcos-launch describe | jq -r .masters[0].public_ip`

# if WAIT_FOR_HOSTS is set to `true`, then MASTER_LIST, SLAVE_LIST, and PUBLIC_SLAVE list
# must be set before starting the test
export WAIT_FOR_HOSTS=false

tox -e py35-integration-tests

dcos-launch-delete

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.