Skip to content
This repository has been archived by the owner on May 9, 2020. It is now read-only.

Update README.md #187

Merged
merged 5 commits into from Nov 30, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
49 changes: 39 additions & 10 deletions README.md
Expand Up @@ -35,7 +35,7 @@ are for hacking on the worker itself.

## Requirements

- Node 0.12x or greater
- Node 0.12.x
- Docker
- Packer (to build ami)

Expand Down Expand Up @@ -73,17 +73,46 @@ for the docker worker in particular these are important:

## Running tests

The `./test/test.sh` script is used to run individual tests which are
suffixed with `_test.js` for example: `./test/test.sh test/integration/live_log_test.js`.
There are a few components that must be configured for the tests to work properly (e.g. docker, kernel
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized these steps are needed if you're on Mac OS X. If you're running Linux, the odds you can't run docker in the host machine are small.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, if one wants to run within docker on their linux host, they are more than capable of doing so. They will also need some of the kernel modules for video and sound devices that we use if they want the loopback devices to work, which I've seen some people not have configured.

modules, and other packages). To ease the setup, a vagrant file is provided in this repo that can setup
an environment very similar to the one docker-worker runs in production.

```sh
# from the top level
#### Setting up vagrant

./build.sh
npm test
```
1. Install [VirtualBox](https://www.virtualbox.org/)
2. Install [Vagrant](https://www.vagrantup.com/)
2. Within the root of the repo, run `vagrant up`

*** Note: If TASKCLUSTER_ACCESS_TOKEN, TASKCLUSTER_CLIENT_ID, PULSE_USERNAME, PULSE_PASSWORD are configured within the virtual environment if available locally when building ***

#### Logging into virtual machine and configuring environment

1. `vagrant ssh`
2. The tests require TASKCLUSTER_ACCESS_TOKEN, TASKCLUSTER_CLIENT_ID, PULSE_USERNAME, PULSE_PASSWORD to be setup within the environment. If they were not available locally when building, add them to the virtual machine now.
3. `cd /vagrant` # Your local checkout of the docker-worker repo is made available under the '/vagrant' directory
4. `./build.sh` # Builds some of the test images that are required
5. `npm install` # Installs all the necessary node modules

#### Running Tests

The following set of scopes are needed for running the test suites:

* queue:create-task:no-provisioning-nope/dummy-type-*
* queue:poll-task-urls
* queue:claim-task
* queue:resolve-task
* queue:create-artifact:public/*
* queue:get-artifact:private/docker-worker-tests/*
* queue:cancel-task
* assume:worker-type:no-provisioning-nope/dummy-type-*
* assume:scheduler-id:docker-worker-tests/*
* assume:worker-id:random-local-worker/dummy-worker-*

1. Either all the tests can be run, but running `npm test` or `./test/test.sh`, however, under most circumstances one only wants to run a single test suite
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can add a paragraph on authentication? I couldn't find out missing scope until I hacked into the TC client to expose the error.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We absolutely need something like that. I'm surprised the TC client didn't show the error, it typically does for missing scopes. If there was an error that wasn't clear I would suggest entering a bug against tc client so that we can make sure we're getting the right errors out there.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I wasn't sure if that was expected or not. I'll file a bug for that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks. I also added the scopes that were added for your client ID. I think this list will probably change at some point as we move them into their own role that people could have.

2. For individual test files, run `./node_modules/mocha/bin/mocha --bail test/<file>`
3. For running tests within a test file, add "--grep <phrase>" when running the above command to capture just the individual test name.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or you can just make one test run thanks to test.only()


This will build the docker image for the tasks and run the entire suite.
*** Note: Sometimes things don't go as planned and tests will hang until they timeout. To get more insight into what went wrong, set "DEBUG=*" when running the tests to get more detailed output. ***

### Common problems

Expand All @@ -100,7 +129,7 @@ list](/deploy/checklist.md)

- [packer](www.packer.io)
- make
- node 0.12 or greater
- node 0.12.x
- credentials for required services (i.e. AWS)


Expand Down