Skip to content
This repository has been archived by the owner on Jun 26, 2024. It is now read-only.

Commit

Permalink
Fixes for 0.2.1 (#21)
Browse files Browse the repository at this point in the history
* remove stale config example

* update docker-compose to relect new configuration using flags

* update readme to reflect execution mode changes and remove gitlab-ci badge which is not visible to everyone

* documentation updates for running replicant

* make explicit commment about runnning for test development
  • Loading branch information
brunotm authored Mar 2, 2020
1 parent 5f7a116 commit ab4f997
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 66 deletions.
52 changes: 38 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
[![Go Report Card](https://goreportcard.com/badge/github.com/Unbabel/replicant?style=flat-square)](https://goreportcard.com/report/github.com/Unbabel/replicant)
[![GoDoc](https://img.shields.io/badge/api-reference-blue.svg?style=flat-square)](https://godoc.org/github.com/Unbabel/replicant)
[![Docker Cloud Automated build](https://img.shields.io/docker/cloud/automated/unbabel/replicant?style=flat-square)](https://hub.docker.com/r/unbabel/replicant)
[![pipeline status](https://gitlab.com/Unbabel/sre-team/replicant/badges/master/pipeline.svg)](https://gitlab.com/Unbabel/sre-team/replicant/-/commits/master)<br/>


Replicant is a synthetic testing service named after the bioengineered androids from Blade Runner. (all synthetics came from Blade Runner :)

Expand All @@ -14,25 +12,48 @@ It allows web application testing using chromedp, and api application testing us

***Under heavy development and API changes are expected. Please file an issue if anything breaks.***

## Requirements
## Runing replicant

The replicant binary packs all functionality needed to run the server, executor and run local execution of tests for development or CI/CD purposes.

### Locally for test development purposes

```bash
/path/to/replicant run --file api-test.yaml
```

If running locally from with the replicant binary a local chrome web browser with the development protocol can be specified:

```bash
/path/to/replicant run --chrome-remote-url http://127.0.0.1:9222 --file web-test.yaml
```

To have the local chrome browser started with the developer protocol enabled:

```bash
/path/to/chrome --remote-debugging-port=9222
```

### Configuration options

* Go 1.13
* External URL for API tests that require webhook based callbacks
* Chrome with remote debugging (CDP) either in headless mode or in foreground (useful for testing)
Please see:

## Examples
```bash
/path/to/replicant --help
```

## Running the replicant server locally with docker
### Replicant server and executor locally with docker

Using [example config](https://github.com/Unbabel/replicant/blob/master/example-config.yaml) from the project root dir.
The unbabel/replicant docker image packs everything needed to run and manage tests for both web apps and APIs.
See the example `docker-compose.yaml` for more information.

```bash
docker stack deploy -c $PWD/docker-compose.yaml replicant
```

This will deploy the replicant server and 2 chrome-headless nodes for web tests, persisting data under /data.
This will deploy the replicant server and 2 replicant executor nodes for web tests.

### Web application testing (local development)
### Web application testing

Web application testing support is based on the FQL (Ferret Query Language), [documentation](https://github.com/MontFerret/ferret).

Expand Down Expand Up @@ -98,21 +119,24 @@ script: |
}
```

### API testing (local development)
### API testing

##### Using the javascript driver
The following API is exposed by the javascript driver in order to perform HTTP calls and logging:
* `replicant.Log(string)` log messages from the javascript test on the replicant server log.
* `replicant.NewResponse()` create a new response object to be returned as a result of the test, which should be modified accordingly to reflect the test result. The response must be returned as a serialized JSON object by calling its bounded method `Response.JSON`, E.g. `return response.JSON()`.

Response type attributes:

* `replicant.NewResult()` create a new response object to be returned as a result of the test, which should be modified accordingly to reflect the test result. The response must be returned as a serialized JSON object by calling its bounded method `Response.JSON`, E.g. `return response.JSON()`.

Result type attributes:
```js
{
Data: "",
Message: "",
Failed: false,
}
```

* `replicant.http.NewRequest()` creates a new HTTP request object for performing HTTP calls.

HttpRequest attributes:
Expand Down
14 changes: 4 additions & 10 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,15 @@ version: "3.7"
services:
server:
image: docker.io/unbabel/replicant:latest
command: /app/replicant server --listen-address 0.0.0.0:8080 --executor-url http://executor:8080
ports:
- "8080:8080"
volumes:
- data:/data
configs:
- config.yaml
command: /app/replicant -config /config.yaml
cdp:
image: docker.io/unbabel/replicant:replicant-cdp-latest
executor:
image: docker.io/unbabel/replicant:latest
command: /app/replicant executor --listen-address 0.0.0.0:8080 --chrome-enable-local --server-url http://server:8080
deploy:
mode: replicated
replicas: 2
volumes:
data: null
configs:
config.yaml:
file: ./example-config.yaml

42 changes: 0 additions & 42 deletions example-config.yaml

This file was deleted.

0 comments on commit ab4f997

Please sign in to comment.